Cant provide proxy setting

@clyde.hunter1984 post hints how to do this.

Here is the full code.

from pinecone import Pinecone
from langchain_openai import OpenAIEmbeddings
from langchain_pinecone import PineconeVectorStore

embeddings = OpenAIEmbeddings()

pc = Pinecone(api_key='XXXXXX',
              proxy_url='http://127.0.0.1:8080',
              ssl_ca_certs='~/.mitmproxy/mitmproxy-ca.pem')

index = pc.Index('test')

vectorstore = PineconeVectorStore(index=index, embedding=embeddings)
vectorstore.add_texts(['hello pinecone index'])

The key point is that the index argument will take a Pinecone Index object and index_name takes a string, then connects to the Pinecone Index for you.

So, if you ever need to use an argument that is only in the Pinecone client, you can use the approach above.

Please ensure you are using the latest version of both LangChain and the pinecone-client, as the code snippet earlier had a mix of old and new function calls.

1 Like