callLanguageModel
callLanguageModel(
model,ctx,responseFormat?):Promise<ModelResponse>
Calls a LanguageModelV3 instance with the messages and tools from a ModelContext.
This is the core bridge function: converts Agent Express format → AI SDK V3 format,
calls model.doGenerate(), and converts the result back.
Parameters
Section titled “Parameters”LanguageModelV3
Resolved LanguageModelV3 instance
ModelContext with messages and tool definitions
responseFormat?
Section titled “responseFormat?”description?
Section titled “description?”string
string
schema
Section titled “schema”Record<string, unknown>
"json"
Returns
Section titled “Returns”Promise<ModelResponse>
Normalized ModelResponse