test_from_texts.py — langchain Source File
Architecture documentation for test_from_texts.py, a python file in the langchain codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 13db35ab_87ff_ace7_2b5c_1727b78f8223["test_from_texts.py"] 8dfa0cac_d802_3ccd_f710_43a5e70da3a5["uuid"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> 8dfa0cac_d802_3ccd_f710_43a5e70da3a5 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> 120e2591_3e15_b895_72b6_cb26195e40a6 c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> c554676d_b731_47b2_a98f_c1c2d537c0aa e9f800f2_8227_1095_42ef_324e02810451["qdrant_client"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> e9f800f2_8227_1095_42ef_324e02810451 77801658_6b3a_bc26_7e54_388e5c04807d["langchain_qdrant"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> 77801658_6b3a_bc26_7e54_388e5c04807d 69f1b364_4f43_76af_9887_ecab38a966d8["langchain_qdrant.qdrant"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> 69f1b364_4f43_76af_9887_ecab38a966d8 a50ef027_f19e_86a8_94ef_895b4566f94e["tests.integration_tests.common"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> a50ef027_f19e_86a8_94ef_895b4566f94e 513f2bf4_0acd_14e4_0a43_45f7716ce101["tests.integration_tests.fixtures"] 13db35ab_87ff_ace7_2b5c_1727b78f8223 --> 513f2bf4_0acd_14e4_0a43_45f7716ce101 style 13db35ab_87ff_ace7_2b5c_1727b78f8223 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import uuid
import pytest
from langchain_core.documents import Document
from qdrant_client import models
from langchain_qdrant import QdrantVectorStore, RetrievalMode
from langchain_qdrant.qdrant import QdrantVectorStoreError
from tests.integration_tests.common import (
ConsistentFakeEmbeddings,
ConsistentFakeSparseEmbeddings,
assert_documents_equals,
)
from tests.integration_tests.fixtures import qdrant_locations, retrieval_modes
@pytest.mark.parametrize("location", qdrant_locations())
@pytest.mark.parametrize("retrieval_mode", retrieval_modes())
def test_vectorstore_from_texts(location: str, retrieval_mode: RetrievalMode) -> None:
"""Test end to end Qdrant.from_texts stores texts."""
collection_name = uuid.uuid4().hex
vec_store = QdrantVectorStore.from_texts(
["Lorem ipsum dolor sit amet", "Ipsum dolor sit amet"],
ConsistentFakeEmbeddings(),
collection_name=collection_name,
location=location,
retrieval_mode=retrieval_mode,
sparse_embedding=ConsistentFakeSparseEmbeddings(),
)
assert vec_store.client.count(collection_name).count == 2
@pytest.mark.parametrize("batch_size", [1, 64])
@pytest.mark.parametrize("vector_name", ["", "my-vector"])
@pytest.mark.parametrize(
"sparse_vector_name", ["my-sparse-vector", "another-sparse-vector"]
)
@pytest.mark.parametrize("location", qdrant_locations())
@pytest.mark.parametrize("retrieval_mode", retrieval_modes())
def test_qdrant_from_texts_stores_ids(
batch_size: int,
vector_name: str,
sparse_vector_name: str,
location: str,
retrieval_mode: RetrievalMode,
) -> None:
"""Test end to end Qdrant.from_texts stores provided ids."""
collection_name = uuid.uuid4().hex
ids: list[str | int] = [
"fa38d572-4c31-4579-aedc-1960d79df6df",
786,
]
vec_store = QdrantVectorStore.from_texts(
["abc", "def"],
ConsistentFakeEmbeddings(),
ids=ids,
// ... (326 more lines)
Domain
Subdomains
Functions
- test_from_texts_passed_optimizers_config_and_on_disk_payload()
- test_qdrant_from_texts_raises_error_on_different_dimensionality()
- test_qdrant_from_texts_raises_error_on_different_distance()
- test_qdrant_from_texts_raises_error_on_different_vector_name()
- test_qdrant_from_texts_recreates_collection_on_force_recreate()
- test_qdrant_from_texts_reuses_same_collection()
- test_qdrant_from_texts_stores_embeddings_as_named_vectors()
- test_qdrant_from_texts_stores_ids()
- test_qdrant_from_texts_stores_metadatas()
- test_vectorstore_from_texts()
Dependencies
- langchain_core.documents
- langchain_qdrant
- langchain_qdrant.qdrant
- pytest
- qdrant_client
- tests.integration_tests.common
- tests.integration_tests.fixtures
- uuid
Source
Frequently Asked Questions
What does test_from_texts.py do?
test_from_texts.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_from_texts.py?
test_from_texts.py defines 10 function(s): test_from_texts_passed_optimizers_config_and_on_disk_payload, test_qdrant_from_texts_raises_error_on_different_dimensionality, test_qdrant_from_texts_raises_error_on_different_distance, test_qdrant_from_texts_raises_error_on_different_vector_name, test_qdrant_from_texts_recreates_collection_on_force_recreate, test_qdrant_from_texts_reuses_same_collection, test_qdrant_from_texts_stores_embeddings_as_named_vectors, test_qdrant_from_texts_stores_ids, test_qdrant_from_texts_stores_metadatas, test_vectorstore_from_texts.
What does test_from_texts.py depend on?
test_from_texts.py imports 8 module(s): langchain_core.documents, langchain_qdrant, langchain_qdrant.qdrant, pytest, qdrant_client, tests.integration_tests.common, tests.integration_tests.fixtures, uuid.
Where is test_from_texts.py in the architecture?
test_from_texts.py is located at libs/partners/qdrant/tests/integration_tests/qdrant_vector_store/test_from_texts.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/partners/qdrant/tests/integration_tests/qdrant_vector_store).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free