LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScriptlangchainindexModelRequest
Interfaceā—Since v1.2

ModelRequest

Copy
interface ModelRequest

Properties

View source on GitHub
property
messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[]
property
model: LanguageModelLike
property
modelSettings: Record<string, unknown>

Additional settings to bind to the model when preparing it for invocation. These settings are applied via bindTools() and can include parameters like headers, container, etc. The model is re-bound on each request, so these settings can vary per invocation.

Copy
modelSettings: {
  headers: { "anthropic-beta": "code-execution-2025-08-25" },
  container: "container_abc123"
}
property
runtime: Runtime<TContext>

The runtime context containing metadata, signal, writer, interrupt, etc.

property
state: TState & AgentBuiltInState

The current agent state (includes both middleware state and built-in state).

property
systemMessage: SystemMessage

The system message for this step. If no systemPrompt was provided, when createAgent was initialized, an empty system message will be used.

Copy
wrapModelCall: async (request, handler) => {
  return handler({
    ...request,
    systemMessage: request.systemMessage.concat("something")
  });
}
Copy
wrapModelCall: async (request, handler) => {
  return handler({
    ...request,
    systemMessage: request.systemMessage.concat(
      new SystemMessage({
        content: [{
          type: "text",
          text: "something",
          cache_control: { type: "ephemeral", ttl: "1m" }
        }],
      })
    ),
  });
}
property
toolChoice: "required" | "auto" | "none" | __type

Tool choice configuration (model-specific format). Can be one of:

  • "auto": means the model can pick between generating a message or calling one or more tools.
  • "none": means the model will not call any tool and instead generates a message.
  • "required": means the model must call one or more tools.
  • { type: "function", function: { name: string } }: The model will use the specified function.
property
tools: ClientTool | ServerTool[]
deprecatedproperty
systemPrompt: string

The system message string for this step.

Configuration for modifying a model call at runtime. All fields are optional and only provided fields will override defaults.