Skip to main content

Interface: ITurn

Defined in: contracts/types.ts:31

One message of a thread, from one side, made of typed parts: the gateway's storage shape of a message.

Built by the TurnBuilder from a prompt or a model result, stored by the ThreadStore, read back by AIGateway.getTurns and by the working memory; the TurnBuilder turns it into the IMessage the model reads.

Properties​

createdAt​

createdAt: Date

Defined in: contracts/types.ts:43

When the turn was stored; the order of the thread's history.


id​

id: string

Defined in: contracts/types.ts:33

Unique within the thread.


modelId?​

optional modelId?: string

Defined in: contracts/types.ts:41

Model that produced it; assistant turns only.


parts​

parts: TTurnPart[]

Defined in: contracts/types.ts:37

Ordered content.


role​

role: ETurnRole

Defined in: contracts/types.ts:35

Who produced it.


usage?​

optional usage?: IUsage

Defined in: contracts/types.ts:39

Tokens spent by this turn; assistant turns only.