Skip to content

Release v3.2.0

Compare
Choose a tag to compare
@jhamon jhamon released this 21 Mar 22:58
· 53 commits to main since this release

Feature: Proxy Configuration

In #321 and #325 we implemented four new optional configuration properties that are relevant for users who need to work with proxies:

  • proxy_url: The location of your proxy. This could be an http or https url depending on your proxy setup.
  • proxy_headers: This param accepts a dictionary which can be used to pass any custom headers required by your proxy. If your proxy is protected by authentication, this is how you can pass basic auth headers with a digest of your username and password.
  • ssl_ca_certs: By default the client will perform SSL certificate verification using the CA bundle maintained by Mozilla in the certifi package. If your proxy is using self-signed certs, use this param to specify the path to the certificate (PEM format) we should use to verify your requests.
  • ssl_verify: SSL verification is enabled by default, but it can be disabled to aid in troubleshooting.
from pinecone import Pinecone
import urllib3 import make_headers

pc = Pinecone(
    api_key="YOUR_API_KEY",
    proxy_url='https://your-proxy.com',
    proxy_headers=make_headers(proxy_basic_auth='username:password'),
    ssl_ca_certs='path/to/cert-bundle.pem'
)

pc.list_indexes()

Migration from pre-3.0 clients

In older versions of the client you may have passed in proxy configuration to the client like this:

import pinecone
from pinecone.core.client.configuration import OpenApiConfiguration

config = OpenApiConfiguration()
config.ssl_ca_cert = 'path/to/cert-bundle.pem'
config.proxy_headers = make_headers(proxy_basic_auth='username:password')
config.proxy_url = 'https://your-proxy.com'

pinecone.init(
    api_key='your-key',
    environment='us-east1-gcp',
    openapi_config=config
)

If you've tried to pass this openapi_config param into the Pinecone() constructor in the >=3.0 versions of the client, you've run into cryptic bugs telling you your API key is not set (even though it is). We believe we've fixed those bugs in this release, but we strongly encourage you to adopt the new parameters described above. We've decided to move away from having this OpenApiConfiguration as part of our public interface because the object comes from an OpenAPI code generator and has a very large footprint which makes it a challenge from a documentation and testing perspective.

If you were passing configuration through this object for anything not covered by the above four properties, please reach out to let us know and we'll figure out how to handle those configurations going forward.

from pinecone import Pinecone
from pinecone.core.client.configuration import OpenApiConfiguration
import urllib3 import make_headers

config = OpenApiConfiguration()
config.ssl_ca_cert = 'path/to/cert-bundle.pem'
config.proxy_headers = make_headers(proxy_basic_auth='username:password')
config.proxy_url = 'https://your-proxy.com'

pc = Pinecone(
    api_key="YOUR_API_KEY",
    openapi_config=config
) # this works but emits a deprecation notice

Testing

Testing of this feature was done with the help of mitmproxy. You may find it useful to have a look at the tests while troubleshooting your own configuration.

New Contributors

Full Changelog: v3.1.0...v3.2.0