types
StreamingReq
module-attribute
StreamingReq = (
ThreadsCreateReq
| ThreadsAddUserMessageReq
| ThreadsAddClientToolOutputReq
| ThreadsAddStructuredInputReq
| ThreadsRetryAfterItemReq
| ThreadsCustomActionReq
)
Union of request types that produce streaming responses.
NonStreamingReq
module-attribute
NonStreamingReq = (
ThreadsGetByIdReq
| ThreadsListReq
| ItemsListReq
| ItemsFeedbackReq
| AttachmentsCreateReq
| AttachmentsDeleteReq
| ThreadsUpdateReq
| ThreadsDeleteReq
| InputTranscribeReq
| ThreadsSyncCustomActionReq
)
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.
StructuredInput
module-attribute
StructuredInput = Annotated[
StructuredInputMultipleChoice | StructuredInputFreeform,
Field(discriminator="type"),
]
Structured input variants supported by a structured input item.
ThreadItem
module-attribute
ThreadItem = Annotated[
UserMessageItem
| AssistantMessageItem
| ClientToolCallItem
| WidgetItem
| GeneratedImageItem
| StructuredInputItem
| 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
24 25 26 27 28 29 | |
BaseReq
Bases: BaseModel
Base class for all request payloads.
Source code in chatkit/types.py
35 36 37 38 39 | |
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
42 43 44 45 46 | |
ThreadGetByIdParams
Bases: BaseModel
Parameters for retrieving a thread by id.
Source code in chatkit/types.py
49 50 51 52 | |
ThreadsCreateReq
Bases: BaseReq
Request to create a new thread from a user message.
Source code in chatkit/types.py
55 56 57 58 59 | |
ThreadCreateParams
Bases: BaseModel
User input required to create a thread.
Source code in chatkit/types.py
62 63 64 65 | |
ThreadListParams
Bases: BaseModel
Pagination parameters for listing threads.
Source code in chatkit/types.py
68 69 70 71 72 73 | |
ThreadsListReq
Bases: BaseReq
Request to list threads.
Source code in chatkit/types.py
76 77 78 79 80 | |
ThreadsAddUserMessageReq
Bases: BaseReq
Request to append a user message to a thread.
Source code in chatkit/types.py
83 84 85 86 87 | |
ThreadAddUserMessageParams
Bases: BaseModel
Parameters for adding a user message to a thread.
Source code in chatkit/types.py
90 91 92 93 94 | |
ThreadsAddClientToolOutputReq
Bases: BaseReq
Request to add a client tool's output to a thread.
Source code in chatkit/types.py
97 98 99 100 101 | |
ThreadAddClientToolOutputParams
Bases: BaseModel
Parameters for recording tool output in a thread.
Source code in chatkit/types.py
104 105 106 107 108 | |
StructuredInputAnswerSubmission
Bases: BaseModel
Client-submitted answer for a structured input.
Source code in chatkit/types.py
111 112 113 114 115 116 117 | |
values
class-attribute
instance-attribute
values: list[str] = Field(default_factory=list)
Text answer values submitted for the structured input.
skipped
class-attribute
instance-attribute
skipped: bool = False
Whether this structured input answer was skipped.
StructuredInputSubmission
Bases: BaseModel
Client-submitted answers for a pending structured input item.
Source code in chatkit/types.py
120 121 122 123 124 125 126 | |
status
class-attribute
instance-attribute
status: Literal['answered', 'skipped'] = 'answered'
Overall status for the structured input submission.
answers
class-attribute
instance-attribute
answers: dict[str, StructuredInputAnswerSubmission] = Field(
default_factory=dict
)
Answers keyed by structured input id.
ThreadsAddStructuredInputReq
Bases: BaseReq
Request to submit answers for a pending structured input item.
Source code in chatkit/types.py
129 130 131 132 133 | |
ThreadAddStructuredInputParams
Bases: BaseModel
Parameters for adding structured input to a thread.
Source code in chatkit/types.py
136 137 138 139 140 141 | |
ThreadsCustomActionReq
Bases: BaseReq
Request to execute a custom action within a thread.
Source code in chatkit/types.py
144 145 146 147 148 | |
ThreadsSyncCustomActionReq
Bases: BaseReq
Request to execute a custom action and return a single item update.
Source code in chatkit/types.py
151 152 153 154 155 | |
ThreadCustomActionParams
Bases: BaseModel
Parameters describing the custom action to execute.
Source code in chatkit/types.py
158 159 160 161 162 163 | |
ThreadsRetryAfterItemReq
Bases: BaseReq
Request to retry processing after a specific thread item.
Source code in chatkit/types.py
166 167 168 169 170 | |
ThreadRetryAfterItemParams
Bases: BaseModel
Parameters specifying which item to retry.
Source code in chatkit/types.py
173 174 175 176 177 | |
ItemsFeedbackReq
Bases: BaseReq
Request to submit feedback on specific items.
Source code in chatkit/types.py
180 181 182 183 184 | |
ItemFeedbackParams
Bases: BaseModel
Parameters describing feedback targets and sentiment.
Source code in chatkit/types.py
187 188 189 190 191 192 | |
AttachmentsDeleteReq
Bases: BaseReq
Request to remove an attachment.
Source code in chatkit/types.py
195 196 197 198 199 | |
AttachmentDeleteParams
Bases: BaseModel
Parameters identifying an attachment to delete.
Source code in chatkit/types.py
202 203 204 205 | |
AttachmentsCreateReq
Bases: BaseReq
Request to register a new attachment.
Source code in chatkit/types.py
208 209 210 211 212 | |
AttachmentCreateParams
Bases: BaseModel
Metadata needed to initialize an attachment.
Source code in chatkit/types.py
215 216 217 218 219 220 | |
InputTranscribeReq
Bases: BaseReq
Request to transcribe an audio payload into text.
Source code in chatkit/types.py
223 224 225 226 227 | |
InputTranscribeParams
Bases: BaseModel
Parameters for speech transcription.
Source code in chatkit/types.py
230 231 232 233 234 235 236 237 | |
audio_base64
instance-attribute
audio_base64: str
Base64-encoded audio bytes.
mime_type
instance-attribute
mime_type: str
Raw MIME type for the audio payload, e.g. "audio/webm;codecs=opus".
AudioInput
Bases: BaseModel
Audio input data for transcription.
Source code in chatkit/types.py
240 241 242 243 244 245 246 247 248 249 250 251 252 | |
data
instance-attribute
data: bytes
Audio data bytes.
mime_type
instance-attribute
mime_type: str
Raw MIME type for the audio payload, e.g. "audio/webm;codecs=opus".
media_type
property
media_type: str
Media type for the audio payload, e.g. "audio/webm".
TranscriptionResult
Bases: BaseModel
Input speech transcription result.
Source code in chatkit/types.py
255 256 257 258 | |
ItemsListReq
Bases: BaseReq
Request to list items inside a thread.
Source code in chatkit/types.py
261 262 263 264 265 | |
ItemsListParams
Bases: BaseModel
Pagination parameters for listing thread items.
Source code in chatkit/types.py
268 269 270 271 272 273 274 | |
ThreadsUpdateReq
Bases: BaseReq
Request to update thread metadata.
Source code in chatkit/types.py
277 278 279 280 281 | |
ThreadUpdateParams
Bases: BaseModel
Parameters for updating a thread's properties.
Source code in chatkit/types.py
284 285 286 287 288 | |
ThreadsDeleteReq
Bases: BaseReq
Request to delete a thread.
Source code in chatkit/types.py
291 292 293 294 295 | |
ThreadDeleteParams
Bases: BaseModel
Parameters identifying a thread to delete.
Source code in chatkit/types.py
298 299 300 301 | |
ThreadCreatedEvent
Bases: BaseModel
Event emitted when a thread is created.
Source code in chatkit/types.py
354 355 356 357 358 | |
ThreadUpdatedEvent
Bases: BaseModel
Event emitted when a thread is updated.
Source code in chatkit/types.py
361 362 363 364 365 | |
ThreadItemAddedEvent
Bases: BaseModel
Event emitted when a new item is added to a thread.
Source code in chatkit/types.py
368 369 370 371 372 | |
ThreadItemUpdatedEvent
Bases: BaseModel
Event describing an update to an existing thread item.
Source code in chatkit/types.py
375 376 377 378 379 380 | |
ThreadItemDoneEvent
Bases: BaseModel
Event emitted when a thread item is marked complete.
Source code in chatkit/types.py
387 388 389 390 391 | |
ThreadItemRemovedEvent
Bases: BaseModel
Event emitted when a thread item is removed.
Source code in chatkit/types.py
394 395 396 397 398 | |
ThreadItemReplacedEvent
Bases: BaseModel
Event emitted when a thread item is replaced.
Source code in chatkit/types.py
401 402 403 404 405 | |
StreamOptions
Bases: BaseModel
Settings that control runtime stream behavior.
Source code in chatkit/types.py
408 409 410 411 412 | |
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
415 416 417 418 419 | |
ProgressUpdateEvent
Bases: BaseModel
Event providing incremental progress from the assistant.
Source code in chatkit/types.py
422 423 424 425 426 427 | |
ClientEffectEvent
Bases: BaseModel
Event emitted to trigger a client side-effect.
Source code in chatkit/types.py
430 431 432 433 434 435 | |
ErrorEvent
Bases: BaseModel
Event indicating an error occurred while processing a thread.
Source code in chatkit/types.py
438 439 440 441 442 443 444 | |
NoticeEvent
Bases: BaseModel
Event conveying a user-facing notice.
Source code in chatkit/types.py
447 448 449 450 451 452 453 454 455 456 | |
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
479 480 481 482 483 484 485 486 | |
AssistantMessageContentPartTextDelta
Bases: BaseModel
Event carrying incremental assistant text output.
Source code in chatkit/types.py
489 490 491 492 493 494 495 496 | |
AssistantMessageContentPartAnnotationAdded
Bases: BaseModel
Event announcing a new annotation on assistant content.
Source code in chatkit/types.py
499 500 501 502 503 504 505 506 507 | |
AssistantMessageContentPartDone
Bases: BaseModel
Event indicating an assistant content part is finalized.
Source code in chatkit/types.py
510 511 512 513 514 515 516 517 | |
WidgetStreamingTextValueDelta
Bases: BaseModel
Event streaming widget text deltas.
Source code in chatkit/types.py
520 521 522 523 524 525 526 527 528 | |
WidgetRootUpdated
Bases: BaseModel
Event published when the widget root changes.
Source code in chatkit/types.py
531 532 533 534 535 | |
WidgetComponentUpdated
Bases: BaseModel
Event emitted when a widget component updates.
Source code in chatkit/types.py
538 539 540 541 542 543 | |
WorkflowTaskAdded
Bases: BaseModel
Event emitted when a workflow task is added.
Source code in chatkit/types.py
546 547 548 549 550 551 | |
WorkflowTaskUpdated
Bases: BaseModel
Event emitted when a workflow task is updated.
Source code in chatkit/types.py
554 555 556 557 558 559 | |
GeneratedImageUpdated
Bases: BaseModel
Event emitted when a generated image is updated.
Source code in chatkit/types.py
562 563 564 565 566 567 | |
SyncCustomActionResponse
Bases: BaseModel
Single thread item update returned by a sync custom action.
Source code in chatkit/types.py
585 586 587 | |
ThreadMetadata
Bases: BaseModel
Metadata describing a thread without its items.
Source code in chatkit/types.py
593 594 595 596 597 598 599 600 601 | |
ActiveStatus
Bases: BaseModel
Status indicating the thread is active.
Source code in chatkit/types.py
604 605 606 607 | |
LockedStatus
Bases: BaseModel
Status indicating the thread is locked.
Source code in chatkit/types.py
610 611 612 613 614 | |
ClosedStatus
Bases: BaseModel
Status indicating the thread is closed.
Source code in chatkit/types.py
617 618 619 620 621 | |
Thread
Bases: ThreadMetadata
Thread with its paginated items.
Source code in chatkit/types.py
631 632 633 634 | |
ThreadItemBase
Bases: BaseModel
Base fields shared by all thread items.
Source code in chatkit/types.py
640 641 642 643 644 645 | |
UserMessageItem
Bases: ThreadItemBase
Thread item representing a user message.
Source code in chatkit/types.py
648 649 650 651 652 653 654 655 | |
AssistantMessageItem
Bases: ThreadItemBase
Thread item representing an assistant message.
Source code in chatkit/types.py
658 659 660 661 662 | |
ClientToolCallItem
Bases: ThreadItemBase
Thread item capturing a client tool call.
Source code in chatkit/types.py
665 666 667 668 669 670 671 672 673 | |
WidgetItem
Bases: ThreadItemBase
Thread item containing widget content.
Source code in chatkit/types.py
676 677 678 679 680 681 | |
GeneratedImage
Bases: BaseModel
Generated image.
Source code in chatkit/types.py
684 685 686 687 688 | |
GeneratedImageItem
Bases: ThreadItemBase
Thread item containing a generated image.
Source code in chatkit/types.py
691 692 693 694 695 | |
StructuredInputAnswer
Bases: BaseModel
Answer recorded for a structured input.
Source code in chatkit/types.py
698 699 700 701 702 703 704 | |
values
class-attribute
instance-attribute
values: list[str] = Field(default_factory=list)
Text answer values recorded for the structured input.
skipped
class-attribute
instance-attribute
skipped: bool = False
Whether this structured input answer was skipped.
StructuredInputBase
Bases: BaseModel
Base fields shared by structured inputs.
Source code in chatkit/types.py
707 708 709 710 711 712 713 714 715 | |
id
instance-attribute
id: str
Stable id for this structured input.
question
instance-attribute
question: str
Question shown to the user.
answer
class-attribute
instance-attribute
answer: StructuredInputAnswer | None = None
Answer recorded for this structured input, if available.
StructuredInputMultipleChoiceOption
Bases: BaseModel
Option shown for a multiple-choice structured input.
Source code in chatkit/types.py
718 719 720 721 722 | |
value
instance-attribute
value: str
Text value submitted when this option is selected.
StructuredInputMultipleChoice
Bases: StructuredInputBase
Structured input answered by choosing one or more options.
Source code in chatkit/types.py
725 726 727 728 729 730 731 732 | |
options
instance-attribute
options: list[StructuredInputMultipleChoiceOption]
Suggested choices to display before the freeform custom answer affordance.
multiple
class-attribute
instance-attribute
multiple: bool = False
Whether the user may submit more than one text value.
StructuredInputFreeform
Bases: StructuredInputBase
Structured input answered with freeform text.
Source code in chatkit/types.py
735 736 737 738 739 740 | |
description
class-attribute
instance-attribute
description: str | None = None
Supporting text shown with this input.
StructuredInputItem
Bases: ThreadItemBase
Thread item requesting structured input from the user.
Source code in chatkit/types.py
750 751 752 753 754 755 | |
TaskItem
Bases: ThreadItemBase
Thread item containing a task.
Source code in chatkit/types.py
758 759 760 761 762 | |
WorkflowItem
Bases: ThreadItemBase
Thread item representing a workflow.
Source code in chatkit/types.py
765 766 767 768 769 | |
EndOfTurnItem
Bases: ThreadItemBase
Marker item indicating the assistant ends its turn.
Source code in chatkit/types.py
772 773 774 775 | |
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
778 779 780 781 782 783 784 785 | |
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
788 789 790 791 792 793 794 795 | |
AssistantMessageContent
Bases: BaseModel
Assistant message content consisting of text and annotations.
Source code in chatkit/types.py
818 819 820 821 822 823 | |
Annotation
Bases: BaseModel
Reference to supporting context attached to assistant output.
Source code in chatkit/types.py
826 827 828 829 830 831 | |
UserMessageInput
Bases: BaseModel
Payload describing a user message submission.
Source code in chatkit/types.py
837 838 839 840 841 842 843 | |
UserMessageTextContent
Bases: BaseModel
User message content containing plaintext.
Source code in chatkit/types.py
846 847 848 849 850 | |
UserMessageTagContent
Bases: BaseModel
User message content representing an interactive tag.
Source code in chatkit/types.py
853 854 855 856 857 858 859 860 861 | |
InferenceOptions
Bases: BaseModel
Model and tool configuration for message processing.
Source code in chatkit/types.py
870 871 872 873 874 | |
ToolChoice
Bases: BaseModel
Explicit tool selection for the assistant to invoke.
Source code in chatkit/types.py
877 878 879 880 | |
AttachmentUploadDescriptor
Bases: BaseModel
Two-phase upload instructions.
Source code in chatkit/types.py
883 884 885 886 887 888 889 890 | |
method
instance-attribute
method: Literal['POST', 'PUT']
The HTTP method to use when uploading the file for two-phase upload.
headers
class-attribute
instance-attribute
headers: dict[str, str] = Field(default_factory=dict)
Optional headers to include in the upload request.
AttachmentBase
Bases: BaseModel
Base metadata shared by all attachments.
Source code in chatkit/types.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | |
upload_descriptor
class-attribute
instance-attribute
upload_descriptor: AttachmentUploadDescriptor | None = None
Two-phase upload instructions. Should be set to None after upload is complete or when using direct upload where uploading happens when creating the attachment object.
thread_id
class-attribute
instance-attribute
thread_id: str | None = None
The thread the attachment belongs to, if any. Added when the user message that contains the attachment is saved to store.
metadata
class-attribute
instance-attribute
metadata: dict[str, Any] | None = None
Integration-only metadata stored with the attachment. Ignored by ChatKit and not returned in ChatKitServer responses. If you serialize attachments from a custom direct-upload endpoint and want to omit this field, pass context={"exclude_metadata": True}.
FileAttachment
Bases: AttachmentBase
Attachment representing a generic file.
Source code in chatkit/types.py
925 926 927 928 | |
ImageAttachment
Bases: AttachmentBase
Attachment representing an image resource.
Source code in chatkit/types.py
931 932 933 934 935 | |
Workflow
Bases: BaseModel
Workflow attached to a thread with optional summary.
Source code in chatkit/types.py
948 949 950 951 952 953 954 | |
CustomSummary
Bases: BaseModel
Custom summary for a workflow.
Source code in chatkit/types.py
957 958 959 960 961 | |
DurationSummary
Bases: BaseModel
Summary providing total workflow duration.
Source code in chatkit/types.py
964 965 966 967 968 | |
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
977 978 979 980 981 | |
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
984 985 986 987 988 989 990 | |
SearchTask
Bases: BaseTask
Workflow task representing a web search.
Source code in chatkit/types.py
993 994 995 996 997 998 999 1000 | |
ThoughtTask
Bases: BaseTask
Workflow task capturing assistant reasoning.
Source code in chatkit/types.py
1003 1004 1005 1006 1007 1008 | |
FileTask
Bases: BaseTask
Workflow task referencing file sources.
Source code in chatkit/types.py
1011 1012 1013 1014 1015 1016 | |
ImageTask
Bases: BaseTask
Workflow task rendering image content.
Source code in chatkit/types.py
1019 1020 1021 1022 1023 | |
SourceBase
Bases: BaseModel
Base class for sources displayed to users.
Source code in chatkit/types.py
1036 1037 1038 1039 1040 1041 1042 | |
FileSource
Bases: SourceBase
Source metadata for file-based references.
Source code in chatkit/types.py
1045 1046 1047 1048 1049 | |
URLSource
Bases: SourceBase
Source metadata for external URLs.
Source code in chatkit/types.py
1052 1053 1054 1055 1056 1057 | |
EntitySource
Bases: SourceBase
Source metadata for entity references.
Source code in chatkit/types.py
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | |
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
336 337 338 339 340 341 342 343 344 345 346 347 348 | |