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
LangChain models: 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:nameformat, dispatched vialangchain.chat_models.init_chat_model(e.g.openai:gpt-5,anthropic:claude-sonnet-5). This field appears as a dedicated input in the connection form (viaconn-fields) and stores its value inextra["model"].- Embedding Model (Extra field)
Embedding model identifier in
provider:nameformat, dispatched vialangchain.embeddings.init_embeddings(e.g.openai:text-embedding-3-small). This field appears as a dedicated input in the connection form (viaconn-fields) and stores its value inextra["embed_model"].- API Key (Password field)
The API key for your LLM provider, passed as
api_key=toinit_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¶
The hook forwards two values to LangChain: the connection’s password as
api_key and its host as base_url. Any provider whose LangChain model
class accepts those two keyword arguments works, which includes OpenAI,
Anthropic, Groq, Mistral AI, DeepSeek, Ollama and vLLM. Providers whose
classes expect their own credential shape (AWS Bedrock, Google Vertex AI and
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:
The
llm_model/embed_modelconstructor argument onLangChainHook.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-5\", \"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\"}"
}