Skip to content

IRChatRequest

Defined in: packages/ai.matey.types/src/ir.ts:669

Universal chat completion request.

This is the normalized format that all frontend adapters convert to and all backend adapters consume.

const request: IRChatRequest = {
messages: [
{ role: 'system', content: 'You are helpful.' },
{ role: 'user', content: 'Hello!' }
],
parameters: {
model: 'gpt-4',
temperature: 0.7,
maxTokens: 1000
},
metadata: {
requestId: 'req_abc123',
timestamp: Date.now(),
provenance: {
frontend: 'openai'
}
},
stream: false
};

readonly messages: readonly IRMessage[]

Defined in: packages/ai.matey.types/src/ir.ts:674

Conversation messages. Must contain at least one message.


readonly metadata: IRMetadata

Defined in: packages/ai.matey.types/src/ir.ts:699

Request metadata.


readonly optional parameters: IRParameters

Defined in: packages/ai.matey.types/src/ir.ts:694

Request parameters.


readonly optional stream: boolean

Defined in: packages/ai.matey.types/src/ir.ts:705

Whether to stream the response.

false

readonly optional streamMode: StreamMode

Defined in: packages/ai.matey.types/src/ir.ts:722

Preferred streaming mode (hint to backend).

  • delta: Request incremental chunks only (most efficient)
  • accumulated: Request full accumulated text in each chunk

This is a preference hint - backends may choose to:

  • Provide only delta (always safe, universal)
  • Provide both delta and accumulated (maximum flexibility)
  • Provide only accumulated (if that’s native format)

Frontends and wrappers can convert between modes as needed.

'delta'

readonly optional toolChoice: "none" | { name: string; } | "auto" | "required"

Defined in: packages/ai.matey.types/src/ir.ts:689

Tool choice strategy.

  • ‘auto’: Model decides whether to call tools
  • ‘required’: Model must call a tool
  • ‘none’: Model cannot call tools
  • { name: string }: Force specific tool

readonly optional tools: readonly IRTool[]

Defined in: packages/ai.matey.types/src/ir.ts:680

Tool/function definitions. Optional, for function calling.