Skip to main content
LangGraph is a graph-based agent framework by the LangChain team. It uses 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 a ChatOpenAI instance pointed at dottxt:

Structured output

Use with_structured_output() to bind a Pydantic model to the LLM. The result is a typed object:
LangChain builds the structured output request and parses the JSON response back into your Pydantic model. Under the hood, this still uses the same dottxt structured generation flow described in API Overview.

Using in a graph

Combine structured output with LangGraph’s StateGraph 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 want additionalProperties: false in the generated schema.
  • See the Pydantic authoring guide for how to write effective schemas.