Home / Function/ from_existing_collection() — langchain Function Reference

from_existing_collection() — langchain Function Reference

Architecture documentation for the from_existing_collection() function in vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  59fb3b26_cc4e_4d8e_da37_dd3fc2d682dc["from_existing_collection()"]
  bf62db79_4217_463c_798f_6f8528ed0d6e["Qdrant"]
  59fb3b26_cc4e_4d8e_da37_dd3fc2d682dc -->|defined in| bf62db79_4217_463c_798f_6f8528ed0d6e
  7ca49eb4_bf83_6d06_fdce_2ebfe3088d38["_generate_clients()"]
  59fb3b26_cc4e_4d8e_da37_dd3fc2d682dc -->|calls| 7ca49eb4_bf83_6d06_fdce_2ebfe3088d38
  style 59fb3b26_cc4e_4d8e_da37_dd3fc2d682dc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 1373–1426

    def from_existing_collection(
        cls: type[Qdrant],
        embedding: Embeddings,
        path: str | None = None,
        collection_name: str | None = None,
        location: str | None = None,
        url: str | None = None,
        port: int | None = 6333,
        grpc_port: int = 6334,
        prefer_grpc: bool = False,  # noqa: FBT001, FBT002
        https: bool | None = None,  # noqa: FBT001
        api_key: str | None = None,
        prefix: str | None = None,
        timeout: int | None = None,
        host: str | None = None,
        content_payload_key: str = CONTENT_KEY,
        metadata_payload_key: str = METADATA_KEY,
        distance_strategy: str = "COSINE",
        vector_name: str | None = VECTOR_NAME,
        **kwargs: Any,
    ) -> Qdrant:
        """Get instance of an existing Qdrant collection.

        This method will return the instance of the store without inserting any new
        embeddings.
        """
        if collection_name is None:
            msg = "Must specify collection_name. Received None."
            raise ValueError(msg)

        client, async_client = cls._generate_clients(
            location=location,
            url=url,
            port=port,
            grpc_port=grpc_port,
            prefer_grpc=prefer_grpc,
            https=https,
            api_key=api_key,
            prefix=prefix,
            timeout=timeout,
            host=host,
            path=path,
            **kwargs,
        )
        return cls(
            client=client,
            async_client=async_client,
            collection_name=collection_name,
            embeddings=embedding,
            content_payload_key=content_payload_key,
            metadata_payload_key=metadata_payload_key,
            distance_strategy=distance_strategy,
            vector_name=vector_name,
        )

Subdomains

Frequently Asked Questions

What does from_existing_collection() do?
from_existing_collection() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is from_existing_collection() defined?
from_existing_collection() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 1373.
What does from_existing_collection() call?
from_existing_collection() calls 1 function(s): _generate_clients.

Analyze Your Own Codebase

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

Try Supermodel Free