Skip to content

IRMetadata

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

Request/response metadata.

Tracks provenance, timing, warnings, and custom metadata throughout the adapter chain.

const metadata: IRMetadata = {
requestId: 'req_abc123',
timestamp: Date.now(),
provenance: {
frontend: 'anthropic',
backend: 'openai',
middleware: ['logging', 'caching']
},
warnings: [
{
category: 'parameter-normalized',
severity: 'info',
message: 'Temperature scaled from 0-2 to 0-1 range',
field: 'temperature'
}
],
custom: {
userId: 'user_123',
sessionId: 'session_456'
}
};

readonly optional custom: Record<string, unknown>

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

Custom metadata fields. Can be used by middleware or application code.


readonly optional provenance: IRProvenance

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

Adapter chain provenance.


readonly optional providerResponseId: string

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

Provider’s response identifier. Set by backend adapter from the provider’s actual response ID. Examples: OpenAI’s “chatcmpl-xxx”, Anthropic’s “msg_xxx”. Useful for correlating with provider logs and billing.


readonly requestId: string

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

Unique request identifier. Generated by the client (frontend adapter or Bridge). Stable across retries and fallbacks for correlation.


readonly timestamp: number

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

Request timestamp (milliseconds since epoch).


readonly optional warnings: readonly IRWarning[]

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

Semantic drift warnings collected during processing. Documents any transformations or compatibility issues.