Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Refactor ChromadbRM constructor to use collection's default embedding function

Stephen Witkowski85368cee8dad
diff --git a/dspy/retrieve/chromadb_rm.py b/dspy/retrieve/chromadb_rm.py
index aa4398bb3..1338d48d5 100644
--- a/dspy/retrieve/chromadb_rm.py
+++ b/dspy/retrieve/chromadb_rm.py
@@ -70,12 +70,11 @@ class ChromadbRM(dspy.Retrieve):
persist_directory: str,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
- ] = ef.DefaultEmbeddingFunction(),
+ ] = None,
k: int = 7,
):
self._init_chromadb(collection_name, persist_directory)
-
- self.ef = embedding_function
+ self.ef = embedding_function or self._chromadb_collection.embedding_function
super().__init__(k=k)