Using Pinecone with Langchain

Does anyone have an actual working example of Pinecone being used as part of a Langchain agent tool set? Python preferred although I’ll take whatever I can get. (I attempted this in JavaScript to start with and quickly realised the folly of my ways)

I find many examples of using langchain wrappers to add documents to Pinecone, or search for documents in Pinecone, but I don’t see any working code for the more obvious “Add Pinecone as a tool for agents to use when searching for relevant knowlegde”

i.e. using Pinecone in the way that one uses SerpAPI, or Wikipedia. As a tool for an agent.

I have a Pinecone index populated with vectors, each of which represents a chunk of knowledge from a different system. Each vector has the metadata property ‘text’ set to the full text of the knowledge entry.

The best I can manage is to get Langchain to attempt to do a vector query on Pinecone but either it barfs with “…unable to parse LLM output {text}” or it hangs. Yes, it hangs while inside the Pinecone action.

Does anyone have a working code example? I will surely share one myself if I ever get it working!

Failing this, does anyone know how to debug the python source for langchain wrappers, specifically the Pinecone wrappers?

Hey, yes we have an example notebook on that here and a video walkthrough too — I hope that helps :slight_smile:

I’ve run this for several instances on Pinecone. It’s been working great.