mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
fix: achieve parity between rag package and current impl (#3418)
- Sanitize ChromaDB collection names and use original dir naming - Add persistent client with file locking to the ChromaDB factory - Add upsert support to the ChromaDB client - Suppress ChromaDB deprecation warnings for `model_fields` - Extract `suppress_logging` into shared `logger_utils` - Update tests to reflect upsert behavior - Docs: add additional note
This commit is contained in:
@@ -253,8 +253,8 @@ class TestChromaDBClient:
|
||||
)
|
||||
|
||||
# Verify documents were added to collection
|
||||
mock_collection.add.assert_called_once()
|
||||
call_args = mock_collection.add.call_args
|
||||
mock_collection.upsert.assert_called_once()
|
||||
call_args = mock_collection.upsert.call_args
|
||||
assert len(call_args.kwargs["ids"]) == 1
|
||||
assert call_args.kwargs["documents"] == ["Test document"]
|
||||
assert call_args.kwargs["metadatas"] == [{"source": "test"}]
|
||||
@@ -279,7 +279,7 @@ class TestChromaDBClient:
|
||||
|
||||
client.add_documents(collection_name="test_collection", documents=documents)
|
||||
|
||||
mock_collection.add.assert_called_once_with(
|
||||
mock_collection.upsert.assert_called_once_with(
|
||||
ids=["custom_id_1", "custom_id_2"],
|
||||
documents=["First document", "Second document"],
|
||||
metadatas=[{"source": "test1"}, {"source": "test2"}],
|
||||
@@ -319,8 +319,8 @@ class TestChromaDBClient:
|
||||
)
|
||||
|
||||
# Verify documents were added to collection
|
||||
mock_collection.add.assert_called_once()
|
||||
call_args = mock_collection.add.call_args
|
||||
mock_collection.upsert.assert_called_once()
|
||||
call_args = mock_collection.upsert.call_args
|
||||
assert len(call_args.kwargs["ids"]) == 1
|
||||
assert call_args.kwargs["documents"] == ["Test document"]
|
||||
assert call_args.kwargs["metadatas"] == [{"source": "test"}]
|
||||
@@ -352,7 +352,7 @@ class TestChromaDBClient:
|
||||
collection_name="test_collection", documents=documents
|
||||
)
|
||||
|
||||
mock_collection.add.assert_called_once_with(
|
||||
mock_collection.upsert.assert_called_once_with(
|
||||
ids=["custom_id_1", "custom_id_2"],
|
||||
documents=["First document", "Second document"],
|
||||
metadatas=[{"source": "test1"}, {"source": "test2"}],
|
||||
|
||||
Reference in New Issue
Block a user