Home / File/ test_deterministic_embedding.py — langchain Source File

test_deterministic_embedding.py — langchain Source File

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

Entity Profile

Dependency Diagram

graph LR
  f603b94b_35f5_7c4f_5b61_f81425ae6f71["test_deterministic_embedding.py"]
  bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3["langchain_core.embeddings"]
  f603b94b_35f5_7c4f_5b61_f81425ae6f71 --> bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3
  style f603b94b_35f5_7c4f_5b61_f81425ae6f71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.embeddings import DeterministicFakeEmbedding


def test_deterministic_fake_embeddings() -> None:
    """Test that DeterministicFakeEmbedding is deterministic.

    Test that the deterministic fake embeddings return the same
    embedding vector for the same text.
    """
    fake = DeterministicFakeEmbedding(size=10)
    text = "Hello world!"
    assert fake.embed_query(text) == fake.embed_query(text)
    assert fake.embed_query(text) != fake.embed_query("Goodbye world!")
    assert fake.embed_documents([text, text]) == fake.embed_documents([text, text])
    assert fake.embed_documents([text, text]) != fake.embed_documents(
        [
            text,
            "Goodbye world!",
        ]
    )

Subdomains

Dependencies

  • langchain_core.embeddings

Frequently Asked Questions

What does test_deterministic_embedding.py do?
test_deterministic_embedding.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_deterministic_embedding.py?
test_deterministic_embedding.py defines 1 function(s): test_deterministic_fake_embeddings.
What does test_deterministic_embedding.py depend on?
test_deterministic_embedding.py imports 1 module(s): langchain_core.embeddings.
Where is test_deterministic_embedding.py in the architecture?
test_deterministic_embedding.py is located at libs/core/tests/unit_tests/embeddings/test_deterministic_embedding.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests/embeddings).

Analyze Your Own Codebase

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

Try Supermodel Free