test_from_existing.py — langchain Source File
Architecture documentation for test_from_existing.py, a python file in the langchain codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 47cac563_7c4d_8c4d_b656_3085f99efae5["test_from_existing.py"] 8dfa0cac_d802_3ccd_f710_43a5e70da3a5["uuid"] 47cac563_7c4d_8c4d_b656_3085f99efae5 --> 8dfa0cac_d802_3ccd_f710_43a5e70da3a5 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 47cac563_7c4d_8c4d_b656_3085f99efae5 --> 120e2591_3e15_b895_72b6_cb26195e40a6 69f1b364_4f43_76af_9887_ecab38a966d8["langchain_qdrant.qdrant"] 47cac563_7c4d_8c4d_b656_3085f99efae5 --> 69f1b364_4f43_76af_9887_ecab38a966d8 a50ef027_f19e_86a8_94ef_895b4566f94e["tests.integration_tests.common"] 47cac563_7c4d_8c4d_b656_3085f99efae5 --> a50ef027_f19e_86a8_94ef_895b4566f94e 513f2bf4_0acd_14e4_0a43_45f7716ce101["tests.integration_tests.fixtures"] 47cac563_7c4d_8c4d_b656_3085f99efae5 --> 513f2bf4_0acd_14e4_0a43_45f7716ce101 style 47cac563_7c4d_8c4d_b656_3085f99efae5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import uuid
import pytest
from langchain_qdrant.qdrant import QdrantVectorStore, RetrievalMode
from tests.integration_tests.common import (
ConsistentFakeEmbeddings,
ConsistentFakeSparseEmbeddings,
)
from tests.integration_tests.fixtures import qdrant_locations, retrieval_modes
@pytest.mark.parametrize("location", qdrant_locations(use_in_memory=False))
@pytest.mark.parametrize("vector_name", ["", "my-vector"])
@pytest.mark.parametrize("retrieval_mode", retrieval_modes())
@pytest.mark.parametrize(
"sparse_vector_name", ["my-sparse-vector", "another-sparse-vector"]
)
def test_qdrant_from_existing_collection_uses_same_collection(
location: str,
vector_name: str,
retrieval_mode: RetrievalMode,
sparse_vector_name: str,
) -> None:
"""Test if the QdrantVectorStore.from_existing_collection reuses the collection."""
collection_name = uuid.uuid4().hex
docs = ["foo"]
QdrantVectorStore.from_texts(
docs,
embedding=ConsistentFakeEmbeddings(),
collection_name=collection_name,
location=location,
vector_name=vector_name,
retrieval_mode=retrieval_mode,
sparse_vector_name=sparse_vector_name,
sparse_embedding=ConsistentFakeSparseEmbeddings(),
)
qdrant = QdrantVectorStore.from_existing_collection(
collection_name,
embedding=ConsistentFakeEmbeddings(),
location=location,
vector_name=vector_name,
retrieval_mode=retrieval_mode,
sparse_vector_name=sparse_vector_name,
sparse_embedding=ConsistentFakeSparseEmbeddings(),
)
qdrant.add_texts(["baz", "bar"])
assert qdrant.client.count(collection_name).count == 3
Domain
Subdomains
Dependencies
- langchain_qdrant.qdrant
- pytest
- tests.integration_tests.common
- tests.integration_tests.fixtures
- uuid
Source
Frequently Asked Questions
What does test_from_existing.py do?
test_from_existing.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_from_existing.py?
test_from_existing.py defines 1 function(s): test_qdrant_from_existing_collection_uses_same_collection.
What does test_from_existing.py depend on?
test_from_existing.py imports 5 module(s): langchain_qdrant.qdrant, pytest, tests.integration_tests.common, tests.integration_tests.fixtures, uuid.
Where is test_from_existing.py in the architecture?
test_from_existing.py is located at libs/partners/qdrant/tests/integration_tests/qdrant_vector_store/test_from_existing.py (domain: CoreAbstractions, subdomain: Serialization, 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