Find answers from the community

Updated 2 months ago

L9ad

Hi there! I am trying to load data that have been persisted to disk, like so:
index.storage_context.persist(persist_dir="<persist_dir>")

The index has been built using the embedding model from Cohere, as detailed in the documentation.

embed_model = CohereEmbedding( cohere_api_key=COHERE_API_KEY, model_name="embed-english-v3.0", input_type="search_document", embedding_type="float")

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

The vector store index (in-memory) is working; however, I am unable to load the data and re-create the storage context using
storage_context = StorageContext.from_defaults(persist_dir

Would anybody be able to help with the configuration for Cohere? I understand that I can then load the indexusing the following fucntion:
index = load_index_from_storage(storage_context)
Many thanks!
L
L
2 comments
Why are you unable to load?

In any case, you should probably pass the embedding model back in

load_index_from_storage(storage_context, embed_model=embed_model)
Thanks Logan! It works now. I was previously unable to load because the load_index_from_storage() function was calling the OpenAI API instead of the CohereEmbedding. Passing in the additional embed_model argument made the difference.
Add a reply
Sign up and join the conversation on Discord