Home / Function/ _generate_clients() — langchain Function Reference

_generate_clients() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 2280–2332

    def _generate_clients(
        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,
        path: str | None = None,
        **kwargs: Any,
    ) -> tuple[QdrantClient, AsyncQdrantClient | None]:
        if api_key is None:
            api_key = os.getenv("QDRANT_API_KEY")

        sync_client = QdrantClient(
            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,
        )

        if location == ":memory:" or path is not None:
            # Local Qdrant cannot co-exist with Sync and Async clients
            # We fallback to sync operations in this case
            async_client = None
        else:
            async_client = AsyncQdrantClient(
                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 sync_client, async_client

Subdomains

Frequently Asked Questions

What does _generate_clients() do?
_generate_clients() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is _generate_clients() defined?
_generate_clients() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 2280.
What calls _generate_clients()?
_generate_clients() is called by 3 function(s): aconstruct_instance, construct_instance, from_existing_collection.

Analyze Your Own Codebase

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

Try Supermodel Free