Interface UserRequest

The UserRequest extends the "pure" LanguageModelRequest for cancelling support as well as logging metadata. The additional metadata might also be used for other use cases, for example to query default request settings based on the agent id, merging with the request settings handed over.

interface UserRequest {
    agentId?: string;
    cancellationToken?: CancellationToken;
    clientSettings?: {
        keepThinking: boolean;
        keepToolCalls: boolean;
    };
    messages: LanguageModelMessage[];
    requestId: string;
    response_format?: {
        type: "text";
    } | {
        type: "json_object";
    } | ResponseFormatJsonSchema;
    sessionId: string;
    settings?: {
        [key: string]: unknown;
    };
    subRequestId?: string;
    tools?: ToolRequest[];
}

Hierarchy (view full)

Properties

agentId?: string

Optional agent identifier in case the request was sent by an agent

cancellationToken?: CancellationToken

Cancellation support

clientSettings?: {
    keepThinking: boolean;
    keepToolCalls: boolean;
}

Type declaration

  • keepThinking: boolean
  • keepToolCalls: boolean
requestId: string

Identifier of the request or overall exchange. Corresponds to request id in Chat sessions

response_format?: {
    type: "text";
} | {
    type: "json_object";
} | ResponseFormatJsonSchema

Type declaration

  • type: "text"

Type declaration

  • type: "json_object"
sessionId: string

Identifier of the Ai/ChatSession

settings?: {
    [key: string]: unknown;
}

Type declaration

  • [key: string]: unknown
subRequestId?: string

Id of a request in case a single exchange consists of multiple requests. In this case the requestId corresponds to the overall exchange.

tools?: ToolRequest[]