fix: achieve parity between rag package and current impl (#3418)
Some checks failed
Notify Downstream / notify-downstream (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled

- 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:
Greyson LaLonde
2025-08-28 11:22:36 -04:00
committed by GitHub
parent 0f1b764c3e
commit ec1eff02a8
9 changed files with 186 additions and 78 deletions

View File

@@ -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"}],