types
StreamingReq
module-attribute
StreamingReq = (
ThreadsCreateReq
| ThreadsAddUserMessageReq
| ThreadsAddClientToolOutputReq
| ThreadsRetryAfterItemReq
| ThreadsCustomActionReq
)
Union of request types that produce streaming responses.
NonStreamingReq
module-attribute
NonStreamingReq = (
ThreadsGetByIdReq
| ThreadsListReq
| ItemsListReq
| ItemsFeedbackReq
| AttachmentsCreateReq
| AttachmentsDeleteReq
| ThreadsUpdateReq
| ThreadsDeleteReq
)
Union of request types that yield immediate responses.
ThreadStreamEvent
module-attribute
ThreadStreamEvent = Annotated[
ThreadCreatedEvent
| ThreadUpdatedEvent
| ThreadItemDoneEvent
| ThreadItemAddedEvent
| ThreadItemUpdated
| ThreadItemRemovedEvent
| ThreadItemReplacedEvent
| ProgressUpdateEvent
| ErrorEvent
| NoticeEvent,
Field(discriminator="type"),
]
Union of all streaming events emitted to clients.
ThreadItemUpdate
module-attribute
ThreadItemUpdate = (
AssistantMessageContentPartAdded
| AssistantMessageContentPartTextDelta
| AssistantMessageContentPartAnnotationAdded
| AssistantMessageContentPartDone
| WidgetStreamingTextValueDelta
| WidgetComponentUpdated
| WidgetRootUpdated
| WorkflowTaskAdded
| WorkflowTaskUpdated
)
Union of possible updates applied to thread items.
ThreadStatus
module-attribute
ThreadStatus = Annotated[
ActiveStatus | LockedStatus | ClosedStatus,
Field(discriminator="type"),
]
Union of lifecycle states for a thread.
ThreadItem
module-attribute
ThreadItem = Annotated[
UserMessageItem
| AssistantMessageItem
| ClientToolCallItem
| WidgetItem
| WorkflowItem
| TaskItem
| HiddenContextItem
| EndOfTurnItem,
Field(discriminator="type"),
]
Union of all thread item variants.
UserMessageContent
module-attribute
UserMessageContent = Annotated[
UserMessageTextContent | UserMessageTagContent,
Field(discriminator="type"),
]
Union of allowed user message content payloads.
Attachment
module-attribute
Attachment = Annotated[
FileAttachment | ImageAttachment,
Field(discriminator="type"),
]
Union of supported attachment types.
WorkflowSummary
module-attribute
WorkflowSummary = CustomSummary | DurationSummary
Summary variants available for workflows.
Task
module-attribute
Task = Annotated[
CustomTask
| SearchTask
| ThoughtTask
| FileTask
| ImageTask,
Field(discriminator="type"),
]
Union of workflow task variants.
Source
module-attribute
Source = Annotated[
URLSource | FileSource | EntitySource,
Field(discriminator="type"),
]
Union of supported source types.
FeedbackKind
module-attribute
Literal type for feedback sentiment.
IconName
module-attribute
IconName = Literal[
"analytics",
"atom",
"bolt",
"book-open",
"book-closed",
"calendar",
"chart",
"circle-question",
"compass",
"cube",
"globe",
"keys",
"lab",
"images",
"lifesaver",
"lightbulb",
"map-pin",
"name",
"notebook",
"notebook-pencil",
"page-blank",
"profile",
"profile-card",
"search",
"sparkle",
"sparkle-double",
"square-code",
"square-image",
"square-text",
"suitcase",
"write",
"write-alt",
"write-alt2",
]
Literal names of supported progress icons.
Page
BaseReq
Bases: BaseModel
Base class for all request payloads.
Source code in chatkit/types.py
ThreadsGetByIdReq
ThreadGetByIdParams
ThreadsCreateReq
ThreadCreateParams
ThreadListParams
ThreadsListReq
ThreadsAddUserMessageReq
ThreadAddUserMessageParams
ThreadsAddClientToolOutputReq
ThreadAddClientToolOutputParams
ThreadsCustomActionReq
ThreadCustomActionParams
ThreadsRetryAfterItemReq
Bases: BaseReq
Request to retry processing after a specific thread item.
Source code in chatkit/types.py
ThreadRetryAfterItemParams
ItemsFeedbackReq
ItemFeedbackParams
AttachmentsDeleteReq
AttachmentDeleteParams
AttachmentsCreateReq
AttachmentCreateParams
ItemsListReq
ItemsListParams
Bases: BaseModel
Pagination parameters for listing thread items.
Source code in chatkit/types.py
ThreadsUpdateReq
ThreadUpdateParams
ThreadsDeleteReq
ThreadDeleteParams
ThreadCreatedEvent
ThreadUpdatedEvent
ThreadItemAddedEvent
ThreadItemUpdated
Bases: BaseModel
Event describing an update to an existing thread item.
Source code in chatkit/types.py
ThreadItemDoneEvent
ThreadItemRemovedEvent
ThreadItemReplacedEvent
ProgressUpdateEvent
Bases: BaseModel
Event providing incremental progress from the assistant.
Source code in chatkit/types.py
ErrorEvent
Bases: BaseModel
Event indicating an error occurred while processing a thread.
Source code in chatkit/types.py
NoticeEvent
Bases: BaseModel
Event conveying a user-facing notice.
Source code in chatkit/types.py
message
instance-attribute
Supports markdown e.g. "You've reached your limit of 100 messages. Upgrade to a paid plan."
AssistantMessageContentPartAdded
Bases: BaseModel
Event emitted when new assistant content is appended.
Source code in chatkit/types.py
AssistantMessageContentPartTextDelta
Bases: BaseModel
Event carrying incremental assistant text output.
Source code in chatkit/types.py
AssistantMessageContentPartAnnotationAdded
Bases: BaseModel
Event announcing a new annotation on assistant content.
Source code in chatkit/types.py
AssistantMessageContentPartDone
Bases: BaseModel
Event indicating an assistant content part is finalized.
Source code in chatkit/types.py
WidgetStreamingTextValueDelta
Bases: BaseModel
Event streaming widget text deltas.
Source code in chatkit/types.py
WidgetRootUpdated
WidgetComponentUpdated
Bases: BaseModel
Event emitted when a widget component updates.
Source code in chatkit/types.py
WorkflowTaskAdded
WorkflowTaskUpdated
Bases: BaseModel
Event emitted when a workflow task is updated.
Source code in chatkit/types.py
ThreadMetadata
Bases: BaseModel
Metadata describing a thread without its items.
Source code in chatkit/types.py
ActiveStatus
LockedStatus
ClosedStatus
Thread
ThreadItemBase
UserMessageItem
AssistantMessageItem
Bases: ThreadItemBase
Thread item representing an assistant message.
Source code in chatkit/types.py
ClientToolCallItem
WidgetItem
TaskItem
WorkflowItem
EndOfTurnItem
Bases: ThreadItemBase
Marker item indicating the assistant ends its turn.
Source code in chatkit/types.py
HiddenContextItem
Bases: ThreadItemBase
HiddenContext is never sent to the client. It's not officially part of ChatKit. It is only used internally to store additional context in a specific place in the thread.
Source code in chatkit/types.py
AssistantMessageContent
Bases: BaseModel
Assistant message content consisting of text and annotations.
Source code in chatkit/types.py
Annotation
Bases: BaseModel
Reference to supporting context attached to assistant output.
Source code in chatkit/types.py
UserMessageInput
Bases: BaseModel
Payload describing a user message submission.
Source code in chatkit/types.py
UserMessageTextContent
UserMessageTagContent
Bases: BaseModel
User message content representing an interactive tag.
Source code in chatkit/types.py
InferenceOptions
ToolChoice
AttachmentBase
Bases: BaseModel
Base metadata shared by all attachments.
Source code in chatkit/types.py
FileAttachment
ImageAttachment
Workflow
Bases: BaseModel
Workflow attached to a thread with optional summary.
Source code in chatkit/types.py
CustomSummary
DurationSummary
Bases: BaseModel
Summary providing total workflow duration.
Source code in chatkit/types.py
BaseTask
Bases: BaseModel
Base fields common to all workflow tasks.
Source code in chatkit/types.py
CustomTask
SearchTask
ThoughtTask
FileTask
ImageTask
SourceBase
FileSource
URLSource
EntitySource
is_streaming_req
is_streaming_req(
request: ChatKitReq,
) -> TypeIs[StreamingReq]
Return True if the given request should be processed as streaming.