Interface ChatRequest<P, AC>

Contextual information about the request.

interface ChatRequest<P, AC> {
    appConfig: AC;
    conversationId: string;
    isNewConversation: boolean;
    payload?: P;
    requestId: string;
    stream: ChatResponseStream;
    toolCallResults?: ToolCallResult[];
    userMessage?: string;
}

Type Parameters

Hierarchy (view full)

Properties

appConfig: AC

Additional configuration that can be passed from the client to the agent. This can be used to pass feature-flags or other configuration values. E.g. { model: 'gpt-3.5-turbo-0125', promptVersion: "chain-of-thought", }

conversationId: string

Conversation ID associated with the request. For conversational applications, multiple requests can be associated with the same conversation.

isNewConversation: boolean

Flag to indicate if the current request is a new conversation.

payload?: P

Additional data that can be passed to the agent.

requestId: string

Unique request ID associated with the request.

Stream helper class used to send back chunks of data to the client.

toolCallResults?: ToolCallResult[]

For client-sided tools, this can be used to notify the result of the tool call. E.g. If the previous agent call response was: { toolCalls: [ { id: '1', name: 'getWeather', parameters: { ... } }, } Then when the client-side tool is executed, you can call the agent with: { toolCallResults: [ { id: '1', result: { ... } } ]

userMessage?: string

For chat-based agents, this is the user message sent from the client.