dspy icon indicating copy to clipboard operation
dspy copied to clipboard

fix: default collection embedding function attribute in ChromadbRM constructor

Open ragul-kachiappan opened this issue 11 months ago • 2 comments

The recent PR #449 opened by @smwitkowski refactored ChromadbRM constructor to use collection default embedding function with the syntax "self._chromadb_collection.embedding_function". But ChromaDB collection object has no such attribute and raises attribute error if no embedding function is passed to the constructor.

This PR modifies the constructor to use Chromadb collection's protected attribute "self._chromadb_collection._embedding_function" and the module now works as expected.

I could be wrong in my assumptions as I am relatively new to dspy and am open to possible better resolution.

ragul-kachiappan avatar Feb 27 '24 10:02 ragul-kachiappan

You're correct, @ragul-kachiappan; I made a typo, so this would throw an error.

Plus, if a collection is being read in from disk then _embedding_function is unavailable and the default embedding model.

I'd recommend rolling back to the version introduced in #400.

@ragul-kachiappan since you've already opened the PR, could you make this change?

smwitkowski avatar Feb 29 '24 02:02 smwitkowski

As per your suggestion, @smwitkowski , I have made the rollback to use generic embedding function introduced in #400.

ragul-kachiappan avatar Feb 29 '24 08:02 ragul-kachiappan

Thanks @ragul-kachiappan @smwitkowski !

arnavsinghvi11 avatar Mar 09 '24 18:03 arnavsinghvi11