Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

LangChain Connection

The langchain connection type configures access to LLM providers via LangChain’s universal init_chat_model / init_embeddings entry points. It backs LangChainHook (see LangChainHook for hook usage and installation instructions).

Default Connection IDs

The LangChainHook uses langchain_default by default.

Configuring the Connection

Chat Model (Extra field)

Chat model identifier in provider:name format, dispatched via langchain.chat_models.init_chat_model (e.g. openai:gpt-4o, anthropic:claude-sonnet-5). This field appears as a dedicated input in the connection form (via conn-fields) and stores its value in extra["model"].

Embedding Model (Extra field)

Embedding model identifier in provider:name format, dispatched via langchain.embeddings.init_embeddings (e.g. openai:text-embedding-3-small). This field appears as a dedicated input in the connection form (via conn-fields) and stores its value in extra["embed_model"].

The connection-type definition documents cohere:embed-english-v3.0 as an example of the provider:name format, but the hook only forwards api_key / base_url to init_embeddings – vendors with bespoke embedding auth such as Cohere are not covered by this connection type yet (see Supported providers below and LangChainHook).

API Key (Password field)

The API key for your LLM provider, passed as api_key= to init_chat_model / init_embeddings.

Host (optional)

Optional base URL, passed as base_url= (custom OpenAI-compatible endpoints, Ollama, vLLM).

The schema, port, and login fields are hidden in the connection form; they are not used by this connection type.

Supported providers

Only OpenAI-compatible providers work with this hook’s api_key + optional base_url credential surface: OpenAI, Anthropic, Groq, Mistral AI, DeepSeek, Ollama, and vLLM. Providers with bespoke auth (AWS Bedrock, Google Vertex AI / GenAI, Azure OpenAI, Cohere, HuggingFace) reject these kwargs and are not usable through this connection type.

Model resolution order

Both get_chat_model() and get_embedding_model() resolve the model identifier from, in order:

  1. The llm_model / embed_model constructor argument on LangChainHook.

  2. extra["model"] / extra["embed_model"] on the connection.

If neither is set, the hook raises a ValueError when the model is needed.

Examples

OpenAI (chat and embeddings)

{
    "conn_type": "langchain",
    "password": "sk-...",
    "extra": "{\"model\": \"openai:gpt-4o\", \"embed_model\": \"openai:text-embedding-3-small\"}"
}

Anthropic (chat only)

{
    "conn_type": "langchain",
    "password": "sk-ant-...",
    "extra": "{\"model\": \"anthropic:claude-sonnet-5\"}"
}

Ollama (local, custom endpoint)

{
    "conn_type": "langchain",
    "host": "http://localhost:11434/v1",
    "extra": "{\"model\": \"ollama:llama3\"}"
}

Was this entry helpful?