from llama_index.vector_stores import PineconeVectorStore from llama_index.storage.storage_context import StorageContext #"Insert"ing vector_store = PineconeVectorStore( pinecone_index=index, add_sparse_vector=True, ) storage_context = StorageContext.from_defaults(vector_store=vector_store) index = pinecone.Index("dobby-springworks-be-dev") pcv_index = GPTVectorStoreIndex.from_documents(documents,pinecone_index=index, metadata_filters ={'doc_name': 'Handbook', 'admin_name': 'Siddhant', 'user_name': 'Siddhant'}, namespace='temp') # for doc_chunk in documents: # pcv_index.insert(doc_chunk) print(index.describe_index_stats())
#query index = pinecone.Index("dobby-springworks-be-dev") vector_store = PineconeVectorStore( pinecone_index=index, add_sparse_vector=True, ) storage_context = StorageContext.from_defaults(vector_store=vector_store) index = GPTVectorStoreIndex.from_documents([],pinecone_index=index, metadata_filters ={'doc_name': 'Handbook', 'admin_name': 'Siddhant', 'user_name': 'Siddhant'}, namespace='temp') # pc_index = index.as_query_engine(vector_store_query_mode="hybrid") does not work pc_index = index.as_query_engine() response = pc_index.query("Tell me about leave policy?") print(response)
from llama_index.vector_stores import PineconeVectorStore from llama_index.storage.storage_context import StorageContext #inserting vector_store = PineconeVectorStore( pinecone_index=index ) storage_context = StorageContext.from_defaults(vector_store=vector_store) index = pinecone.Index("dobby-springworks-be-dev") # index = GPTVectorStoreIndex.from_documents(documents, storage_context=storage_context) pcv_index = GPTVectorStoreIndex.from_documents(documents,pinecone_index=index, metadata_filters ={'doc_name': 'Handbook', 'admin_name': 'Siddhant', 'user_name': 'Siddhant'}, namespace='temp', storage_context=storage_context) # for doc_chunk in documents: # pcv_index.insert(doc_chunk) print(index.describe_index_stats())