Skip to content

Conversation

@nb-programmer
Copy link
Contributor

@nb-programmer nb-programmer commented Jul 3, 2023

Change details:

  • Description: When calling db.persist(), a check prevents from it proceeding as the constructor only sets member _persist_directory from parameters. But the ChromaDB client settings also has this parameter, and if the client_settings parameter is used without passing the persist_directory (which is optional), the persist method raises ValueError for not setting _persist_directory. This change fixes it by setting the member _persist_directory variable from client_settings if it is set, else uses the constructor parameter.
  • Issue: I didn't find any github issue of this, but I discovered it after calling the persist method
  • Dependencies: None
  • Tag maintainer: vectorstore related change - @rlancemartin, @eyurtsev
  • Twitter handle: Don't have one :(

Additional discussion: We may need to discuss the way I implemented the fallback using or.

@vercel
Copy link

vercel bot commented Jul 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 4:16pm

@dosubot dosubot bot added the bug Related to a bug, vulnerability, unexpected error with an existing feature label Jul 3, 2023
@vercel vercel bot temporarily deployed to Preview July 3, 2023 15:55 Inactive
@vercel vercel bot temporarily deployed to Preview July 7, 2023 16:16 Inactive
@rlancemartin rlancemartin merged commit a2830e3 into langchain-ai:master Jul 7, 2023
@Buckler89
Copy link
Contributor

@nb-programmer Now the constructor breaks if you pass the "client" parameter because in this case, the "self._persist_directory" attribute is not initialized during initialization. In fact it gives me
File .... python3.10/site-packages/langchain/vectorstores/chroma.py", line 94, in __init__ self._client_settings.persist_directory or persist_directory AttributeError: 'Chroma' object has no attribute '_client_settings'

Can you fix this?

This is how i initialize my vectorestore:

        chroma_vs = Chroma(
        collection_name=collection_name,
        embedding_function=embedding_llm,
        client_settings=self.vector_store_client_setting,
        persist_directory=self.vector_store_path,
        client=self.chromadb_client,
        collection_metadata={"hnsw:space": "cosine"}
    )

@nb-programmer
Copy link
Contributor Author

Okay I should have checked for that case. #7482 was made, is the same issue I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Related to a bug, vulnerability, unexpected error with an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants