Skip to main content

Variable: GenerationEventSchema

const GenerationEventSchema: TUnion<[TObject<{ chatId: TString; messages: TArray<TObject<{ content: TString; name: TOptional<TUnion<[TString, TNull]>>; role: TUnion<[TLiteral<"system">, TLiteral<"user">, TLiteral<"assistant">, TLiteral<"tool">, TLiteral<"plugin">]>; }>>; meta: TRecord<TString, TUnknown>; requestId: TString; responseToken: TString; type: TLiteral<"plugin_intercept">; }>, TObject<{ requestId: TString; type: TLiteral<"start">; }>, TObject<{ text: TString; type: TLiteral<"delta">; }>, TObject<{ text: TString; type: TLiteral<"done">; usage: TOptional<TObject<{ completionTokens: TInteger; promptTokens: TInteger; totalTokens: TInteger; }>>; }>, TObject<{ code: TString; message: TString; type: TLiteral<"error">; }>]>

Defined in: packages/contracts/src/provider.ts:442

Unified streaming generation events (ТЗ §4.3). Every provider adapter emits this sequence: start → zero or more delta → exactly one done or error.