test_vectorstores.py — langchain Source File
Architecture documentation for test_vectorstores.py, a python file in the langchain codebase. 14 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8["test_vectorstores.py"] fae55357_8e00_f092_b2c8_957d1841a180["tempfile"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> fae55357_8e00_f092_b2c8_957d1841a180 02f66451_d2a9_e7c3_9765_c3a7594721ad["uuid"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 02f66451_d2a9_e7c3_9765_c3a7594721ad 927570d8_11a6_5c17_0f0d_80baae0c733e["pathlib"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 927570d8_11a6_5c17_0f0d_80baae0c733e feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> feec1ec4_6917_867b_d228_b134d0ff8099 f0314204_17df_91a6_320f_0d512d5a2a44["chromadb"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> f0314204_17df_91a6_320f_0d512d5a2a44 f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba a83cf0c6_37ab_ef90_8783_e7ae0273a0a0["requests"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> a83cf0c6_37ab_ef90_8783_e7ae0273a0a0 7571de65_8b4d_1095_3ecd_57f062339cb6["chromadb.api.client"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 7571de65_8b4d_1095_3ecd_57f062339cb6 0cb4a3fc_e1b9_c4d7_fe3e_9f0d593f2c1c["chromadb.api.rust"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 0cb4a3fc_e1b9_c4d7_fe3e_9f0d593f2c1c 848d3367_819f_2332_d7f6_12f01e46c135["chromadb.api.types"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 848d3367_819f_2332_d7f6_12f01e46c135 6a98b0a5_5607_0043_2e22_a46a464c2d62["langchain_core.documents"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 6a98b0a5_5607_0043_2e22_a46a464c2d62 3f73953f_71af_633b_896c_061915a37f5c["langchain_core.embeddings.fake"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> 3f73953f_71af_633b_896c_061915a37f5c be87fc1b_1fa0_af61_832d_6bf58b2a2643["langchain_chroma.vectorstores"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> be87fc1b_1fa0_af61_832d_6bf58b2a2643 c6374418_bb39_3340_5ef6_844e0ad7041b["tests.integration_tests.fake_embeddings"] 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 --> c6374418_bb39_3340_5ef6_844e0ad7041b style 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Test Chroma functionality."""
import tempfile
import uuid
from pathlib import Path
from typing import (
cast,
)
import chromadb
import pytest # type: ignore[import-not-found]
import requests
from chromadb.api.client import SharedSystemClient
from chromadb.api.rust import RustBindingsAPI
from chromadb.api.types import Embeddable
from langchain_core.documents import Document
from langchain_core.embeddings.fake import FakeEmbeddings as Fak
from langchain_chroma.vectorstores import Chroma
from tests.integration_tests.fake_embeddings import (
ConsistentFakeEmbeddings,
FakeEmbeddings,
)
class MyEmbeddingFunction:
def __init__(self, fak: Fak):
self.fak = fak
def __call__(self, input_: Embeddable) -> list[list[float]]:
texts = cast("list[str]", input_)
return self.fak.embed_documents(texts=texts)
@pytest.fixture
def client() -> chromadb.ClientAPI:
SharedSystemClient.clear_system_cache()
return chromadb.Client(chromadb.config.Settings())
def test_chroma() -> None:
"""Test end to end construction and search."""
texts = ["foo", "bar", "baz"]
docsearch = Chroma.from_texts(
collection_name="test_collection",
texts=texts,
embedding=FakeEmbeddings(),
)
output = docsearch.similarity_search("foo", k=1)
docsearch.delete_collection()
assert len(output) == 1
assert output[0].page_content == "foo"
assert output[0].id is not None
def test_from_documents() -> None:
"""Test init using .from_documents."""
documents = [
Document(page_content="foo"),
// ... (812 more lines)
Domain
Subdomains
Functions
- batch_support_chroma_version()
- client()
- is_api_accessible()
- test_chroma()
- test_chroma_add_documents_mixed_metadata()
- test_chroma_add_documents_no_metadata()
- test_chroma_async()
- test_chroma_async_with_ids()
- test_chroma_handles_none_page_content()
- test_chroma_handles_none_page_content_with_vectors()
- test_chroma_large_batch()
- test_chroma_large_batch_update()
- test_chroma_legacy_batching()
- test_chroma_mmr()
- test_chroma_mmr_by_vector()
- test_chroma_search_filter()
- test_chroma_search_filter_with_scores()
- test_chroma_update_document()
- test_chroma_update_document_with_id()
- test_chroma_with_ids()
- test_chroma_with_include_parameter()
- test_chroma_with_metadatas()
- test_chroma_with_metadatas_and_ids()
- test_chroma_with_metadatas_with_scores_and_ids()
- test_chroma_with_metadatas_with_scores_using_vector()
- test_chroma_with_metadatas_with_vectors()
- test_chroma_with_persistence()
- test_chroma_with_persistence_with_client_settings()
- test_chroma_with_relevance_score_custom_normalization_fn()
- test_collection_none_after_delete()
- test_create_collection_if_not_exist_default()
- test_create_collection_if_not_exist_false_existing()
- test_create_collection_if_not_exist_false_non_existing()
- test_create_collection_if_not_exist_true_existing()
- test_create_collection_if_not_exist_true_non_existing()
- test_delete_where_clause()
- test_from_documents()
- test_init_from_client()
- test_init_from_client_settings()
- test_reset_collection()
Classes
Dependencies
- chromadb
- chromadb.api.client
- chromadb.api.rust
- chromadb.api.types
- langchain_chroma.vectorstores
- langchain_core.documents
- langchain_core.embeddings.fake
- pathlib
- pytest
- requests
- tempfile
- tests.integration_tests.fake_embeddings
- typing
- uuid
Source
Frequently Asked Questions
What does test_vectorstores.py do?
test_vectorstores.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, Runnables subdomain.
What functions are defined in test_vectorstores.py?
test_vectorstores.py defines 40 function(s): batch_support_chroma_version, client, is_api_accessible, test_chroma, test_chroma_add_documents_mixed_metadata, test_chroma_add_documents_no_metadata, test_chroma_async, test_chroma_async_with_ids, test_chroma_handles_none_page_content, test_chroma_handles_none_page_content_with_vectors, and 30 more.
What does test_vectorstores.py depend on?
test_vectorstores.py imports 14 module(s): chromadb, chromadb.api.client, chromadb.api.rust, chromadb.api.types, langchain_chroma.vectorstores, langchain_core.documents, langchain_core.embeddings.fake, pathlib, and 6 more.
Where is test_vectorstores.py in the architecture?
test_vectorstores.py is located at libs/partners/chroma/tests/integration_tests/test_vectorstores.py (domain: LangChainCore, subdomain: Runnables, directory: libs/partners/chroma/tests/integration_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free