-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chroma[patch]: add
get_by_ids
and fix bug (#28516)
- Run standard integration tests in Chroma - Add `get_by_ids` method - Fix bug in `add_texts`: if a list of `ids` is passed but any of them are None, Chroma will raise an exception. Here we assign a uuid.
- Loading branch information
Showing
4 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
libs/partners/chroma/tests/integration_tests/test_standard.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from typing import AsyncGenerator, Generator | ||
|
||
import pytest | ||
from langchain_core.embeddings.fake import DeterministicFakeEmbedding | ||
from langchain_core.vectorstores import VectorStore | ||
from langchain_tests.integration_tests.vectorstores import ( | ||
AsyncReadWriteTestSuite, | ||
ReadWriteTestSuite, | ||
) | ||
|
||
from langchain_chroma import Chroma | ||
|
||
|
||
class TestSync(ReadWriteTestSuite): | ||
@pytest.fixture() | ||
def vectorstore(self) -> Generator[VectorStore, None, None]: # type: ignore | ||
"""Get an empty vectorstore for unit tests.""" | ||
embeddings = DeterministicFakeEmbedding(size=10) | ||
store = Chroma(embedding_function=embeddings) | ||
try: | ||
yield store | ||
finally: | ||
store.delete_collection() | ||
pass | ||
|
||
|
||
class TestAsync(AsyncReadWriteTestSuite): | ||
@pytest.fixture() | ||
async def vectorstore(self) -> AsyncGenerator[VectorStore, None]: # type: ignore | ||
"""Get an empty vectorstore for unit tests.""" | ||
embeddings = DeterministicFakeEmbedding(size=10) | ||
store = Chroma(embedding_function=embeddings) | ||
try: | ||
yield store | ||
finally: | ||
store.delete_collection() | ||
pass |