Pinecone class accepts an optional param, openapi_config. When this is passed (usually as a vehicle for SSL configurations), it currently clobbers the api_key param so the user sees an error message about not providing an api_key (even though they did pass it) if they attempt to perform a control plane operation
from pinecone import Pinecone
from pinecone.core.client.configuration import Configuration as OpenApiConfiguration
openapi_config = OpenApiConfiguration()
openapi_config.ssl_ca_cert = '/path/to/cert'
pc = Pinecone(api_key='key, openapi_config=openapi_config)
pc.list_indexes() // error: No api-key provided
In a related issue, the openapi_config (with SSL configs) was not being correctly passed through to the underlying DataPlaneApi for data calls. So users with custom network configurations requiring SSL config would see SSL validation failures when attempting data operations.
from pinecone import Pinecone
from pinecone.core.client.configuration import Configuration as OpenApiConfiguration
openapi_config = OpenApiConfiguration()
openapi_config.ssl_ca_cert = '/path/to/cert'
pc = Pinecone(api_key='key, openapi_config=openapi_config)
pc.list_indexes() // error: No api-key provided
Solution
Adjust the ConfigBuilder to avoid clobbering API key
Move some logic into a util function so that behavior will be consistent across both data and control planes
Ensure configuration is passed to from the Pinecone object to the index client
deepcopy the openapi_config object before modifying it so that index-specific host changes do clobber control plane or calls to other indexes.
Future work
In the future, we should deprecate openapi_config and have some way of passing SSL config without all the baggage that comes with this OpenApiConfiguration object. This config object is an undocumented holdover from earlier versions of the client and breaks the abstraction the client is trying to provide to smooth out the UX of the generated SDK code.
Type of Change
[x] Bug fix (non-breaking change which fixes an issue)
Problem
A few different problems being solved here:
Pinecone
class accepts an optional param,openapi_config
. When this is passed (usually as a vehicle for SSL configurations), it currently clobbers theapi_key
param so the user sees an error message about not providing an api_key (even though they did pass it) if they attempt to perform a control plane operationopenapi_config
(with SSL configs) was not being correctly passed through to the underlyingDataPlaneApi
for data calls. So users with custom network configurations requiring SSL config would see SSL validation failures when attempting data operations.Solution
Pinecone
object to the index clientFuture work
openapi_config
and have some way of passing SSL config without all the baggage that comes with this OpenApiConfiguration object. This config object is an undocumented holdover from earlier versions of the client and breaks the abstraction the client is trying to provide to smooth out the UX of the generated SDK code.Type of Change
Test Plan