mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-08 20:41:52 +00:00
community[patch]: Revert " Fix the bug that Chroma does not specify `e… (#19866)
…mbedding_function` (#19277)"
This reverts commit 7042934b5f
.
Fixes #19848
This commit is contained in:
parent
f06229bbf1
commit
d62e84c4f5
@ -28,7 +28,6 @@ if TYPE_CHECKING:
|
|||||||
import chromadb.config
|
import chromadb.config
|
||||||
from chromadb.api.types import ID, OneOrMany, Where, WhereDocument
|
from chromadb.api.types import ID, OneOrMany, Where, WhereDocument
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
DEFAULT_K = 4 # Number of Documents to return.
|
DEFAULT_K = 4 # Number of Documents to return.
|
||||||
|
|
||||||
@ -81,7 +80,6 @@ class Chroma(VectorStore):
|
|||||||
try:
|
try:
|
||||||
import chromadb
|
import chromadb
|
||||||
import chromadb.config
|
import chromadb.config
|
||||||
from chromadb.utils import embedding_functions
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Could not import chromadb python package. "
|
"Could not import chromadb python package. "
|
||||||
@ -124,12 +122,10 @@ class Chroma(VectorStore):
|
|||||||
_client_settings.persist_directory or persist_directory
|
_client_settings.persist_directory or persist_directory
|
||||||
)
|
)
|
||||||
|
|
||||||
self._embedding_function = (
|
self._embedding_function = embedding_function
|
||||||
embedding_function or embedding_functions.DefaultEmbeddingFunction()
|
|
||||||
)
|
|
||||||
self._collection = self._client.get_or_create_collection(
|
self._collection = self._client.get_or_create_collection(
|
||||||
name=collection_name,
|
name=collection_name,
|
||||||
embedding_function=self._embedding_function,
|
embedding_function=None,
|
||||||
metadata=collection_metadata,
|
metadata=collection_metadata,
|
||||||
)
|
)
|
||||||
self.override_relevance_score_fn = relevance_score_fn
|
self.override_relevance_score_fn = relevance_score_fn
|
||||||
|
Loading…
Reference in New Issue
Block a user