Find answers from the community

Updated 3 months ago

```

Plain Text
vector_store = SupabaseVectorStore(
    postgres_connection_string=connectionString,
    collection_name="llama_demo",
)


storage_context = StorageContext.from_defaults(vector_store=vector_store)


index = VectorStoreIndex.from_documents(documents, storage_context=storage_context)


filters = MetadataFilters(filters=[ExactMatchFilter(key="workspaceId", value="25juldeplo482af4cd83")])


retriever = index.as_retriever(filters=filters)
ans = retriever.retrieve("query?")


issue = i dont have access to index after intial creation of documents
W
k
11 comments
You can try the following.

Plain Text
vector_store = SupabaseVectorStore(
    postgres_connection_string=connectionString,
    collection_name="llama_demo",
)


# for second iteration when you have already created the indexes in the first run
index = VectorStoreIndex.from_vector_store(vector_store=vector_store)
Bonus Tip: You can also define service context globally so you do not have to add it everywhere.
thanks @WhiteFang_Jr
but gttign this error
Plain Text
ge='OpenAI API response' path=https://api.openai.com/v1/embeddings processing_ms=80 request_id=12405e2561e906cf281aefb36c97809f response_code=200
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/vecs/collection.py:182: UserWarning: Query does not have a covering index for IndexMeasure.cosine_distance. See Collection.create_index
  warnings.warn(
DEBUG:llama_index.indices.utils:> Top 0 nodes:
hey can you check with the updated code once
ok i think there is a filtering issue on my side
i will updae
it works thanks
but i am getting error trying to yuse sub query engine: llama_index.output_parsers.base.OutputParserException: Got invalid return object. Expected markdown code snippet with JSON object, but got: [
{
"sub_question": "What is the ...",
"tool_name": "vector index"
}
]
Add a reply
Sign up and join the conversation on Discord