test_chroma_search_filter_with_scores() — langchain Function Reference
Architecture documentation for the test_chroma_search_filter_with_scores() function in test_vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 96a83051_075b_15b9_cfd3_b26e76e136e1["test_chroma_search_filter_with_scores()"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8["test_vectorstores.py"] 96a83051_075b_15b9_cfd3_b26e76e136e1 -->|defined in| 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 style 96a83051_075b_15b9_cfd3_b26e76e136e1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/chroma/tests/integration_tests/test_vectorstores.py lines 251–279
def test_chroma_search_filter_with_scores() -> None:
"""Test end to end construction and scored search with metadata filtering."""
texts = ["far", "bar", "baz"]
metadatas = [{"first_letter": f"{text[0]}"} for text in texts]
ids = [f"id_{i}" for i in range(len(texts))]
docsearch = Chroma.from_texts(
collection_name="test_collection",
texts=texts,
embedding=FakeEmbeddings(),
metadatas=metadatas,
ids=ids,
)
output1 = docsearch.similarity_search_with_score(
"far",
k=1,
filter={"first_letter": "f"},
)
output2 = docsearch.similarity_search_with_score(
"far",
k=1,
filter={"first_letter": "b"},
)
docsearch.delete_collection()
assert output1 == [
(Document(page_content="far", metadata={"first_letter": "f"}, id="id_0"), 0.0),
]
assert output2 == [
(Document(page_content="bar", metadata={"first_letter": "b"}, id="id_1"), 1.0),
]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_chroma_search_filter_with_scores() do?
test_chroma_search_filter_with_scores() is a function in the langchain codebase, defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py.
Where is test_chroma_search_filter_with_scores() defined?
test_chroma_search_filter_with_scores() is defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py at line 251.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free