Home / Function/ test_qdrant_from_texts_raises_error_on_different_distance() — langchain Function Reference

test_qdrant_from_texts_raises_error_on_different_distance() — langchain Function Reference

Architecture documentation for the test_qdrant_from_texts_raises_error_on_different_distance() function in test_from_texts.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f9ddc450_8f90_500e_0937_51e788ae1912["test_qdrant_from_texts_raises_error_on_different_distance()"]
  911ffb0f_3570_ae90_9ff9_2c9c03151aea["test_from_texts.py"]
  f9ddc450_8f90_500e_0937_51e788ae1912 -->|defined in| 911ffb0f_3570_ae90_9ff9_2c9c03151aea
  style f9ddc450_8f90_500e_0937_51e788ae1912 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/tests/integration_tests/qdrant_vector_store/test_from_texts.py lines 237–266

def test_qdrant_from_texts_raises_error_on_different_distance(
    location: str, vector_name: str, retrieval_mode: RetrievalMode
) -> None:
    """Test if Qdrant.from_texts raises an exception if distance does not match."""
    collection_name = uuid.uuid4().hex
    QdrantVectorStore.from_texts(
        ["lorem", "ipsum", "dolor", "sit", "amet"],
        ConsistentFakeEmbeddings(),
        collection_name=collection_name,
        location=location,
        vector_name=vector_name,
        distance=models.Distance.COSINE,
        retrieval_mode=retrieval_mode,
        sparse_embedding=ConsistentFakeSparseEmbeddings(),
    )

    with pytest.raises(QdrantVectorStoreError) as excinfo:
        QdrantVectorStore.from_texts(
            ["foo", "bar"],
            ConsistentFakeEmbeddings(),
            collection_name=collection_name,
            location=location,
            vector_name=vector_name,
            distance=models.Distance.EUCLID,
            retrieval_mode=retrieval_mode,
            sparse_embedding=ConsistentFakeSparseEmbeddings(),
        )

        expected_message = "configured for COSINE similarity, but requested EUCLID"
        assert expected_message in str(excinfo.value)

Domain

Subdomains

Frequently Asked Questions

What does test_qdrant_from_texts_raises_error_on_different_distance() do?
test_qdrant_from_texts_raises_error_on_different_distance() is a function in the langchain codebase, defined in libs/partners/qdrant/tests/integration_tests/qdrant_vector_store/test_from_texts.py.
Where is test_qdrant_from_texts_raises_error_on_different_distance() defined?
test_qdrant_from_texts_raises_error_on_different_distance() is defined in libs/partners/qdrant/tests/integration_tests/qdrant_vector_store/test_from_texts.py at line 237.

Analyze Your Own Codebase

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

Try Supermodel Free