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:nameformat, dispatched vialangchain.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 (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"].The connection-type definition documents
cohere:embed-english-v3.0as an example of theprovider:nameformat, but the hook only forwardsapi_key/base_urltoinit_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=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¶
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:
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-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\"}"
}