Python SDK
There are two versions of the Python SDK:
pinecone[gRPC]
: Relies on gRPC for data operations and is more performant thanpinecone
.pinecone
: Has a minimal set of dependencies and interacts with Pinecone via HTTP requests.
See the Pinecone Python SDK documentation for full installation instructions, usage examples, and reference information.
Install
To install the latest version of the Python SDK, run the following command:
To install a specific version of the Python SDK, run the following command:
To check your SDK version, run the following command:
To use the Inference API, you must be on version 5.0.0 or later.
Install the Pinecone Assistant Python plugin
To interact with Pinecone Assistant using the Python SDK, upgrade the client and install the pinecone-plugin-assistant
package as follows:
Upgrade
If you already have the Python SDK, upgrade to the latest version as follows:
Initialize
Once installed, you can import the library and then use an API key to initialize a client instance:
When creating an index, import the ServerlessSpec
or PodSpec
class as well:
Proxy configuration
If your network setup requires you to interact with Pinecone through a proxy, you will need to pass additional configuration using optional keyword parameters:
proxy_url
: The location of your proxy. This could be an HTTP or HTTPS URL depending on your proxy setup.proxy_headers
: Accepts a python dictionary which can be used to pass any custom headers required by your proxy. If your proxy is protected by authentication, use this parameter to pass basic authentication headers with a digest of your username and password. Themake_headers
utility fromurllib3
can be used to help construct the dictionary.ssl_ca_certs
: By default, the client will perform SSL certificate verification using the CA bundle maintained by Mozilla in thecertifi
package. If your proxy is using self-signed certicates, use this parameter to specify the path to the certificate (PEM format).ssl_verify
: SSL verification is enabled by default, but it is disabled when set toFalse
. It is not recommened to go into production with SSL verification disabled.
Was this page helpful?