Find answers from the community

s
F
Y
a
P
Updated 2 years ago

```# can define filters specific to this vector index (so you can# reuse pinecone indexes

@kapa.ai
Plain Text
# can define filters specific to this vector index (so you can
# reuse pinecone indexes)
metadata_filters = {"title": "paul_graham_essay"}

How does this step work when querying on GPTPineconeIndex
k
2 comments
Please stand by @JW as I search the knowledge base. We are experiencing especially high traffic right now and might take longer than usual. :wave:
----------------------
The metadata_filters parameter is used to define filters specific to the vector index when building the GPTPineconeIndex. In the given example, the filter is set to only include documents with the title "paul_graham_essay". This allows you to reuse Pinecone indexes with different metadata filters for different subsets of documents.

Here's the relevant code snippet from the information extracts:

Plain Text
metadata_filters = {"title": "paul_graham_essay"}

# Load documents, build the GPTPineconeIndex
documents = SimpleDirectoryReader('../paul_graham_essay/data').load_data()
index = GPTPineconeIndex.from_documents(
    documents, pinecone_index=index, metadata_filters=metadata_filters
)

# Query index
response = index.query("What did the author do growing up?")


In this example, when querying the GPTPineconeIndex, it will only consider documents that match the specified metadata filter (i.e., documents with the title "paul_graham_essay").
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord