LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Graphs
  • Functional API
  • Pregel
  • Checkpointing
  • Storage
  • Caching
  • Types
  • Runtime
  • Config
  • Errors
  • Constants
  • Channels
  • Agents
LangGraph CLI
LangGraph SDK
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
LangGraph CLI
LangGraph SDK
LangGraph Supervisor
LangGraph Swarm
Language
Theme
Pythonlanggraph_internal_pydanticcreate_model
Function●Since v0.6

create_model

Create a pydantic model with the given field definitions.

Copy
create_model(
  model_name: str,
  *,
  field_definitions: dict[str, Any] | None = None,
  root: Any | None = None
) -> type[BaseModel]

Attention:

Please do not use outside of langchain packages. This API is subject to change at any time.

Parameters

NameTypeDescription
model_name*str

The name of the model.

module_name*unknown

The name of the module where the model is defined. This is used by Pydantic to resolve any forward references.

field_definitionsdict[str, Any] | None
Default:None

The field definitions for the model.

rootAny | None
Default:None

Type for a root model (RootModel)

View source on GitHub