Home / Function/ test_from_documents() — langchain Function Reference

test_from_documents() — langchain Function Reference

Architecture documentation for the test_from_documents() function in test_vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b62f4bbe_14fd_12fd_3377_49794cf85231["test_from_documents()"]
  289e5a4f_8e2e_ddb6_af2e_804f91dabdb8["test_vectorstores.py"]
  b62f4bbe_14fd_12fd_3377_49794cf85231 -->|defined in| 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8
  style b62f4bbe_14fd_12fd_3377_49794cf85231 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/chroma/tests/integration_tests/test_vectorstores.py lines 57–70

def test_from_documents() -> None:
    """Test init using .from_documents."""
    documents = [
        Document(page_content="foo"),
        Document(page_content="bar"),
        Document(page_content="baz"),
    ]
    docsearch = Chroma.from_documents(documents=documents, 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

Domain

Subdomains

Frequently Asked Questions

What does test_from_documents() do?
test_from_documents() is a function in the langchain codebase, defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py.
Where is test_from_documents() defined?
test_from_documents() is defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py at line 57.

Analyze Your Own Codebase

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

Try Supermodel Free