vania-janet/multiturn-rag-retrieval-data huggingface dataset:
Use a well-defined, well-documented request library that includes browser support, like [axios](https://github.com/axios/axios), [superagent](https://github.com/visionmedia/superagent), or [node-fetch](https://github.com/node-fetch/node-fetch).





 Objects for arguments 

The methods in your SDK should take a JSON object as an argument. This object will contain the options for the requests, instead of using positional parameters in the function definition.





 Async architecture 

All network calls from your SDK should be asynchronous. All asynchronous calls should be handled using Promises, not callbacks.





 Standard features 





 Authentication 

You are not required to use a particular library to provide the authentication for your service.

Your SDK must support all of the authentication methods for your service.





 Configuration 

In the interests of making your SDK easy to consume and cloud native, you should provide the ability to read in environment variables. Abstracting the application logic from the environment logic allows your users to focus on using your service capabilities their applications.

If you build this capability into your SDK, you must document this mechanism clearly with examples.





 Using node-sdk-core 

[IBM node-sdk-core](https://github.com/IBM/node-sdk-core) provides configuration and authentication support. You can use the existing functionality provided by this dependency in your SDK.





 Documentation 

Your SDK is not useful if your audience cannot understand how to consume it in order to do the basic operations for your service. Your SDK needs to contain the following resources to help your users:



* README.md
* NPM metadata
* [Contributor guidelines](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-documentationsdk-contributor-docs)
* Code Samples
* [Service documentation](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-documentation)







 Samples
Your SDK needs to contain the following resources to help your users:



* README.md
* [Contributor Guidelines](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-documentationsdk-contributor-docs)
* Code Samples
* [Service documentation](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-documentation)





 Samples 

For your Swift SDK, you will want some simple code samples and explanations of what each does. Linking out to the API reference documentation for more advanced use is strongly encouraged.

At minimum, the samples should be included in the README.md file. They should communicate how to install the library, and complete the basic operations provided by your API.
The releases of these SDKs should be published on [NPM](https://www.npmjs.com/). Your NPM package should be [scoped](https://docs.npmjs.com/creating-and-publishing-scoped-public-packagescreating-a-scoped-public-package) with [@ibm-cloud](https://www.npmjs.com/search?q=%40ibm-cloud), so that NPM users can find similar packages across NPM.

Your SDK should follow the [semantic versioning best practices](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-distributiondistribution-semver).





 Community support 

Allow your users to find answers to their questions. Users should be able to report problems on GitHub by raising issues on your SDK repository. Having a public Slack channel is a great way to engage with users who have questions specific to their use cases.





 Style guidelines 

You should follow the [Airbnb conventions](https://github.com/airbnb/javascript), with two spaces for indentation.

You should use the standard [development tools](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-devtools) for JavaScript to check style and code coverage.





 Streaming support 

If your API takes fileType parameters, you should accept Node.js streams as an input type.





 Dependencies 

Use a well-defined, well-documented request library that includes browser support, like [axios](https://github.com/axios/axios), [superagent](https://github.com/visionmedia/superagent), or [node-fetch](https://github.com/node-fetch/node-fetch).





 Objects for arguments 

The methods in your SDK should take a JSON object as an argument. This object will contain the options for the requests, instead of using positional parameters in the function definition.





 Async architecture
Specific instructions for downloading and installing SDKs are available for [Python](https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-python), [Node.js](https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-node), [Java](https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-java), and [Go](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-using-go). Also, when working with Command Line Instructions (CLI) and your CLI clients, please check out the pertinent information related to Object Storage regarding [AWS](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-aws-cli) compatibility, [Minio](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-minio), and [rClone](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-rclone).

For this code pattern you will need: * An [IBM Cloud® Platform account](https://cloud.ibm.com) * An instance of [IBM Cloud Object Storage](https://cloud.ibm.com/docs/cloud-object-storage/basics?topic=cloud-object-storage-provision) * Configured and operational use of IBM Cloud Object Storage SDKs for your choice of Java, Python, NodeJS, or Go; or, a configured and operational CLI client.





 Using the Console 

Before getting to the examples, there is one way to empty a bucket via the GUI at the [IBM Cloud console](https://cloud.ibm.com/): using an expiration rule on the bucket itself.
Using the Python client 

You can use the Python Client to manage the IBM Cloud Monitoring service. The client is also known as the sdcclient.

These instructions apply to Python version 3.x.

To manage resources that are associated with the default team, use IAM as your authentication method.

To manage resources that are associated with a team, you must use the Monitoring API token that is active for the team.



 Step 1. Installing the Python client 



 Prerequisites 

Install the following Python packages that you need when you use Python version 3 or later:



1. Run the following command to install the request package:

pip3 install requests
2. Run the following command to install the pyyaml package:

python3 -m pip install pyyaml







 Installing the Python client by using pip 

From a terminal, run the following comnmnand:

The sddclient version must be at least 0.9.x.

 sddclient version must be at least 0.9.0
pip3 install sdcclient





 Installing the Python client from a GitHub repo 

Complete the following steps:



1. Make a folder to copy the client code.

mkdir python-client && cd python-client
2. Clone the repository.

git clone https://github.com/draios/python-sdc-client.git
3. Create an empty Python script.

touch script.py
4. Confirm python-sdc-client/script.py is listed when you verify the contents of the folder python-client.

ls









 Step 2. Reference the Python client in your Python script 



 Reference the Python client that is installed by using pip 

You can reference the Python client by adding the following statement to your Python script:

from sdcclient import IbmAuthHelper, SdMonitorClient





 Reference the Python client that is installed by cloning a GitHub repo 

Add the following entries to your Python script to import the GitHub cloned package into your script:

import sys
* [TransferManager](https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-javajava-examples-transfer-manager)







 Using the Python SDK 

The Python SDK provides two ways to run large object uploads:



* [Multipart Uploads](https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-pythonpython-examples-multipart)
* [TransferManager](https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-pythonpython-examples-multipart-transfer)







 Using the Node.js SDK 

The Node.js SDK provides a single way to run large object uploads:



* [Multipart Uploads](https://cloud.ibm.com/docs/cloud-object-storage/iam?topic=cloud-object-storage-nodenode-examples-multipart)
Take a tour of the functions in the [Data Engine Starter Notebook](https://dataplatform.cloud.ibm.com/exchange/public/entry/view/e82c765fd1165439caccfc4ce8579a25?context=cpdaas). The Python SDK also comes with a dedicated [online documentation](https://ibm-cloud.github.io/sql-query-clients/intro.htmlibmcloudsql).

Usage of legacy SoftLayer endpoints discontinued
: The usage of the legacy SoftLayer endpoints of Cloud IBM Cloud Object Storage is discontinued. Check out the [Cloud Object Storage announcement](https://cloud.ibm.com/status?component=cloud-object-storage&location=global&selected=announcement&query=2020+Actions) for more details.





 September 2020 

Use JDBC to connect to business intelligence tools
: You can use our JDBC driver to connect Data Engine to business intelligence tools and other applications. To download and configure the driver, see the [JDBC documentation](https://cloud.ibm.com/docs/sql-query?topic=sql-query-jdbc).

Monitoring with Sysdig
: Data Engine supports monitoring metrics for submitted jobs by using [IBM Cloud® Monitoring](https://cloud.ibm.com/docs/Monitoring-with-Sysdig?topic=Monitoring-with-Sysdig-getting-started). You can view completed and failed jobs, the number of bytes processed, and the jobs in progress. A default Data Engine dashboard exists, and you can define custom dashboards and alerts.





 May 2020 

Index management
: Data Engine supports index management, also referred to as data skipping. Index management can significantly boost performance and reduce cost of your SQL queries by skipping over irrelevant data.
: Service access role Manager is required to run catalog management or index management commands.

Catalog management
: Data Engine database catalog support is extended to support [views](https://cloud.ibm.com/docs/sql-query?topic=sql-query-sql-referencechapterCreateView).
[CHANGELOG.md](https://github.com/ibm-functions/runtime-python/blob/master/python3.7/CHANGELOG.md). 
 3.6 Python 3.6 reached end of support on 2021/12/23. <br>See [end of life Python Releases](https://endoflife.date/python). 
 2.7 Python 2.7 reached end of support on 2020/01/01. <br>See [the Active Python Releases](https://www.python.org/downloads/). 





 Migrating from Python 3.7 to Python 3.9, Python 3.11 



Table 2. Migrating details from Python 3.7 to Python 3.9

 Package Details 

 ibmcloudant The cloudant sdk has moved to the new ibmcloudant sdk. It includes a number of breaking changes. See [migration guide](https://github.com/cloudant/python-cloudant/blob/master/MIGRATION.md) for more information. 
 ibm-watson The watson-developer-cloud sdk has renamed to the new ibm-watson sdk and includes breaking changes. See [pypi ibm-watson](https://pypi.org/project/ibm-watson/) and [github ibm-watson](https://github.com/watson-developer-cloud/python-sdk) for more information. 



For more information about migrating to python:3.9, see [(Details on GitHub)](https://github.com/ibm-functions/runtime-python/blob/master/python3.9/CHANGELOG.md).





 Python packages 

Ensure that your action uses only the packages that are mentioned in the following table. \n While other Python packages might be part of the runtime, they are included only as indirect dependencies of the other listed packages. These unlisted packages are candidates to be removed as soon as they are not required by the referring package.

Python 3.11 packages

Python 3.9 packages

Python 3.7 packages



Table 1.
sdclient = SdMonitorClient(token=SYSDIG_TOKEN,sdc_url=URL)

ok, res = sdclient.get_dashboards()

if not ok:
print(res)
sys.exit(1)

 Creating sysdig dashboard directory to store dashboards
if not os.path.exists(sysdig_dashboard_dir):
os.makedirs(sysdig_dashboard_dir)

for db in res['dashboards']:
sdclient.save_dashboard_to_file(db, os.path.join(sysdig_dashboard_dir, str(db['id'])))

print("Name: %s, Charts: %d" % (db['name'], len(db['widgets'])))
Show more
You should follow the [PEP8 style guide for Python](https://www.python.org/dev/peps/pep-0008/), with a few modifications, like four spaces instead of tabs for indentation.

You should use the standard [development tools](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-developer-tools) for Python to check style and code coverage.



 Docstrings 

All non-trivial methods should have docstrings. Docstrings should follow the [PEP257 guidelines](https://www.python.org/dev/peps/pep-0257/). For more examples, see the [Google style guide regarding docstrings](https://google.github.io/styleguide/pyguide.html381-docstrings).







 Dependencies 

Your Python SDK should use synchronous network calls, using a library like [requests](https://pypi.org/project/requests/).

[PyJWT](https://pyjwt.readthedocs.io/en/latest/) is recommended for encoding and decoding JSON web tokens.

Your SDK should use [logging](https://docs.python.org/3/library/logging.html) to assist users with low-level debugging.





 Standard features 





 Authentication 

You are not required to use a particular library to provide the authentication for your service.

Your SDK must support all of the authentication methods for your service.





 Configuration 

In the interests of making your SDK easy to consume and cloud native, you should provide the ability to read in environment variables. Abstracting the application logic from the environment logic allows your users to focus on using your service capabilities their applications.

If you build this capability into your SDK, you must document this mechanism clearly with examples.





 Using python-sdk-core 

[IBM python-sdk-core](https://github.com/IBM/python-sdk-core) provides configuration and authentication support.
Using Go 

The IBM Cloud® Object Storage SDK for Go provides features to make the most of IBM Cloud Object Storage.

The IBM Cloud Object Storage SDK for Go is comprehensive, with many features and capabilities that exceed the scope and space of this guide. For detailed class and method documentation [see the Go API documentation](https://ibm.github.io/ibm-cos-sdk-go/). Source code can be found in the [GitHub repository](https://github.com/IBM/ibm-cos-sdk-go).



 Getting the SDK 

Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies. The SDK requires a minimum version of Go 1.10 and maximum version of Go 1.12. Future versions of Go will be supported once our quality control process has been completed.

go get github.com/IBM/ibm-cos-sdk-go

To update the SDK use go get -u to retrieve the latest version of the SDK.

go get -u github.com/IBM/ibm-cos-sdk-go



 Import packages 

After you have installed the SDK, you will need to import the packages that you require into your Go applications to use the SDK, as shown in the following example:

import (
"github.com/IBM/ibm-cos-sdk-go/aws/credentials/ibmiam"
"github.com/IBM/ibm-cos-sdk-go/aws"
"github.com/IBM/ibm-cos-sdk-go/aws/session"
"github.com/IBM/ibm-cos-sdk-go/service/s3"
)







 Creating a client and sourcing credentials 

To connect to IBM Cloud Object Storage, a client is created and configured by providing credential information (API key and service instance ID). These values can also be automatically sourced from a credentials file or from environment variables.
!/usr/bin/env python3

import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))

from sdcclient import IbmAuthHelper, SdMonitorClient

 Parse arguments.
def usage():
print('usage: %s <ENDPOINT_URL> <MONITOR_TOKEN> <INSTANCE_GUID>' % sys.argv[0])
print('ENDPOINT_URL: IBM Cloud endpoint URL (e.g. https://us-south.monitoring.cloud.ibm.com')
print('MONITOR_TOKEN: token that is associated to a team.')
sys.exit(1)

if len(sys.argv) != 3:
usage()

URL = sys.argv[1]
MONITOR_TOKEN = sys.argv[2]

 Instantiate the client
sdclient = SdMonitorClient(token=MONITOR_TOKEN,sdc_url=URL)
Show more





 References 



* [Extracting metrics from a Monitoring instance by using the Monitoring Python client](https://cloud.ibm.com/docs/monitoring?topic=monitoring-metrics_python)
* [Managing dashboards by using the Monitoring Python client](https://cloud.ibm.com/docs/monitoring?topic=monitoring-dashboard_python)
* [Managing alerts by using the Python client](https://cloud.ibm.com/docs/monitoring?topic=monitoring-alert_python)
* [Python Client](https://github.com/draios/python-sdc-client)
* [Monitoring Python samples](https://github.com/draios/python-sdc-client/tree/master/examples)
* [Example 3](https://github.com/draios/python-sdc-client/blob/master/examples/get_data_datasource.py): This sample script shows how to get data by creating a request where you specify the datasource.







 Metrics dictionary 

To see the pre-defined metrics, see [Metrics dictionary](https://docs.sysdig.com/en/metrics-dictionary.html).

To see the pre-defined metrics that are defined by IBM Cloud services that are enabled for Monitoring, see [Cloud services](https://cloud.ibm.com/docs/monitoring?topic=monitoring-cloud_services).





 Data aggregation 

To learn about data aggregation, see [Data Aggregation](https://docs.sysdig.com/en/data-aggregation.html).
sdclient = SdMonitorClient(sdc_url=URL, custom_headers=ibm_headers)

ok, res = sdclient.get_dashboards()

if not ok:
print(res)
sys.exit(1)

 Creating sysdig dashboard directory to store dashboards
if not os.path.exists(sysdig_dashboard_dir):
os.makedirs(sysdig_dashboard_dir)

for db in res['dashboards']:
sdclient.save_dashboard_to_file(db, os.path.join(sysdig_dashboard_dir, str(db['id'])))

print("Name: %s, Charts: %d" % (db['name'], len(db['widgets'])))
Show more





 Download custom dashboards in a team 

The following code shows the structure of a Python script to download a custom dashboard from a specific team.

!/usr/bin/env python3

import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))

from sdcclient import SdMonitorClient

 Parse arguments.
def usage():
print('usage: %s <endpoint-url> <sysdig_token>' % sys.argv[0])
print('endpoint-url: The endpoint URL that should point to IBM Cloud')
print('sysdig_token: Sysdig token for the team')
sys.exit(1)

if len(sys.argv) != 3:
usage()

URL = sys.argv[1]

 Set to the Sysdig token of the team
SYSDIG_TOKEN = sys.argv[2]

def zipdir(path, ziph):
APIs and SDKs 

Watson Query provides REST APIs that you can use to interact with your instance.

To access data, view and create database objects, administer, and monitor your service, use the [Watson Query APIs](https://cloud.ibm.com/apidocs/data-virtualization-on-cloud).

The following Watson Query SDKs are supported by IBM:



*  [Go SDK](https://github.com/IBM/data-virtualization-on-cloud-go-sdk/)
*  [Java SDK](https://github.com/IBM/data-virtualization-on-cloud-java-sdk/)
Your Go SDK should be packaged as a [Go Module](https://blog.golang.org/using-go-modules), using the GitHub repository URL as a package name.





 Java 

Your Java SDK should publish its artifacts on [Maven Central](https://search.maven.org/). It is recommended that artifacts use a Maven groupId of com.ibm.cloud.





 Node 

Your Node SDK should be released as an [npm](https://www.npmjs.com/) package within the [ibm-cloud](https://www.npmjs.com/org/ibm-cloud) organization. It is recommended that your package name follows the pattern of ibm-<service-category> if possible (for example, ibm-platform-services or ibm-networking-services). Using [NPM Scopes](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-nodenode-publishing) is strongly encouraged.





 Python 

Your Python SDK should be released on [PyPI](https://pypi.python.org/) / [pip](https://pypi.python.org/pypi/pip) and should have a package name beginning with ibm-. It is recommended that your package name follows the pattern of ibm-<service-category> if possible (for example, ibm-platform-services or ibm-networking-services).





 Swift 

Your Swift SDK should be released on [Swift Package Manager](https://swift.org/package-manager/) / [CocoaPods](https://cocoapods.org/) / [Carthage](https://github.com/Carthage/Carthage) and should have a package name beginning with IBM.

Additional information is present in the [Common SDK Documentation](https://github.com/IBM/ibm-cloud-sdk-common).
Reference the Python client in your Python script 



 Reference the Python client that is installed by using pip 

You can reference the Python client by adding the following statement to your Python script:

from sdcclient import IbmAuthHelper, SdMonitorClient





 Reference the Python client that is installed by cloning a GitHub repo 

Add the following entries to your Python script to import the GitHub cloned package into your script:

import sys
sys.path.append("python-sdc-client")
from sdcclient import IbmAuthHelper, SdMonitorClient







 Step 3. Instantiate the Monitoring Python client 



 Option 1. Authenticate your user or service ID by using IAM 

To use IBM Cloud IAM authentication with the Python client, you must specify a Monitoring endpoint, an API key, and the GUID from your IBM Cloud Monitoring instance.

Complete the following steps from a terminal:



1. Get the GUID of your IBM Cloud Monitoring instance. Run the following command:

ibmcloud resource service-instance <NAME> --output json | jq -r '.[].guid'
2. Get the API key. Run the following command to generate a user API key:

ibmcloud iam api-key-create KEY_NAME
3. Get the endpoint for the region where the monitoring instance is available.

To see the list of endpoints that are available, see [Monitoring endpoints](https://cloud.ibm.com/docs/monitoring?topic=monitoring-endpointsendpoints_sysdig).

For example, the endpoint for an instance that is available in us-south is the following: https://us-south.monitoring.cloud.ibm.com
4. Add the following entries to your Python script:

from sdcclient import IbmAuthHelper, SdMonitorClient

URL = <MONITORING_ENDPOINT>
 For example: URL = 'https://us-south.monitoring.cloud.ibm.com'

APIKEY = <IAM_APIKEY>
Using the Python SDK 

The IBM Analytics Engine SDK can be installed by installing the library iaesdk from the Python Package Index.

Type the following command into a command line:

pip install --upgrade "iaesdk>=1.1.1"

Source code can be found at [GitHub](https://github.com/IBM/ibm-iae-python-sdk). The iaesdk library provides complete access to the IBM Analytics Engine API.

You need to provide the service endpoints and the API key when you create a IBM Analytics Engine service resource or a low-level client.

The service instance ID is also referred to as a instance GUID. You can retrieve the service instance ID when you create service credentials or through the CLI. See [Retrieving service endpoints](https://cloud.ibm.com/docs/AnalyticsEngine?topic=AnalyticsEngine-retrieve-endpoints-serverless).

To use the iaesdk library, you need the following values:



* IAM_API_KEY: The API key generated when creating the service credentials. You can retrieve by viewing the service credentials on the [IBM Cloud dashboard](https://cloud.ibm.com/resources).
* instance_guid: The value in resource_instance_id generated when the service credentials are created. You can retrieve by viewing the service credentials on the [IBM Cloud dashboard](https://cloud.ibm.com/resources).
* IAE_ENDPOINT_URL: The service endpoint URL including the https:// protocol. See [Service endpoints](https://cloud.ibm.com/apidocs/ibm-analytics-engineservice-endpoints).





 Code samples using iaesdk 

Getting started with the Python SDK after you have installed it, involves sourcing credentials to the IBM Analytics Engine service, invoking the service and then issuing different cluster commands as shown in the following sample code snippets. The code examples are written for Python 3.7.