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
| StreamOptionsEvent
| ProgressUpdateEvent
| ClientEffectEvent
| 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
| GeneratedImageUpdated
)
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
| GeneratedImageItem
| WorkflowItem
| TaskItem
| HiddenContextItem
| SDKHiddenContextItem
| 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
FeedbackKind = Literal['positive', 'negative']
Literal type for feedback sentiment.
Page
Bases: BaseModel, Generic[T]
Paginated collection of records returned from the API.
Source code in chatkit/types.py
18 19 20 21 22 23 | |
BaseReq
Bases: BaseModel
Base class for all request payloads.
Source code in chatkit/types.py
29 30 31 32 33 | |
metadata
class-attribute
instance-attribute
metadata: dict[str, Any] = Field(default_factory=dict)
Arbitrary integration-specific metadata.
ThreadsGetByIdReq
Bases: BaseReq
Request to fetch a single thread by its identifier.
Source code in chatkit/types.py
36 37 38 39 40 | |
ThreadGetByIdParams
Bases: BaseModel
Parameters for retrieving a thread by id.
Source code in chatkit/types.py
43 44 45 46 | |
ThreadsCreateReq
Bases: BaseReq
Request to create a new thread from a user message.
Source code in chatkit/types.py
49 50 51 52 53 | |
ThreadCreateParams
Bases: BaseModel
User input required to create a thread.
Source code in chatkit/types.py
56 57 58 59 | |
ThreadListParams
Bases: BaseModel
Pagination parameters for listing threads.
Source code in chatkit/types.py
62 63 64 65 66 67 | |
ThreadsListReq
Bases: BaseReq
Request to list threads.
Source code in chatkit/types.py
70 71 72 73 74 | |
ThreadsAddUserMessageReq
Bases: BaseReq
Request to append a user message to a thread.
Source code in chatkit/types.py
77 78 79 80 81 | |
ThreadAddUserMessageParams
Bases: BaseModel
Parameters for adding a user message to a thread.
Source code in chatkit/types.py
84 85 86 87 88 | |
ThreadsAddClientToolOutputReq
Bases: BaseReq
Request to add a client tool's output to a thread.
Source code in chatkit/types.py
91 92 93 94 95 | |
ThreadAddClientToolOutputParams
Bases: BaseModel
Parameters for recording tool output in a thread.
Source code in chatkit/types.py
98 99 100 101 102 | |
ThreadsCustomActionReq
Bases: BaseReq
Request to execute a custom action within a thread.
Source code in chatkit/types.py
105 106 107 108 109 | |
ThreadCustomActionParams
Bases: BaseModel
Parameters describing the custom action to execute.
Source code in chatkit/types.py
112 113 114 115 116 117 | |
ThreadsRetryAfterItemReq
Bases: BaseReq
Request to retry processing after a specific thread item.
Source code in chatkit/types.py
120 121 122 123 124 | |
ThreadRetryAfterItemParams
Bases: BaseModel
Parameters specifying which item to retry.
Source code in chatkit/types.py
127 128 129 130 131 | |
ItemsFeedbackReq
Bases: BaseReq
Request to submit feedback on specific items.
Source code in chatkit/types.py
134 135 136 137 138 | |
ItemFeedbackParams
Bases: BaseModel
Parameters describing feedback targets and sentiment.
Source code in chatkit/types.py
141 142 143 144 145 146 | |
AttachmentsDeleteReq
Bases: BaseReq
Request to remove an attachment.
Source code in chatkit/types.py
149 150 151 152 153 | |
AttachmentDeleteParams
Bases: BaseModel
Parameters identifying an attachment to delete.
Source code in chatkit/types.py
156 157 158 159 | |
AttachmentsCreateReq
Bases: BaseReq
Request to register a new attachment.
Source code in chatkit/types.py
162 163 164 165 166 | |
AttachmentCreateParams
Bases: BaseModel
Metadata needed to initialize an attachment.
Source code in chatkit/types.py
169 170 171 172 173 174 | |
ItemsListReq
Bases: BaseReq
Request to list items inside a thread.
Source code in chatkit/types.py
177 178 179 180 181 | |
ItemsListParams
Bases: BaseModel
Pagination parameters for listing thread items.
Source code in chatkit/types.py
184 185 186 187 188 189 190 | |
ThreadsUpdateReq
Bases: BaseReq
Request to update thread metadata.
Source code in chatkit/types.py
193 194 195 196 197 | |
ThreadUpdateParams
Bases: BaseModel
Parameters for updating a thread's properties.
Source code in chatkit/types.py
200 201 202 203 204 | |
ThreadsDeleteReq
Bases: BaseReq
Request to delete a thread.
Source code in chatkit/types.py
207 208 209 210 211 | |
ThreadDeleteParams
Bases: BaseModel
Parameters identifying a thread to delete.
Source code in chatkit/types.py
214 215 216 217 | |
ThreadCreatedEvent
Bases: BaseModel
Event emitted when a thread is created.
Source code in chatkit/types.py
266 267 268 269 270 | |
ThreadUpdatedEvent
Bases: BaseModel
Event emitted when a thread is updated.
Source code in chatkit/types.py
273 274 275 276 277 | |
ThreadItemAddedEvent
Bases: BaseModel
Event emitted when a new item is added to a thread.
Source code in chatkit/types.py
280 281 282 283 284 | |
ThreadItemUpdatedEvent
Bases: BaseModel
Event describing an update to an existing thread item.
Source code in chatkit/types.py
287 288 289 290 291 292 | |
ThreadItemDoneEvent
Bases: BaseModel
Event emitted when a thread item is marked complete.
Source code in chatkit/types.py
299 300 301 302 303 | |
ThreadItemRemovedEvent
Bases: BaseModel
Event emitted when a thread item is removed.
Source code in chatkit/types.py
306 307 308 309 310 | |
ThreadItemReplacedEvent
Bases: BaseModel
Event emitted when a thread item is replaced.
Source code in chatkit/types.py
313 314 315 316 317 | |
StreamOptions
Bases: BaseModel
Settings that control runtime stream behavior.
Source code in chatkit/types.py
320 321 322 323 324 | |
allow_cancel
instance-attribute
allow_cancel: bool
Allow the client to request cancellation mid-stream.
StreamOptionsEvent
Bases: BaseModel
Event emitted to set stream options at runtime.
Source code in chatkit/types.py
327 328 329 330 331 | |
ProgressUpdateEvent
Bases: BaseModel
Event providing incremental progress from the assistant.
Source code in chatkit/types.py
334 335 336 337 338 339 | |
ClientEffectEvent
Bases: BaseModel
Event emitted to trigger a client side-effect.
Source code in chatkit/types.py
342 343 344 345 346 347 | |
ErrorEvent
Bases: BaseModel
Event indicating an error occurred while processing a thread.
Source code in chatkit/types.py
350 351 352 353 354 355 356 | |
NoticeEvent
Bases: BaseModel
Event conveying a user-facing notice.
Source code in chatkit/types.py
359 360 361 362 363 364 365 366 367 368 | |
message
instance-attribute
message: str
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
391 392 393 394 395 396 397 398 | |
AssistantMessageContentPartTextDelta
Bases: BaseModel
Event carrying incremental assistant text output.
Source code in chatkit/types.py
401 402 403 404 405 406 407 408 | |
AssistantMessageContentPartAnnotationAdded
Bases: BaseModel
Event announcing a new annotation on assistant content.
Source code in chatkit/types.py
411 412 413 414 415 416 417 418 419 | |
AssistantMessageContentPartDone
Bases: BaseModel
Event indicating an assistant content part is finalized.
Source code in chatkit/types.py
422 423 424 425 426 427 428 429 | |
WidgetStreamingTextValueDelta
Bases: BaseModel
Event streaming widget text deltas.
Source code in chatkit/types.py
432 433 434 435 436 437 438 439 440 | |
WidgetRootUpdated
Bases: BaseModel
Event published when the widget root changes.
Source code in chatkit/types.py
443 444 445 446 447 | |
WidgetComponentUpdated
Bases: BaseModel
Event emitted when a widget component updates.
Source code in chatkit/types.py
450 451 452 453 454 455 | |
WorkflowTaskAdded
Bases: BaseModel
Event emitted when a workflow task is added.
Source code in chatkit/types.py
458 459 460 461 462 463 | |
WorkflowTaskUpdated
Bases: BaseModel
Event emitted when a workflow task is updated.
Source code in chatkit/types.py
466 467 468 469 470 471 | |
GeneratedImageUpdated
Bases: BaseModel
Event emitted when a generated image is updated.
Source code in chatkit/types.py
474 475 476 477 478 479 | |
ThreadMetadata
Bases: BaseModel
Metadata describing a thread without its items.
Source code in chatkit/types.py
500 501 502 503 504 505 506 507 508 | |
ActiveStatus
Bases: BaseModel
Status indicating the thread is active.
Source code in chatkit/types.py
511 512 513 514 | |
LockedStatus
Bases: BaseModel
Status indicating the thread is locked.
Source code in chatkit/types.py
517 518 519 520 521 | |
ClosedStatus
Bases: BaseModel
Status indicating the thread is closed.
Source code in chatkit/types.py
524 525 526 527 528 | |
Thread
Bases: ThreadMetadata
Thread with its paginated items.
Source code in chatkit/types.py
538 539 540 541 | |
ThreadItemBase
Bases: BaseModel
Base fields shared by all thread items.
Source code in chatkit/types.py
547 548 549 550 551 552 | |
UserMessageItem
Bases: ThreadItemBase
Thread item representing a user message.
Source code in chatkit/types.py
555 556 557 558 559 560 561 562 | |
AssistantMessageItem
Bases: ThreadItemBase
Thread item representing an assistant message.
Source code in chatkit/types.py
565 566 567 568 569 | |
ClientToolCallItem
Bases: ThreadItemBase
Thread item capturing a client tool call.
Source code in chatkit/types.py
572 573 574 575 576 577 578 579 580 | |
WidgetItem
Bases: ThreadItemBase
Thread item containing widget content.
Source code in chatkit/types.py
583 584 585 586 587 588 | |
GeneratedImage
Bases: BaseModel
Generated image.
Source code in chatkit/types.py
591 592 593 594 595 | |
GeneratedImageItem
Bases: ThreadItemBase
Thread item containing a generated image.
Source code in chatkit/types.py
598 599 600 601 602 | |
TaskItem
Bases: ThreadItemBase
Thread item containing a task.
Source code in chatkit/types.py
605 606 607 608 609 | |
WorkflowItem
Bases: ThreadItemBase
Thread item representing a workflow.
Source code in chatkit/types.py
612 613 614 615 616 | |
EndOfTurnItem
Bases: ThreadItemBase
Marker item indicating the assistant ends its turn.
Source code in chatkit/types.py
619 620 621 622 | |
HiddenContextItem
Bases: ThreadItemBase
HiddenContext is never sent to the client. It's not officially part of ChatKit.js. It is only used internally to store additional context in a specific place in the thread.
Source code in chatkit/types.py
625 626 627 628 629 630 631 632 | |
SDKHiddenContextItem
Bases: ThreadItemBase
Hidden context that is used by the ChatKit Python SDK for storing additional context for internal operations.
Source code in chatkit/types.py
635 636 637 638 639 640 641 642 | |
AssistantMessageContent
Bases: BaseModel
Assistant message content consisting of text and annotations.
Source code in chatkit/types.py
664 665 666 667 668 669 | |
Annotation
Bases: BaseModel
Reference to supporting context attached to assistant output.
Source code in chatkit/types.py
672 673 674 675 676 677 | |
UserMessageInput
Bases: BaseModel
Payload describing a user message submission.
Source code in chatkit/types.py
683 684 685 686 687 688 689 | |
UserMessageTextContent
Bases: BaseModel
User message content containing plaintext.
Source code in chatkit/types.py
692 693 694 695 696 | |
UserMessageTagContent
Bases: BaseModel
User message content representing an interactive tag.
Source code in chatkit/types.py
699 700 701 702 703 704 705 706 707 | |
InferenceOptions
Bases: BaseModel
Model and tool configuration for message processing.
Source code in chatkit/types.py
716 717 718 719 720 | |
ToolChoice
Bases: BaseModel
Explicit tool selection for the assistant to invoke.
Source code in chatkit/types.py
723 724 725 726 | |
AttachmentBase
Bases: BaseModel
Base metadata shared by all attachments.
Source code in chatkit/types.py
729 730 731 732 733 734 735 736 737 738 739 | |
upload_url
class-attribute
instance-attribute
upload_url: AnyUrl | None = None
The URL to upload the file, used for two-phase upload. Should be set to None after upload is complete or when using direct upload where uploading happens when creating the attachment object.
FileAttachment
Bases: AttachmentBase
Attachment representing a generic file.
Source code in chatkit/types.py
742 743 744 745 | |
ImageAttachment
Bases: AttachmentBase
Attachment representing an image resource.
Source code in chatkit/types.py
748 749 750 751 752 | |
Workflow
Bases: BaseModel
Workflow attached to a thread with optional summary.
Source code in chatkit/types.py
765 766 767 768 769 770 771 | |
CustomSummary
Bases: BaseModel
Custom summary for a workflow.
Source code in chatkit/types.py
774 775 776 777 778 | |
DurationSummary
Bases: BaseModel
Summary providing total workflow duration.
Source code in chatkit/types.py
781 782 783 784 785 | |
duration
instance-attribute
duration: int
The duration of the workflow in seconds
BaseTask
Bases: BaseModel
Base fields common to all workflow tasks.
Source code in chatkit/types.py
794 795 796 797 798 | |
status_indicator
class-attribute
instance-attribute
status_indicator: Literal["none", "loading", "complete"] = (
"none"
)
Only used when rendering the task as part of a workflow. Indicates the status of the task.
CustomTask
Bases: BaseTask
Workflow task displaying custom content.
Source code in chatkit/types.py
801 802 803 804 805 806 807 | |
SearchTask
Bases: BaseTask
Workflow task representing a web search.
Source code in chatkit/types.py
810 811 812 813 814 815 816 817 | |
ThoughtTask
Bases: BaseTask
Workflow task capturing assistant reasoning.
Source code in chatkit/types.py
820 821 822 823 824 825 | |
FileTask
Bases: BaseTask
Workflow task referencing file sources.
Source code in chatkit/types.py
828 829 830 831 832 833 | |
ImageTask
Bases: BaseTask
Workflow task rendering image content.
Source code in chatkit/types.py
836 837 838 839 840 | |
SourceBase
Bases: BaseModel
Base class for sources displayed to users.
Source code in chatkit/types.py
853 854 855 856 857 858 859 | |
FileSource
Bases: SourceBase
Source metadata for file-based references.
Source code in chatkit/types.py
862 863 864 865 866 | |
URLSource
Bases: SourceBase
Source metadata for external URLs.
Source code in chatkit/types.py
869 870 871 872 873 874 | |
EntitySource
Bases: SourceBase
Source metadata for entity references.
Source code in chatkit/types.py
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
label
class-attribute
instance-attribute
label: str | None = None
Optional label shown with the icon in the default entity hover header when no preview callback is provided.
inline_label
class-attribute
instance-attribute
inline_label: str | None = None
Optional label for the inline annotation view. When not provided, the icon is used instead.
interactive
class-attribute
instance-attribute
interactive: bool = False
Per-entity toggle to wire client callbacks and render this entity as interactive.
data
class-attribute
instance-attribute
data: dict[str, Any] = Field(default_factory=dict)
Additional data for the entity source that is passed to client entity callbacks.
is_streaming_req
is_streaming_req(
request: ChatKitReq,
) -> TypeIs[StreamingReq]
Return True if the given request should be processed as streaming.
Source code in chatkit/types.py
249 250 251 252 253 254 255 256 257 258 259 260 | |