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
  c5f7ca94_1f42_db1f_48c0_c5427bcdce1e["test_qdrant_from_texts_raises_error_on_different_distance()"]
  a57b717d_2d4d_3890_29a0_1fe4629dbfac["test_from_texts.py"]
  c5f7ca94_1f42_db1f_48c0_c5427bcdce1e -->|defined in| a57b717d_2d4d_3890_29a0_1fe4629dbfac
  style c5f7ca94_1f42_db1f_48c0_c5427bcdce1e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/tests/integration_tests/test_from_texts.py lines 180–206

def test_qdrant_from_texts_raises_error_on_different_distance() -> None:
    """Test if Qdrant.from_texts raises an exception if distance does not match."""
    collection_name = uuid.uuid4().hex
    with tempfile.TemporaryDirectory() as tmpdir:
        vec_store = Qdrant.from_texts(
            ["lorem", "ipsum", "dolor", "sit", "amet"],
            ConsistentFakeEmbeddings(),
            collection_name=collection_name,
            path=str(tmpdir),
            distance_func="Cosine",
        )
        del vec_store

        with pytest.raises(QdrantException) as excinfo:
            Qdrant.from_texts(
                ["foo", "bar"],
                ConsistentFakeEmbeddings(),
                collection_name=collection_name,
                path=str(tmpdir),
                distance_func="Euclid",
            )

        expected_message = (
            "configured for COSINE similarity, but requested EUCLID. Please set "
            "`distance_func` parameter to `COSINE`"
        )
        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/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/test_from_texts.py at line 180.

Analyze Your Own Codebase

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

Try Supermodel Free