ChatOpenAI for model calls, which supports custom OpenAI-compatible endpoints like dottxt.
For dottxt, the key integration point is LangChain’s structured-output support: bind a schema to ChatOpenAI, and LangChain will send the corresponding structured output request to dottxt and parse the result back into a typed object.
Install
Configure
Create aChatOpenAI instance pointed at dottxt:
Structured output
Usewith_structured_output() to bind a Pydantic model to the LLM. The result is a typed object:
Using in a graph
Combine structured output with LangGraph’sStateGraph for multi-step workflows:
Notes
- Prefer
method="json_schema"with dottxt so LangChain uses the structured output path explicitly. - Graph nodes are plain functions that receive the full state and return a partial dict of updates.
ConfigDict(extra="forbid")is useful when you wantadditionalProperties: falsein the generated schema.- See the Pydantic authoring guide for how to write effective schemas.