test_from_texts.py — langchain Source File
Architecture documentation for test_from_texts.py, a python file in the langchain codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7804b385_c130_47e1_2a48_71d688ae0935["test_from_texts.py"] 0029f612_c503_ebcf_a452_a0fae8c9f2c3["os"] 7804b385_c130_47e1_2a48_71d688ae0935 --> 0029f612_c503_ebcf_a452_a0fae8c9f2c3 02f66451_d2a9_e7c3_9765_c3a7594721ad["uuid"] 7804b385_c130_47e1_2a48_71d688ae0935 --> 02f66451_d2a9_e7c3_9765_c3a7594721ad f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] 7804b385_c130_47e1_2a48_71d688ae0935 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 6a98b0a5_5607_0043_2e22_a46a464c2d62["langchain_core.documents"] 7804b385_c130_47e1_2a48_71d688ae0935 --> 6a98b0a5_5607_0043_2e22_a46a464c2d62 67883832_8f96_6ce0_6b88_0267f86654f8["langchain_qdrant"] 7804b385_c130_47e1_2a48_71d688ae0935 --> 67883832_8f96_6ce0_6b88_0267f86654f8 a9840a72_583e_6dd5_fe94_93800e54d57f["langchain_qdrant.vectorstores"] 7804b385_c130_47e1_2a48_71d688ae0935 --> a9840a72_583e_6dd5_fe94_93800e54d57f b499c7a8_2fb9_cfc0_4cf2_8686096d49bc["tests.integration_tests.common"] 7804b385_c130_47e1_2a48_71d688ae0935 --> b499c7a8_2fb9_cfc0_4cf2_8686096d49bc 85cb53ff_3599_0e5f_1446_bc1cd58ba408["tests.integration_tests.fixtures"] 7804b385_c130_47e1_2a48_71d688ae0935 --> 85cb53ff_3599_0e5f_1446_bc1cd58ba408 a2826e40_d594_f57c_31ca_7071620aefc6["qdrant_client"] 7804b385_c130_47e1_2a48_71d688ae0935 --> a2826e40_d594_f57c_31ca_7071620aefc6 style 7804b385_c130_47e1_2a48_71d688ae0935 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import os
import uuid
import pytest # type: ignore[import-not-found]
from langchain_core.documents import Document
from langchain_qdrant import Qdrant
from langchain_qdrant.vectorstores import QdrantException
from tests.integration_tests.common import (
ConsistentFakeEmbeddings,
assert_documents_equals,
)
from tests.integration_tests.fixtures import (
qdrant_locations,
)
@pytest.mark.parametrize("qdrant_location", qdrant_locations())
async def test_qdrant_from_texts_stores_duplicated_texts(qdrant_location: str) -> None:
"""Test end to end Qdrant.afrom_texts stores duplicated texts separately."""
collection_name = uuid.uuid4().hex
vec_store = await Qdrant.afrom_texts(
["abc", "abc"],
ConsistentFakeEmbeddings(),
collection_name=collection_name,
location=qdrant_location,
)
client = vec_store.client
assert client.count(collection_name).count == 2
@pytest.mark.parametrize("batch_size", [1, 64])
@pytest.mark.parametrize("vector_name", [None, "my-vector"])
@pytest.mark.parametrize("qdrant_location", qdrant_locations())
async def test_qdrant_from_texts_stores_ids(
batch_size: int, vector_name: str | None, qdrant_location: str
) -> None:
"""Test end to end Qdrant.afrom_texts stores provided ids."""
collection_name = uuid.uuid4().hex
ids = [
"fa38d572-4c31-4579-aedc-1960d79df6df",
"cdc1aa36-d6ab-4fb2-8a94-56674fd27484",
]
vec_store = await Qdrant.afrom_texts(
["abc", "def"],
ConsistentFakeEmbeddings(),
ids=ids,
collection_name=collection_name,
batch_size=batch_size,
vector_name=vector_name,
location=qdrant_location,
)
client = vec_store.client
assert client.count(collection_name).count == 2
stored_ids = [point.id for point in client.scroll(collection_name)[0]]
// ... (209 more lines)
Domain
Subdomains
Functions
- 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_duplicated_texts()
- test_qdrant_from_texts_stores_embeddings_as_named_vectors()
- test_qdrant_from_texts_stores_ids()
- test_qdrant_from_texts_stores_metadatas()
Dependencies
- langchain_core.documents
- langchain_qdrant
- langchain_qdrant.vectorstores
- os
- 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 LangChainCore domain, ApiManagement subdomain.
What functions are defined in test_from_texts.py?
test_from_texts.py defines 9 function(s): 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_duplicated_texts, test_qdrant_from_texts_stores_embeddings_as_named_vectors, test_qdrant_from_texts_stores_ids, test_qdrant_from_texts_stores_metadatas.
What does test_from_texts.py depend on?
test_from_texts.py imports 9 module(s): langchain_core.documents, langchain_qdrant, langchain_qdrant.vectorstores, os, pytest, qdrant_client, tests.integration_tests.common, tests.integration_tests.fixtures, and 1 more.
Where is test_from_texts.py in the architecture?
test_from_texts.py is located at libs/partners/qdrant/tests/integration_tests/async_api/test_from_texts.py (domain: LangChainCore, subdomain: ApiManagement, directory: libs/partners/qdrant/tests/integration_tests/async_api).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free