79227435

Date: 2024-11-26 16:06:15
Score: 1
Natty:
Report link

Save the Vectors

vectorstore = SKLearnVectorStore.from_documents(
        documents=doc_splits,
        persist_path=PERSIST_PATH,
        embedding=OllamaEmbeddings(model="Gemma-2:9b"),
        serializer="parquet",
    )

vectorstore.persist()

Load the Saved parquet file

vectorstore = SKLearnVectorStore(
            persist_path=PERSIST_PATH,
            embedding=OllamaEmbeddings(model="Gemma-2:9b"),
            serializer="parquet"
        )
docs = vectorstore.similarity_search(query)

*Note: PERSIST_PATH is the path where you would like to save the file and load it.

Refer: https://python.langchain.com/docs/integrations/vectorstores/sklearn/*

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: amit panda