Home / File/ test_vectorstores.py — langchain Source File

test_vectorstores.py — langchain Source File

Architecture documentation for test_vectorstores.py, a python file in the langchain codebase. 2 imports, 0 dependents.

File python LangChainCore ApiManagement 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  1e8a5ebb_88eb_33d3_2eef_6d4dfedf6943["test_vectorstores.py"]
  3f73953f_71af_633b_896c_061915a37f5c["langchain_core.embeddings.fake"]
  1e8a5ebb_88eb_33d3_2eef_6d4dfedf6943 --> 3f73953f_71af_633b_896c_061915a37f5c
  be87fc1b_1fa0_af61_832d_6bf58b2a2643["langchain_chroma.vectorstores"]
  1e8a5ebb_88eb_33d3_2eef_6d4dfedf6943 --> be87fc1b_1fa0_af61_832d_6bf58b2a2643
  style 1e8a5ebb_88eb_33d3_2eef_6d4dfedf6943 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.embeddings.fake import (
    FakeEmbeddings,
)

from langchain_chroma.vectorstores import Chroma


def test_initialization() -> None:
    """Test integration vectorstore initialization."""
    texts = ["foo", "bar", "baz"]
    Chroma.from_texts(
        collection_name="test_collection",
        texts=texts,
        embedding=FakeEmbeddings(size=10),
    )


def test_similarity_search() -> None:
    """Test similarity search by Chroma."""
    texts = ["foo", "bar", "baz"]
    metadatas = [{"page": str(i)} for i in range(len(texts))]
    docsearch = Chroma.from_texts(
        collection_name="test_collection",
        texts=texts,
        embedding=FakeEmbeddings(size=10),
        metadatas=metadatas,
    )
    output = docsearch.similarity_search("foo", k=1)
    docsearch.delete_collection()
    assert len(output) == 1

Domain

Subdomains

Dependencies

  • langchain_chroma.vectorstores
  • langchain_core.embeddings.fake

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, ApiManagement subdomain.
What functions are defined in test_vectorstores.py?
test_vectorstores.py defines 2 function(s): test_initialization, test_similarity_search.
What does test_vectorstores.py depend on?
test_vectorstores.py imports 2 module(s): langchain_chroma.vectorstores, langchain_core.embeddings.fake.
Where is test_vectorstores.py in the architecture?
test_vectorstores.py is located at libs/partners/chroma/tests/unit_tests/test_vectorstores.py (domain: LangChainCore, subdomain: ApiManagement, directory: libs/partners/chroma/tests/unit_tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free