go/resources/beta/subresources/chatkit/index.md +0 −2700 deleted
File Deleted View Diff
1# ChatKit
2
3## Domain Types
4
5### ChatKit Workflow
6
7- `type ChatKitWorkflow struct{…}`
8
9 Workflow metadata and state returned for the session.
10
11 - `ID string`
12
13 Identifier of the workflow backing the session.
14
15 - `StateVariables map[string, ChatKitWorkflowStateVariableUnion]`
16
17 State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.
18
19 - `string`
20
21 - `bool`
22
23 - `float64`
24
25 - `Tracing ChatKitWorkflowTracing`
26
27 Tracing settings applied to the workflow.
28
29 - `Enabled bool`
30
31 Indicates whether tracing is enabled.
32
33 - `Version string`
34
35 Specific workflow version used for the session. Defaults to null when using the latest deployment.
36
37# Sessions
38
39## Cancel chat session
40
41`client.Beta.ChatKit.Sessions.Cancel(ctx, sessionID) (*ChatSession, error)`
42
43**post** `/chatkit/sessions/{session_id}/cancel`
44
45Cancel an active ChatKit session and return its most recent metadata.
46
47Cancelling prevents new requests from using the issued client secret.
48
49### Parameters
50
51- `sessionID string`
52
53### Returns
54
55- `type ChatSession struct{…}`
56
57 Represents a ChatKit session and its resolved configuration.
58
59 - `ID string`
60
61 Identifier for the ChatKit session.
62
63 - `ChatKitConfiguration ChatSessionChatKitConfiguration`
64
65 Resolved ChatKit feature configuration for the session.
66
67 - `AutomaticThreadTitling ChatSessionAutomaticThreadTitling`
68
69 Automatic thread titling preferences.
70
71 - `Enabled bool`
72
73 Whether automatic thread titling is enabled.
74
75 - `FileUpload ChatSessionFileUpload`
76
77 Upload settings for the session.
78
79 - `Enabled bool`
80
81 Indicates if uploads are enabled for the session.
82
83 - `MaxFileSize int64`
84
85 Maximum upload size in megabytes.
86
87 - `MaxFiles int64`
88
89 Maximum number of uploads allowed during the session.
90
91 - `History ChatSessionHistory`
92
93 History retention configuration.
94
95 - `Enabled bool`
96
97 Indicates if chat history is persisted for the session.
98
99 - `RecentThreads int64`
100
101 Number of prior threads surfaced in history views. Defaults to null when all history is retained.
102
103 - `ClientSecret string`
104
105 Ephemeral client secret that authenticates session requests.
106
107 - `ExpiresAt int64`
108
109 Unix timestamp (in seconds) for when the session expires.
110
111 - `MaxRequestsPer1Minute int64`
112
113 Convenience copy of the per-minute request limit.
114
115 - `Object ChatKitSession`
116
117 Type discriminator that is always `chatkit.session`.
118
119 - `const ChatKitSessionChatKitSession ChatKitSession = "chatkit.session"`
120
121 - `RateLimits ChatSessionRateLimits`
122
123 Resolved rate limit values.
124
125 - `MaxRequestsPer1Minute int64`
126
127 Maximum allowed requests per one-minute window.
128
129 - `Status ChatSessionStatus`
130
131 Current lifecycle state of the session.
132
133 - `const ChatSessionStatusActive ChatSessionStatus = "active"`
134
135 - `const ChatSessionStatusExpired ChatSessionStatus = "expired"`
136
137 - `const ChatSessionStatusCancelled ChatSessionStatus = "cancelled"`
138
139 - `User string`
140
141 User identifier associated with the session.
142
143 - `Workflow ChatKitWorkflow`
144
145 Workflow metadata for the session.
146
147 - `ID string`
148
149 Identifier of the workflow backing the session.
150
151 - `StateVariables map[string, ChatKitWorkflowStateVariableUnion]`
152
153 State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.
154
155 - `string`
156
157 - `bool`
158
159 - `float64`
160
161 - `Tracing ChatKitWorkflowTracing`
162
163 Tracing settings applied to the workflow.
164
165 - `Enabled bool`
166
167 Indicates whether tracing is enabled.
168
169 - `Version string`
170
171 Specific workflow version used for the session. Defaults to null when using the latest deployment.
172
173### Example
174
175```go
176package main
177
178import (
179 "context"
180 "fmt"
181
182 "github.com/openai/openai-go"
183 "github.com/openai/openai-go/option"
184)
185
186func main() {
187 client := openai.NewClient(
188 option.WithAPIKey("My API Key"),
189 )
190 chatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), "cksess_123")
191 if err != nil {
192 panic(err.Error())
193 }
194 fmt.Printf("%+v\n", chatSession.ID)
195}
196```
197
198#### Response
199
200```json
201{
202 "id": "id",
203 "chatkit_configuration": {
204 "automatic_thread_titling": {
205 "enabled": true
206 },
207 "file_upload": {
208 "enabled": true,
209 "max_file_size": 0,
210 "max_files": 0
211 },
212 "history": {
213 "enabled": true,
214 "recent_threads": 0
215 }
216 },
217 "client_secret": "client_secret",
218 "expires_at": 0,
219 "max_requests_per_1_minute": 0,
220 "object": "chatkit.session",
221 "rate_limits": {
222 "max_requests_per_1_minute": 0
223 },
224 "status": "active",
225 "user": "user",
226 "workflow": {
227 "id": "id",
228 "state_variables": {
229 "foo": "string"
230 },
231 "tracing": {
232 "enabled": true
233 },
234 "version": "version"
235 }
236}
237```
238
239### Example
240
241```go
242package main
243
244import (
245 "context"
246 "fmt"
247
248 "github.com/openai/openai-go"
249 "github.com/openai/openai-go/option"
250)
251
252func main() {
253 client := openai.NewClient()
254 chatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), "cksess_123")
255 if err != nil {
256 panic(err.Error())
257 }
258 fmt.Printf("%+v\n", chatSession.ID)
259}
260```
261
262#### Response
263
264```json
265{
266 "id": "cksess_123",
267 "object": "chatkit.session",
268 "workflow": {
269 "id": "workflow_alpha",
270 "version": "1"
271 },
272 "scope": {
273 "customer_id": "cust_456"
274 },
275 "max_requests_per_1_minute": 30,
276 "ttl_seconds": 900,
277 "status": "cancelled",
278 "cancelled_at": 1712345678
279}
280```
281
282## Create ChatKit session
283
284`client.Beta.ChatKit.Sessions.New(ctx, body) (*ChatSession, error)`
285
286**post** `/chatkit/sessions`
287
288Create a ChatKit session.
289
290### Parameters
291
292- `body BetaChatKitSessionNewParams`
293
294 - `User param.Field[string]`
295
296 A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope.
297
298 - `Workflow param.Field[ChatSessionWorkflowParamResp]`
299
300 Workflow that powers the session.
301
302 - `ChatKitConfiguration param.Field[ChatSessionChatKitConfigurationParamResp]`
303
304 Optional overrides for ChatKit runtime configuration features
305
306 - `ExpiresAfter param.Field[ChatSessionExpiresAfterParamResp]`
307
308 Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes.
309
310 - `RateLimits param.Field[ChatSessionRateLimitsParamResp]`
311
312 Optional override for per-minute request limits. When omitted, defaults to 10.
313
314### Returns
315
316- `type ChatSession struct{…}`
317
318 Represents a ChatKit session and its resolved configuration.
319
320 - `ID string`
321
322 Identifier for the ChatKit session.
323
324 - `ChatKitConfiguration ChatSessionChatKitConfiguration`
325
326 Resolved ChatKit feature configuration for the session.
327
328 - `AutomaticThreadTitling ChatSessionAutomaticThreadTitling`
329
330 Automatic thread titling preferences.
331
332 - `Enabled bool`
333
334 Whether automatic thread titling is enabled.
335
336 - `FileUpload ChatSessionFileUpload`
337
338 Upload settings for the session.
339
340 - `Enabled bool`
341
342 Indicates if uploads are enabled for the session.
343
344 - `MaxFileSize int64`
345
346 Maximum upload size in megabytes.
347
348 - `MaxFiles int64`
349
350 Maximum number of uploads allowed during the session.
351
352 - `History ChatSessionHistory`
353
354 History retention configuration.
355
356 - `Enabled bool`
357
358 Indicates if chat history is persisted for the session.
359
360 - `RecentThreads int64`
361
362 Number of prior threads surfaced in history views. Defaults to null when all history is retained.
363
364 - `ClientSecret string`
365
366 Ephemeral client secret that authenticates session requests.
367
368 - `ExpiresAt int64`
369
370 Unix timestamp (in seconds) for when the session expires.
371
372 - `MaxRequestsPer1Minute int64`
373
374 Convenience copy of the per-minute request limit.
375
376 - `Object ChatKitSession`
377
378 Type discriminator that is always `chatkit.session`.
379
380 - `const ChatKitSessionChatKitSession ChatKitSession = "chatkit.session"`
381
382 - `RateLimits ChatSessionRateLimits`
383
384 Resolved rate limit values.
385
386 - `MaxRequestsPer1Minute int64`
387
388 Maximum allowed requests per one-minute window.
389
390 - `Status ChatSessionStatus`
391
392 Current lifecycle state of the session.
393
394 - `const ChatSessionStatusActive ChatSessionStatus = "active"`
395
396 - `const ChatSessionStatusExpired ChatSessionStatus = "expired"`
397
398 - `const ChatSessionStatusCancelled ChatSessionStatus = "cancelled"`
399
400 - `User string`
401
402 User identifier associated with the session.
403
404 - `Workflow ChatKitWorkflow`
405
406 Workflow metadata for the session.
407
408 - `ID string`
409
410 Identifier of the workflow backing the session.
411
412 - `StateVariables map[string, ChatKitWorkflowStateVariableUnion]`
413
414 State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.
415
416 - `string`
417
418 - `bool`
419
420 - `float64`
421
422 - `Tracing ChatKitWorkflowTracing`
423
424 Tracing settings applied to the workflow.
425
426 - `Enabled bool`
427
428 Indicates whether tracing is enabled.
429
430 - `Version string`
431
432 Specific workflow version used for the session. Defaults to null when using the latest deployment.
433
434### Example
435
436```go
437package main
438
439import (
440 "context"
441 "fmt"
442
443 "github.com/openai/openai-go"
444 "github.com/openai/openai-go/option"
445)
446
447func main() {
448 client := openai.NewClient(
449 option.WithAPIKey("My API Key"),
450 )
451 chatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{
452 User: "x",
453 Workflow: openai.ChatSessionWorkflowParam{
454 ID: "id",
455 },
456 })
457 if err != nil {
458 panic(err.Error())
459 }
460 fmt.Printf("%+v\n", chatSession.ID)
461}
462```
463
464#### Response
465
466```json
467{
468 "id": "id",
469 "chatkit_configuration": {
470 "automatic_thread_titling": {
471 "enabled": true
472 },
473 "file_upload": {
474 "enabled": true,
475 "max_file_size": 0,
476 "max_files": 0
477 },
478 "history": {
479 "enabled": true,
480 "recent_threads": 0
481 }
482 },
483 "client_secret": "client_secret",
484 "expires_at": 0,
485 "max_requests_per_1_minute": 0,
486 "object": "chatkit.session",
487 "rate_limits": {
488 "max_requests_per_1_minute": 0
489 },
490 "status": "active",
491 "user": "user",
492 "workflow": {
493 "id": "id",
494 "state_variables": {
495 "foo": "string"
496 },
497 "tracing": {
498 "enabled": true
499 },
500 "version": "version"
501 }
502}
503```
504
505### Example
506
507```go
508package main
509
510import (
511 "context"
512 "fmt"
513
514 "github.com/openai/openai-go"
515 "github.com/openai/openai-go/option"
516)
517
518func main() {
519 client := openai.NewClient()
520 chatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{
521 User: "user",
522 Workflow: openai.ChatSessionWorkflowParam{
523 ID: "id",
524 },
525 })
526 if err != nil {
527 panic(err.Error())
528 }
529 fmt.Printf("%+v\n", chatSession.ID)
530}
531```
532
533#### Response
534
535```json
536{
537 "client_secret": "chatkit_token_123",
538 "expires_at": 1735689600,
539 "workflow": {
540 "id": "workflow_alpha",
541 "version": "2024-10-01"
542 },
543 "scope": {
544 "project": "alpha",
545 "environment": "staging"
546 },
547 "max_requests_per_1_minute": 60,
548 "max_requests_per_session": 500,
549 "status": "active"
550}
551```
552
553# Threads
554
555## List ChatKit thread items
556
557`client.Beta.ChatKit.Threads.ListItems(ctx, threadID, query) (*ConversationCursorPage[ChatKitThreadItemListDataUnion], error)`
558
559**get** `/chatkit/threads/{thread_id}/items`
560
561List items that belong to a ChatKit thread.
562
563### Parameters
564
565- `threadID string`
566
567- `query BetaChatKitThreadListItemsParams`
568
569 - `After param.Field[string]`
570
571 List items created after this thread item ID. Defaults to null for the first page.
572
573 - `Before param.Field[string]`
574
575 List items created before this thread item ID. Defaults to null for the newest results.
576
577 - `Limit param.Field[int64]`
578
579 Maximum number of thread items to return. Defaults to 20.
580
581 - `Order param.Field[BetaChatKitThreadListItemsParamsOrder]`
582
583 Sort order for results by creation time. Defaults to `desc`.
584
585 - `const BetaChatKitThreadListItemsParamsOrderAsc BetaChatKitThreadListItemsParamsOrder = "asc"`
586
587 - `const BetaChatKitThreadListItemsParamsOrderDesc BetaChatKitThreadListItemsParamsOrder = "desc"`
588
589### Returns
590
591- `type ChatKitThreadItemListDataUnion interface{…}`
592
593 User-authored messages within a thread.
594
595 - `type ChatKitThreadUserMessageItem struct{…}`
596
597 User-authored messages within a thread.
598
599 - `ID string`
600
601 Identifier of the thread item.
602
603 - `Attachments []ChatKitAttachment`
604
605 Attachments associated with the user message. Defaults to an empty list.
606
607 - `ID string`
608
609 Identifier for the attachment.
610
611 - `MimeType string`
612
613 MIME type of the attachment.
614
615 - `Name string`
616
617 Original display name for the attachment.
618
619 - `PreviewURL string`
620
621 Preview URL for rendering the attachment inline.
622
623 - `Type ChatKitAttachmentType`
624
625 Attachment discriminator.
626
627 - `const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"`
628
629 - `const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"`
630
631 - `Content []ChatKitThreadUserMessageItemContentUnion`
632
633 Ordered content elements supplied by the user.
634
635 - `type ChatKitThreadUserMessageItemContentInputText struct{…}`
636
637 Text block that a user contributed to the thread.
638
639 - `Text string`
640
641 Plain-text content supplied by the user.
642
643 - `Type InputText`
644
645 Type discriminator that is always `input_text`.
646
647 - `const InputTextInputText InputText = "input_text"`
648
649 - `type ChatKitThreadUserMessageItemContentQuotedText struct{…}`
650
651 Quoted snippet that the user referenced in their message.
652
653 - `Text string`
654
655 Quoted text content.
656
657 - `Type QuotedText`
658
659 Type discriminator that is always `quoted_text`.
660
661 - `const QuotedTextQuotedText QuotedText = "quoted_text"`
662
663 - `CreatedAt int64`
664
665 Unix timestamp (in seconds) for when the item was created.
666
667 - `InferenceOptions ChatKitThreadUserMessageItemInferenceOptions`
668
669 Inference overrides applied to the message. Defaults to null when unset.
670
671 - `Model string`
672
673 Model name that generated the response. Defaults to null when using the session default.
674
675 - `ToolChoice ChatKitThreadUserMessageItemInferenceOptionsToolChoice`
676
677 Preferred tool to invoke. Defaults to null when ChatKit should auto-select.
678
679 - `ID string`
680
681 Identifier of the requested tool.
682
683 - `Object ChatKitThreadItem`
684
685 Type discriminator that is always `chatkit.thread_item`.
686
687 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
688
689 - `ThreadID string`
690
691 Identifier of the parent thread.
692
693 - `Type ChatKitUserMessage`
694
695 - `const ChatKitUserMessageChatKitUserMessage ChatKitUserMessage = "chatkit.user_message"`
696
697 - `type ChatKitThreadAssistantMessageItem struct{…}`
698
699 Assistant-authored message within a thread.
700
701 - `ID string`
702
703 Identifier of the thread item.
704
705 - `Content []ChatKitResponseOutputText`
706
707 Ordered assistant response segments.
708
709 - `Annotations []ChatKitResponseOutputTextAnnotationUnion`
710
711 Ordered list of annotations attached to the response text.
712
713 - `type ChatKitResponseOutputTextAnnotationFile struct{…}`
714
715 Annotation that references an uploaded file.
716
717 - `Source ChatKitResponseOutputTextAnnotationFileSource`
718
719 File attachment referenced by the annotation.
720
721 - `Filename string`
722
723 Filename referenced by the annotation.
724
725 - `Type File`
726
727 Type discriminator that is always `file`.
728
729 - `const FileFile File = "file"`
730
731 - `Type File`
732
733 Type discriminator that is always `file` for this annotation.
734
735 - `const FileFile File = "file"`
736
737 - `type ChatKitResponseOutputTextAnnotationURL struct{…}`
738
739 Annotation that references a URL.
740
741 - `Source ChatKitResponseOutputTextAnnotationURLSource`
742
743 URL referenced by the annotation.
744
745 - `Type URL`
746
747 Type discriminator that is always `url`.
748
749 - `const URLURL URL = "url"`
750
751 - `URL string`
752
753 URL referenced by the annotation.
754
755 - `Type URL`
756
757 Type discriminator that is always `url` for this annotation.
758
759 - `const URLURL URL = "url"`
760
761 - `Text string`
762
763 Assistant generated text.
764
765 - `Type OutputText`
766
767 Type discriminator that is always `output_text`.
768
769 - `const OutputTextOutputText OutputText = "output_text"`
770
771 - `CreatedAt int64`
772
773 Unix timestamp (in seconds) for when the item was created.
774
775 - `Object ChatKitThreadItem`
776
777 Type discriminator that is always `chatkit.thread_item`.
778
779 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
780
781 - `ThreadID string`
782
783 Identifier of the parent thread.
784
785 - `Type ChatKitAssistantMessage`
786
787 Type discriminator that is always `chatkit.assistant_message`.
788
789 - `const ChatKitAssistantMessageChatKitAssistantMessage ChatKitAssistantMessage = "chatkit.assistant_message"`
790
791 - `type ChatKitWidgetItem struct{…}`
792
793 Thread item that renders a widget payload.
794
795 - `ID string`
796
797 Identifier of the thread item.
798
799 - `CreatedAt int64`
800
801 Unix timestamp (in seconds) for when the item was created.
802
803 - `Object ChatKitThreadItem`
804
805 Type discriminator that is always `chatkit.thread_item`.
806
807 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
808
809 - `ThreadID string`
810
811 Identifier of the parent thread.
812
813 - `Type ChatKitWidget`
814
815 Type discriminator that is always `chatkit.widget`.
816
817 - `const ChatKitWidgetChatKitWidget ChatKitWidget = "chatkit.widget"`
818
819 - `Widget string`
820
821 Serialized widget payload rendered in the UI.
822
823 - `type ChatKitThreadItemListDataChatKitClientToolCall struct{…}`
824
825 Record of a client side tool invocation initiated by the assistant.
826
827 - `ID string`
828
829 Identifier of the thread item.
830
831 - `Arguments string`
832
833 JSON-encoded arguments that were sent to the tool.
834
835 - `CallID string`
836
837 Identifier for the client tool call.
838
839 - `CreatedAt int64`
840
841 Unix timestamp (in seconds) for when the item was created.
842
843 - `Name string`
844
845 Tool name that was invoked.
846
847 - `Object ChatKitThreadItem`
848
849 Type discriminator that is always `chatkit.thread_item`.
850
851 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
852
853 - `Output string`
854
855 JSON-encoded output captured from the tool. Defaults to null while execution is in progress.
856
857 - `Status string`
858
859 Execution status for the tool call.
860
861 - `const ChatKitThreadItemListDataChatKitClientToolCallStatusInProgress ChatKitThreadItemListDataChatKitClientToolCallStatus = "in_progress"`
862
863 - `const ChatKitThreadItemListDataChatKitClientToolCallStatusCompleted ChatKitThreadItemListDataChatKitClientToolCallStatus = "completed"`
864
865 - `ThreadID string`
866
867 Identifier of the parent thread.
868
869 - `Type ChatKitClientToolCall`
870
871 Type discriminator that is always `chatkit.client_tool_call`.
872
873 - `const ChatKitClientToolCallChatKitClientToolCall ChatKitClientToolCall = "chatkit.client_tool_call"`
874
875 - `type ChatKitThreadItemListDataChatKitTask struct{…}`
876
877 Task emitted by the workflow to show progress and status updates.
878
879 - `ID string`
880
881 Identifier of the thread item.
882
883 - `CreatedAt int64`
884
885 Unix timestamp (in seconds) for when the item was created.
886
887 - `Heading string`
888
889 Optional heading for the task. Defaults to null when not provided.
890
891 - `Object ChatKitThreadItem`
892
893 Type discriminator that is always `chatkit.thread_item`.
894
895 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
896
897 - `Summary string`
898
899 Optional summary that describes the task. Defaults to null when omitted.
900
901 - `TaskType string`
902
903 Subtype for the task.
904
905 - `const ChatKitThreadItemListDataChatKitTaskTaskTypeCustom ChatKitThreadItemListDataChatKitTaskTaskType = "custom"`
906
907 - `const ChatKitThreadItemListDataChatKitTaskTaskTypeThought ChatKitThreadItemListDataChatKitTaskTaskType = "thought"`
908
909 - `ThreadID string`
910
911 Identifier of the parent thread.
912
913 - `Type ChatKitTask`
914
915 Type discriminator that is always `chatkit.task`.
916
917 - `const ChatKitTaskChatKitTask ChatKitTask = "chatkit.task"`
918
919 - `type ChatKitThreadItemListDataChatKitTaskGroup struct{…}`
920
921 Collection of workflow tasks grouped together in the thread.
922
923 - `ID string`
924
925 Identifier of the thread item.
926
927 - `CreatedAt int64`
928
929 Unix timestamp (in seconds) for when the item was created.
930
931 - `Object ChatKitThreadItem`
932
933 Type discriminator that is always `chatkit.thread_item`.
934
935 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
936
937 - `Tasks []ChatKitThreadItemListDataChatKitTaskGroupTask`
938
939 Tasks included in the group.
940
941 - `Heading string`
942
943 Optional heading for the grouped task. Defaults to null when not provided.
944
945 - `Summary string`
946
947 Optional summary that describes the grouped task. Defaults to null when omitted.
948
949 - `Type string`
950
951 Subtype for the grouped task.
952
953 - `const ChatKitThreadItemListDataChatKitTaskGroupTaskTypeCustom ChatKitThreadItemListDataChatKitTaskGroupTaskType = "custom"`
954
955 - `const ChatKitThreadItemListDataChatKitTaskGroupTaskTypeThought ChatKitThreadItemListDataChatKitTaskGroupTaskType = "thought"`
956
957 - `ThreadID string`
958
959 Identifier of the parent thread.
960
961 - `Type ChatKitTaskGroup`
962
963 Type discriminator that is always `chatkit.task_group`.
964
965 - `const ChatKitTaskGroupChatKitTaskGroup ChatKitTaskGroup = "chatkit.task_group"`
966
967### Example
968
969```go
970package main
971
972import (
973 "context"
974 "fmt"
975
976 "github.com/openai/openai-go"
977 "github.com/openai/openai-go/option"
978)
979
980func main() {
981 client := openai.NewClient(
982 option.WithAPIKey("My API Key"),
983 )
984 page, err := client.Beta.ChatKit.Threads.ListItems(
985 context.TODO(),
986 "cthr_123",
987 openai.BetaChatKitThreadListItemsParams{
988
989 },
990 )
991 if err != nil {
992 panic(err.Error())
993 }
994 fmt.Printf("%+v\n", page)
995}
996```
997
998#### Response
999
1000```json
1001{
1002 "data": [
1003 {
1004 "id": "id",
1005 "attachments": [
1006 {
1007 "id": "id",
1008 "mime_type": "mime_type",
1009 "name": "name",
1010 "preview_url": "https://example.com",
1011 "type": "image"
1012 }
1013 ],
1014 "content": [
1015 {
1016 "text": "text",
1017 "type": "input_text"
1018 }
1019 ],
1020 "created_at": 0,
1021 "inference_options": {
1022 "model": "model",
1023 "tool_choice": {
1024 "id": "id"
1025 }
1026 },
1027 "object": "chatkit.thread_item",
1028 "thread_id": "thread_id",
1029 "type": "chatkit.user_message"
1030 }
1031 ],
1032 "first_id": "first_id",
1033 "has_more": true,
1034 "last_id": "last_id",
1035 "object": "list"
1036}
1037```
1038
1039### Example
1040
1041```go
1042package main
1043
1044import (
1045 "context"
1046 "fmt"
1047
1048 "github.com/openai/openai-go"
1049 "github.com/openai/openai-go/option"
1050)
1051
1052func main() {
1053 client := openai.NewClient()
1054 page, err := client.Beta.ChatKit.Threads.ListItems(
1055 context.TODO(),
1056 "cthr_123",
1057 openai.BetaChatKitThreadListItemsParams{
1058
1059 },
1060 )
1061 if err != nil {
1062 panic(err.Error())
1063 }
1064 fmt.Printf("%+v\n", page)
1065}
1066```
1067
1068#### Response
1069
1070```json
1071{
1072 "data": [
1073 {
1074 "id": "cthi_user_001",
1075 "object": "chatkit.thread_item",
1076 "type": "user_message",
1077 "content": [
1078 {
1079 "type": "input_text",
1080 "text": "I need help debugging an onboarding issue."
1081 }
1082 ],
1083 "attachments": []
1084 },
1085 {
1086 "id": "cthi_assistant_002",
1087 "object": "chatkit.thread_item",
1088 "type": "assistant_message",
1089 "content": [
1090 {
1091 "type": "output_text",
1092 "text": "Let's start by confirming the workflow version you deployed."
1093 }
1094 ]
1095 }
1096 ],
1097 "has_more": false,
1098 "object": "list"
1099}
1100```
1101
1102## Retrieve ChatKit thread
1103
1104`client.Beta.ChatKit.Threads.Get(ctx, threadID) (*ChatKitThread, error)`
1105
1106**get** `/chatkit/threads/{thread_id}`
1107
1108Retrieve a ChatKit thread by its identifier.
1109
1110### Parameters
1111
1112- `threadID string`
1113
1114### Returns
1115
1116- `type ChatKitThread struct{…}`
1117
1118 Represents a ChatKit thread and its current status.
1119
1120 - `ID string`
1121
1122 Identifier of the thread.
1123
1124 - `CreatedAt int64`
1125
1126 Unix timestamp (in seconds) for when the thread was created.
1127
1128 - `Object ChatKitThread`
1129
1130 Type discriminator that is always `chatkit.thread`.
1131
1132 - `const ChatKitThreadChatKitThread ChatKitThread = "chatkit.thread"`
1133
1134 - `Status ChatKitThreadStatusUnion`
1135
1136 Current status for the thread. Defaults to `active` for newly created threads.
1137
1138 - `type ChatKitThreadStatusActive struct{…}`
1139
1140 Indicates that a thread is active.
1141
1142 - `Type Active`
1143
1144 Status discriminator that is always `active`.
1145
1146 - `const ActiveActive Active = "active"`
1147
1148 - `type ChatKitThreadStatusLocked struct{…}`
1149
1150 Indicates that a thread is locked and cannot accept new input.
1151
1152 - `Reason string`
1153
1154 Reason that the thread was locked. Defaults to null when no reason is recorded.
1155
1156 - `Type Locked`
1157
1158 Status discriminator that is always `locked`.
1159
1160 - `const LockedLocked Locked = "locked"`
1161
1162 - `type ChatKitThreadStatusClosed struct{…}`
1163
1164 Indicates that a thread has been closed.
1165
1166 - `Reason string`
1167
1168 Reason that the thread was closed. Defaults to null when no reason is recorded.
1169
1170 - `Type Closed`
1171
1172 Status discriminator that is always `closed`.
1173
1174 - `const ClosedClosed Closed = "closed"`
1175
1176 - `Title string`
1177
1178 Optional human-readable title for the thread. Defaults to null when no title has been generated.
1179
1180 - `User string`
1181
1182 Free-form string that identifies your end user who owns the thread.
1183
1184### Example
1185
1186```go
1187package main
1188
1189import (
1190 "context"
1191 "fmt"
1192
1193 "github.com/openai/openai-go"
1194 "github.com/openai/openai-go/option"
1195)
1196
1197func main() {
1198 client := openai.NewClient(
1199 option.WithAPIKey("My API Key"),
1200 )
1201 chatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), "cthr_123")
1202 if err != nil {
1203 panic(err.Error())
1204 }
1205 fmt.Printf("%+v\n", chatkitThread.ID)
1206}
1207```
1208
1209#### Response
1210
1211```json
1212{
1213 "id": "cthr_def456",
1214 "created_at": 1712345600,
1215 "object": "chatkit.thread",
1216 "status": {
1217 "type": "active"
1218 },
1219 "title": "Demo feedback",
1220 "user": "user_456"
1221}
1222```
1223
1224### Example
1225
1226```go
1227package main
1228
1229import (
1230 "context"
1231 "fmt"
1232
1233 "github.com/openai/openai-go"
1234)
1235
1236func main() {
1237 client := openai.NewClient()
1238 chatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), "cthr_123")
1239 if err != nil {
1240 panic(err.Error())
1241 }
1242 fmt.Printf("%+v\n", chatkitThread.ID)
1243}
1244```
1245
1246#### Response
1247
1248```json
1249{
1250 "id": "cthr_abc123",
1251 "object": "chatkit.thread",
1252 "title": "Customer escalation",
1253 "items": {
1254 "data": [
1255 {
1256 "id": "cthi_user_001",
1257 "object": "chatkit.thread_item",
1258 "type": "user_message",
1259 "content": [
1260 {
1261 "type": "input_text",
1262 "text": "I need help debugging an onboarding issue."
1263 }
1264 ],
1265 "attachments": []
1266 },
1267 {
1268 "id": "cthi_assistant_002",
1269 "object": "chatkit.thread_item",
1270 "type": "assistant_message",
1271 "content": [
1272 {
1273 "type": "output_text",
1274 "text": "Let's start by confirming the workflow version you deployed."
1275 }
1276 ]
1277 }
1278 ],
1279 "has_more": false
1280 }
1281}
1282```
1283
1284## Delete ChatKit thread
1285
1286`client.Beta.ChatKit.Threads.Delete(ctx, threadID) (*BetaChatKitThreadDeleteResponse, error)`
1287
1288**delete** `/chatkit/threads/{thread_id}`
1289
1290Delete a ChatKit thread along with its items and stored attachments.
1291
1292### Parameters
1293
1294- `threadID string`
1295
1296### Returns
1297
1298- `type BetaChatKitThreadDeleteResponse struct{…}`
1299
1300 Confirmation payload returned after deleting a thread.
1301
1302 - `ID string`
1303
1304 Identifier of the deleted thread.
1305
1306 - `Deleted bool`
1307
1308 Indicates that the thread has been deleted.
1309
1310 - `Object ChatKitThreadDeleted`
1311
1312 Type discriminator that is always `chatkit.thread.deleted`.
1313
1314 - `const ChatKitThreadDeletedChatKitThreadDeleted ChatKitThreadDeleted = "chatkit.thread.deleted"`
1315
1316### Example
1317
1318```go
1319package main
1320
1321import (
1322 "context"
1323 "fmt"
1324
1325 "github.com/openai/openai-go"
1326 "github.com/openai/openai-go/option"
1327)
1328
1329func main() {
1330 client := openai.NewClient(
1331 option.WithAPIKey("My API Key"),
1332 )
1333 thread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), "cthr_123")
1334 if err != nil {
1335 panic(err.Error())
1336 }
1337 fmt.Printf("%+v\n", thread.ID)
1338}
1339```
1340
1341#### Response
1342
1343```json
1344{
1345 "id": "id",
1346 "deleted": true,
1347 "object": "chatkit.thread.deleted"
1348}
1349```
1350
1351### Example
1352
1353```go
1354package main
1355
1356import (
1357 "context"
1358 "fmt"
1359
1360 "github.com/openai/openai-go"
1361)
1362
1363func main() {
1364 client := openai.NewClient()
1365 thread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), "cthr_123")
1366 if err != nil {
1367 panic(err.Error())
1368 }
1369 fmt.Printf("%+v\n", thread.ID)
1370}
1371```
1372
1373## List ChatKit threads
1374
1375`client.Beta.ChatKit.Threads.List(ctx, query) (*ConversationCursorPage[ChatKitThread], error)`
1376
1377**get** `/chatkit/threads`
1378
1379List ChatKit threads with optional pagination and user filters.
1380
1381### Parameters
1382
1383- `query BetaChatKitThreadListParams`
1384
1385 - `After param.Field[string]`
1386
1387 List items created after this thread item ID. Defaults to null for the first page.
1388
1389 - `Before param.Field[string]`
1390
1391 List items created before this thread item ID. Defaults to null for the newest results.
1392
1393 - `Limit param.Field[int64]`
1394
1395 Maximum number of thread items to return. Defaults to 20.
1396
1397 - `Order param.Field[BetaChatKitThreadListParamsOrder]`
1398
1399 Sort order for results by creation time. Defaults to `desc`.
1400
1401 - `const BetaChatKitThreadListParamsOrderAsc BetaChatKitThreadListParamsOrder = "asc"`
1402
1403 - `const BetaChatKitThreadListParamsOrderDesc BetaChatKitThreadListParamsOrder = "desc"`
1404
1405 - `User param.Field[string]`
1406
1407 Filter threads that belong to this user identifier. Defaults to null to return all users.
1408
1409### Returns
1410
1411- `type ChatKitThread struct{…}`
1412
1413 Represents a ChatKit thread and its current status.
1414
1415 - `ID string`
1416
1417 Identifier of the thread.
1418
1419 - `CreatedAt int64`
1420
1421 Unix timestamp (in seconds) for when the thread was created.
1422
1423 - `Object ChatKitThread`
1424
1425 Type discriminator that is always `chatkit.thread`.
1426
1427 - `const ChatKitThreadChatKitThread ChatKitThread = "chatkit.thread"`
1428
1429 - `Status ChatKitThreadStatusUnion`
1430
1431 Current status for the thread. Defaults to `active` for newly created threads.
1432
1433 - `type ChatKitThreadStatusActive struct{…}`
1434
1435 Indicates that a thread is active.
1436
1437 - `Type Active`
1438
1439 Status discriminator that is always `active`.
1440
1441 - `const ActiveActive Active = "active"`
1442
1443 - `type ChatKitThreadStatusLocked struct{…}`
1444
1445 Indicates that a thread is locked and cannot accept new input.
1446
1447 - `Reason string`
1448
1449 Reason that the thread was locked. Defaults to null when no reason is recorded.
1450
1451 - `Type Locked`
1452
1453 Status discriminator that is always `locked`.
1454
1455 - `const LockedLocked Locked = "locked"`
1456
1457 - `type ChatKitThreadStatusClosed struct{…}`
1458
1459 Indicates that a thread has been closed.
1460
1461 - `Reason string`
1462
1463 Reason that the thread was closed. Defaults to null when no reason is recorded.
1464
1465 - `Type Closed`
1466
1467 Status discriminator that is always `closed`.
1468
1469 - `const ClosedClosed Closed = "closed"`
1470
1471 - `Title string`
1472
1473 Optional human-readable title for the thread. Defaults to null when no title has been generated.
1474
1475 - `User string`
1476
1477 Free-form string that identifies your end user who owns the thread.
1478
1479### Example
1480
1481```go
1482package main
1483
1484import (
1485 "context"
1486 "fmt"
1487
1488 "github.com/openai/openai-go"
1489 "github.com/openai/openai-go/option"
1490)
1491
1492func main() {
1493 client := openai.NewClient(
1494 option.WithAPIKey("My API Key"),
1495 )
1496 page, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{
1497
1498 })
1499 if err != nil {
1500 panic(err.Error())
1501 }
1502 fmt.Printf("%+v\n", page)
1503}
1504```
1505
1506#### Response
1507
1508```json
1509{
1510 "data": [
1511 {
1512 "id": "cthr_def456",
1513 "created_at": 1712345600,
1514 "object": "chatkit.thread",
1515 "status": {
1516 "type": "active"
1517 },
1518 "title": "Demo feedback",
1519 "user": "user_456"
1520 }
1521 ],
1522 "first_id": "first_id",
1523 "has_more": true,
1524 "last_id": "last_id",
1525 "object": "list"
1526}
1527```
1528
1529### Example
1530
1531```go
1532package main
1533
1534import (
1535 "context"
1536 "fmt"
1537
1538 "github.com/openai/openai-go"
1539)
1540
1541func main() {
1542 client := openai.NewClient()
1543 page, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{
1544
1545 })
1546 if err != nil {
1547 panic(err.Error())
1548 }
1549 fmt.Printf("%+v\n", page)
1550}
1551```
1552
1553#### Response
1554
1555```json
1556{
1557 "data": [
1558 {
1559 "id": "cthr_abc123",
1560 "object": "chatkit.thread",
1561 "title": "Customer escalation"
1562 },
1563 {
1564 "id": "cthr_def456",
1565 "object": "chatkit.thread",
1566 "title": "Demo feedback"
1567 }
1568 ],
1569 "has_more": false,
1570 "object": "list"
1571}
1572```
1573
1574## Domain Types
1575
1576### Chat Session
1577
1578- `type ChatSession struct{…}`
1579
1580 Represents a ChatKit session and its resolved configuration.
1581
1582 - `ID string`
1583
1584 Identifier for the ChatKit session.
1585
1586 - `ChatKitConfiguration ChatSessionChatKitConfiguration`
1587
1588 Resolved ChatKit feature configuration for the session.
1589
1590 - `AutomaticThreadTitling ChatSessionAutomaticThreadTitling`
1591
1592 Automatic thread titling preferences.
1593
1594 - `Enabled bool`
1595
1596 Whether automatic thread titling is enabled.
1597
1598 - `FileUpload ChatSessionFileUpload`
1599
1600 Upload settings for the session.
1601
1602 - `Enabled bool`
1603
1604 Indicates if uploads are enabled for the session.
1605
1606 - `MaxFileSize int64`
1607
1608 Maximum upload size in megabytes.
1609
1610 - `MaxFiles int64`
1611
1612 Maximum number of uploads allowed during the session.
1613
1614 - `History ChatSessionHistory`
1615
1616 History retention configuration.
1617
1618 - `Enabled bool`
1619
1620 Indicates if chat history is persisted for the session.
1621
1622 - `RecentThreads int64`
1623
1624 Number of prior threads surfaced in history views. Defaults to null when all history is retained.
1625
1626 - `ClientSecret string`
1627
1628 Ephemeral client secret that authenticates session requests.
1629
1630 - `ExpiresAt int64`
1631
1632 Unix timestamp (in seconds) for when the session expires.
1633
1634 - `MaxRequestsPer1Minute int64`
1635
1636 Convenience copy of the per-minute request limit.
1637
1638 - `Object ChatKitSession`
1639
1640 Type discriminator that is always `chatkit.session`.
1641
1642 - `const ChatKitSessionChatKitSession ChatKitSession = "chatkit.session"`
1643
1644 - `RateLimits ChatSessionRateLimits`
1645
1646 Resolved rate limit values.
1647
1648 - `MaxRequestsPer1Minute int64`
1649
1650 Maximum allowed requests per one-minute window.
1651
1652 - `Status ChatSessionStatus`
1653
1654 Current lifecycle state of the session.
1655
1656 - `const ChatSessionStatusActive ChatSessionStatus = "active"`
1657
1658 - `const ChatSessionStatusExpired ChatSessionStatus = "expired"`
1659
1660 - `const ChatSessionStatusCancelled ChatSessionStatus = "cancelled"`
1661
1662 - `User string`
1663
1664 User identifier associated with the session.
1665
1666 - `Workflow ChatKitWorkflow`
1667
1668 Workflow metadata for the session.
1669
1670 - `ID string`
1671
1672 Identifier of the workflow backing the session.
1673
1674 - `StateVariables map[string, ChatKitWorkflowStateVariableUnion]`
1675
1676 State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.
1677
1678 - `string`
1679
1680 - `bool`
1681
1682 - `float64`
1683
1684 - `Tracing ChatKitWorkflowTracing`
1685
1686 Tracing settings applied to the workflow.
1687
1688 - `Enabled bool`
1689
1690 Indicates whether tracing is enabled.
1691
1692 - `Version string`
1693
1694 Specific workflow version used for the session. Defaults to null when using the latest deployment.
1695
1696### Chat Session Automatic Thread Titling
1697
1698- `type ChatSessionAutomaticThreadTitling struct{…}`
1699
1700 Automatic thread title preferences for the session.
1701
1702 - `Enabled bool`
1703
1704 Whether automatic thread titling is enabled.
1705
1706### Chat Session ChatKit Configuration
1707
1708- `type ChatSessionChatKitConfiguration struct{…}`
1709
1710 ChatKit configuration for the session.
1711
1712 - `AutomaticThreadTitling ChatSessionAutomaticThreadTitling`
1713
1714 Automatic thread titling preferences.
1715
1716 - `Enabled bool`
1717
1718 Whether automatic thread titling is enabled.
1719
1720 - `FileUpload ChatSessionFileUpload`
1721
1722 Upload settings for the session.
1723
1724 - `Enabled bool`
1725
1726 Indicates if uploads are enabled for the session.
1727
1728 - `MaxFileSize int64`
1729
1730 Maximum upload size in megabytes.
1731
1732 - `MaxFiles int64`
1733
1734 Maximum number of uploads allowed during the session.
1735
1736 - `History ChatSessionHistory`
1737
1738 History retention configuration.
1739
1740 - `Enabled bool`
1741
1742 Indicates if chat history is persisted for the session.
1743
1744 - `RecentThreads int64`
1745
1746 Number of prior threads surfaced in history views. Defaults to null when all history is retained.
1747
1748### Chat Session ChatKit Configuration Param
1749
1750- `type ChatSessionChatKitConfigurationParamResp struct{…}`
1751
1752 Optional per-session configuration settings for ChatKit behavior.
1753
1754 - `AutomaticThreadTitling ChatSessionChatKitConfigurationParamAutomaticThreadTitlingResp`
1755
1756 Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default.
1757
1758 - `Enabled bool`
1759
1760 Enable automatic thread title generation. Defaults to true.
1761
1762 - `FileUpload ChatSessionChatKitConfigurationParamFileUploadResp`
1763
1764 Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB).
1765
1766 - `Enabled bool`
1767
1768 Enable uploads for this session. Defaults to false.
1769
1770 - `MaxFileSize int64`
1771
1772 Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size.
1773
1774 - `MaxFiles int64`
1775
1776 Maximum number of files that can be uploaded to the session. Defaults to 10.
1777
1778 - `History ChatSessionChatKitConfigurationParamHistoryResp`
1779
1780 Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null).
1781
1782 - `Enabled bool`
1783
1784 Enables chat users to access previous ChatKit threads. Defaults to true.
1785
1786 - `RecentThreads int64`
1787
1788 Number of recent ChatKit threads users have access to. Defaults to unlimited when unset.
1789
1790### Chat Session Expires After Param
1791
1792- `type ChatSessionExpiresAfterParamResp struct{…}`
1793
1794 Controls when the session expires relative to an anchor timestamp.
1795
1796 - `Anchor CreatedAt`
1797
1798 Base timestamp used to calculate expiration. Currently fixed to `created_at`.
1799
1800 - `const CreatedAtCreatedAt CreatedAt = "created_at"`
1801
1802 - `Seconds int64`
1803
1804 Number of seconds after the anchor when the session expires.
1805
1806### Chat Session File Upload
1807
1808- `type ChatSessionFileUpload struct{…}`
1809
1810 Upload permissions and limits applied to the session.
1811
1812 - `Enabled bool`
1813
1814 Indicates if uploads are enabled for the session.
1815
1816 - `MaxFileSize int64`
1817
1818 Maximum upload size in megabytes.
1819
1820 - `MaxFiles int64`
1821
1822 Maximum number of uploads allowed during the session.
1823
1824### Chat Session History
1825
1826- `type ChatSessionHistory struct{…}`
1827
1828 History retention preferences returned for the session.
1829
1830 - `Enabled bool`
1831
1832 Indicates if chat history is persisted for the session.
1833
1834 - `RecentThreads int64`
1835
1836 Number of prior threads surfaced in history views. Defaults to null when all history is retained.
1837
1838### Chat Session Rate Limits
1839
1840- `type ChatSessionRateLimits struct{…}`
1841
1842 Active per-minute request limit for the session.
1843
1844 - `MaxRequestsPer1Minute int64`
1845
1846 Maximum allowed requests per one-minute window.
1847
1848### Chat Session Rate Limits Param
1849
1850- `type ChatSessionRateLimitsParamResp struct{…}`
1851
1852 Controls request rate limits for the session.
1853
1854 - `MaxRequestsPer1Minute int64`
1855
1856 Maximum number of requests allowed per minute for the session. Defaults to 10.
1857
1858### Chat Session Status
1859
1860- `type ChatSessionStatus string`
1861
1862 - `const ChatSessionStatusActive ChatSessionStatus = "active"`
1863
1864 - `const ChatSessionStatusExpired ChatSessionStatus = "expired"`
1865
1866 - `const ChatSessionStatusCancelled ChatSessionStatus = "cancelled"`
1867
1868### Chat Session Workflow Param
1869
1870- `type ChatSessionWorkflowParamResp struct{…}`
1871
1872 Workflow reference and overrides applied to the chat session.
1873
1874 - `ID string`
1875
1876 Identifier for the workflow invoked by the session.
1877
1878 - `StateVariables map[string, ChatSessionWorkflowParamStateVariableUnionResp]`
1879
1880 State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object.
1881
1882 - `string`
1883
1884 - `bool`
1885
1886 - `float64`
1887
1888 - `Tracing ChatSessionWorkflowParamTracingResp`
1889
1890 Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default.
1891
1892 - `Enabled bool`
1893
1894 Whether tracing is enabled during the session. Defaults to true.
1895
1896 - `Version string`
1897
1898 Specific workflow version to run. Defaults to the latest deployed version.
1899
1900### ChatKit Attachment
1901
1902- `type ChatKitAttachment struct{…}`
1903
1904 Attachment metadata included on thread items.
1905
1906 - `ID string`
1907
1908 Identifier for the attachment.
1909
1910 - `MimeType string`
1911
1912 MIME type of the attachment.
1913
1914 - `Name string`
1915
1916 Original display name for the attachment.
1917
1918 - `PreviewURL string`
1919
1920 Preview URL for rendering the attachment inline.
1921
1922 - `Type ChatKitAttachmentType`
1923
1924 Attachment discriminator.
1925
1926 - `const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"`
1927
1928 - `const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"`
1929
1930### ChatKit Response Output Text
1931
1932- `type ChatKitResponseOutputText struct{…}`
1933
1934 Assistant response text accompanied by optional annotations.
1935
1936 - `Annotations []ChatKitResponseOutputTextAnnotationUnion`
1937
1938 Ordered list of annotations attached to the response text.
1939
1940 - `type ChatKitResponseOutputTextAnnotationFile struct{…}`
1941
1942 Annotation that references an uploaded file.
1943
1944 - `Source ChatKitResponseOutputTextAnnotationFileSource`
1945
1946 File attachment referenced by the annotation.
1947
1948 - `Filename string`
1949
1950 Filename referenced by the annotation.
1951
1952 - `Type File`
1953
1954 Type discriminator that is always `file`.
1955
1956 - `const FileFile File = "file"`
1957
1958 - `Type File`
1959
1960 Type discriminator that is always `file` for this annotation.
1961
1962 - `const FileFile File = "file"`
1963
1964 - `type ChatKitResponseOutputTextAnnotationURL struct{…}`
1965
1966 Annotation that references a URL.
1967
1968 - `Source ChatKitResponseOutputTextAnnotationURLSource`
1969
1970 URL referenced by the annotation.
1971
1972 - `Type URL`
1973
1974 Type discriminator that is always `url`.
1975
1976 - `const URLURL URL = "url"`
1977
1978 - `URL string`
1979
1980 URL referenced by the annotation.
1981
1982 - `Type URL`
1983
1984 Type discriminator that is always `url` for this annotation.
1985
1986 - `const URLURL URL = "url"`
1987
1988 - `Text string`
1989
1990 Assistant generated text.
1991
1992 - `Type OutputText`
1993
1994 Type discriminator that is always `output_text`.
1995
1996 - `const OutputTextOutputText OutputText = "output_text"`
1997
1998### ChatKit Thread
1999
2000- `type ChatKitThread struct{…}`
2001
2002 Represents a ChatKit thread and its current status.
2003
2004 - `ID string`
2005
2006 Identifier of the thread.
2007
2008 - `CreatedAt int64`
2009
2010 Unix timestamp (in seconds) for when the thread was created.
2011
2012 - `Object ChatKitThread`
2013
2014 Type discriminator that is always `chatkit.thread`.
2015
2016 - `const ChatKitThreadChatKitThread ChatKitThread = "chatkit.thread"`
2017
2018 - `Status ChatKitThreadStatusUnion`
2019
2020 Current status for the thread. Defaults to `active` for newly created threads.
2021
2022 - `type ChatKitThreadStatusActive struct{…}`
2023
2024 Indicates that a thread is active.
2025
2026 - `Type Active`
2027
2028 Status discriminator that is always `active`.
2029
2030 - `const ActiveActive Active = "active"`
2031
2032 - `type ChatKitThreadStatusLocked struct{…}`
2033
2034 Indicates that a thread is locked and cannot accept new input.
2035
2036 - `Reason string`
2037
2038 Reason that the thread was locked. Defaults to null when no reason is recorded.
2039
2040 - `Type Locked`
2041
2042 Status discriminator that is always `locked`.
2043
2044 - `const LockedLocked Locked = "locked"`
2045
2046 - `type ChatKitThreadStatusClosed struct{…}`
2047
2048 Indicates that a thread has been closed.
2049
2050 - `Reason string`
2051
2052 Reason that the thread was closed. Defaults to null when no reason is recorded.
2053
2054 - `Type Closed`
2055
2056 Status discriminator that is always `closed`.
2057
2058 - `const ClosedClosed Closed = "closed"`
2059
2060 - `Title string`
2061
2062 Optional human-readable title for the thread. Defaults to null when no title has been generated.
2063
2064 - `User string`
2065
2066 Free-form string that identifies your end user who owns the thread.
2067
2068### ChatKit Thread Assistant Message Item
2069
2070- `type ChatKitThreadAssistantMessageItem struct{…}`
2071
2072 Assistant-authored message within a thread.
2073
2074 - `ID string`
2075
2076 Identifier of the thread item.
2077
2078 - `Content []ChatKitResponseOutputText`
2079
2080 Ordered assistant response segments.
2081
2082 - `Annotations []ChatKitResponseOutputTextAnnotationUnion`
2083
2084 Ordered list of annotations attached to the response text.
2085
2086 - `type ChatKitResponseOutputTextAnnotationFile struct{…}`
2087
2088 Annotation that references an uploaded file.
2089
2090 - `Source ChatKitResponseOutputTextAnnotationFileSource`
2091
2092 File attachment referenced by the annotation.
2093
2094 - `Filename string`
2095
2096 Filename referenced by the annotation.
2097
2098 - `Type File`
2099
2100 Type discriminator that is always `file`.
2101
2102 - `const FileFile File = "file"`
2103
2104 - `Type File`
2105
2106 Type discriminator that is always `file` for this annotation.
2107
2108 - `const FileFile File = "file"`
2109
2110 - `type ChatKitResponseOutputTextAnnotationURL struct{…}`
2111
2112 Annotation that references a URL.
2113
2114 - `Source ChatKitResponseOutputTextAnnotationURLSource`
2115
2116 URL referenced by the annotation.
2117
2118 - `Type URL`
2119
2120 Type discriminator that is always `url`.
2121
2122 - `const URLURL URL = "url"`
2123
2124 - `URL string`
2125
2126 URL referenced by the annotation.
2127
2128 - `Type URL`
2129
2130 Type discriminator that is always `url` for this annotation.
2131
2132 - `const URLURL URL = "url"`
2133
2134 - `Text string`
2135
2136 Assistant generated text.
2137
2138 - `Type OutputText`
2139
2140 Type discriminator that is always `output_text`.
2141
2142 - `const OutputTextOutputText OutputText = "output_text"`
2143
2144 - `CreatedAt int64`
2145
2146 Unix timestamp (in seconds) for when the item was created.
2147
2148 - `Object ChatKitThreadItem`
2149
2150 Type discriminator that is always `chatkit.thread_item`.
2151
2152 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2153
2154 - `ThreadID string`
2155
2156 Identifier of the parent thread.
2157
2158 - `Type ChatKitAssistantMessage`
2159
2160 Type discriminator that is always `chatkit.assistant_message`.
2161
2162 - `const ChatKitAssistantMessageChatKitAssistantMessage ChatKitAssistantMessage = "chatkit.assistant_message"`
2163
2164### ChatKit Thread Item List
2165
2166- `type ChatKitThreadItemList struct{…}`
2167
2168 A paginated list of thread items rendered for the ChatKit API.
2169
2170 - `Data []ChatKitThreadItemListDataUnion`
2171
2172 A list of items
2173
2174 - `type ChatKitThreadUserMessageItem struct{…}`
2175
2176 User-authored messages within a thread.
2177
2178 - `ID string`
2179
2180 Identifier of the thread item.
2181
2182 - `Attachments []ChatKitAttachment`
2183
2184 Attachments associated with the user message. Defaults to an empty list.
2185
2186 - `ID string`
2187
2188 Identifier for the attachment.
2189
2190 - `MimeType string`
2191
2192 MIME type of the attachment.
2193
2194 - `Name string`
2195
2196 Original display name for the attachment.
2197
2198 - `PreviewURL string`
2199
2200 Preview URL for rendering the attachment inline.
2201
2202 - `Type ChatKitAttachmentType`
2203
2204 Attachment discriminator.
2205
2206 - `const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"`
2207
2208 - `const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"`
2209
2210 - `Content []ChatKitThreadUserMessageItemContentUnion`
2211
2212 Ordered content elements supplied by the user.
2213
2214 - `type ChatKitThreadUserMessageItemContentInputText struct{…}`
2215
2216 Text block that a user contributed to the thread.
2217
2218 - `Text string`
2219
2220 Plain-text content supplied by the user.
2221
2222 - `Type InputText`
2223
2224 Type discriminator that is always `input_text`.
2225
2226 - `const InputTextInputText InputText = "input_text"`
2227
2228 - `type ChatKitThreadUserMessageItemContentQuotedText struct{…}`
2229
2230 Quoted snippet that the user referenced in their message.
2231
2232 - `Text string`
2233
2234 Quoted text content.
2235
2236 - `Type QuotedText`
2237
2238 Type discriminator that is always `quoted_text`.
2239
2240 - `const QuotedTextQuotedText QuotedText = "quoted_text"`
2241
2242 - `CreatedAt int64`
2243
2244 Unix timestamp (in seconds) for when the item was created.
2245
2246 - `InferenceOptions ChatKitThreadUserMessageItemInferenceOptions`
2247
2248 Inference overrides applied to the message. Defaults to null when unset.
2249
2250 - `Model string`
2251
2252 Model name that generated the response. Defaults to null when using the session default.
2253
2254 - `ToolChoice ChatKitThreadUserMessageItemInferenceOptionsToolChoice`
2255
2256 Preferred tool to invoke. Defaults to null when ChatKit should auto-select.
2257
2258 - `ID string`
2259
2260 Identifier of the requested tool.
2261
2262 - `Object ChatKitThreadItem`
2263
2264 Type discriminator that is always `chatkit.thread_item`.
2265
2266 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2267
2268 - `ThreadID string`
2269
2270 Identifier of the parent thread.
2271
2272 - `Type ChatKitUserMessage`
2273
2274 - `const ChatKitUserMessageChatKitUserMessage ChatKitUserMessage = "chatkit.user_message"`
2275
2276 - `type ChatKitThreadAssistantMessageItem struct{…}`
2277
2278 Assistant-authored message within a thread.
2279
2280 - `ID string`
2281
2282 Identifier of the thread item.
2283
2284 - `Content []ChatKitResponseOutputText`
2285
2286 Ordered assistant response segments.
2287
2288 - `Annotations []ChatKitResponseOutputTextAnnotationUnion`
2289
2290 Ordered list of annotations attached to the response text.
2291
2292 - `type ChatKitResponseOutputTextAnnotationFile struct{…}`
2293
2294 Annotation that references an uploaded file.
2295
2296 - `Source ChatKitResponseOutputTextAnnotationFileSource`
2297
2298 File attachment referenced by the annotation.
2299
2300 - `Filename string`
2301
2302 Filename referenced by the annotation.
2303
2304 - `Type File`
2305
2306 Type discriminator that is always `file`.
2307
2308 - `const FileFile File = "file"`
2309
2310 - `Type File`
2311
2312 Type discriminator that is always `file` for this annotation.
2313
2314 - `const FileFile File = "file"`
2315
2316 - `type ChatKitResponseOutputTextAnnotationURL struct{…}`
2317
2318 Annotation that references a URL.
2319
2320 - `Source ChatKitResponseOutputTextAnnotationURLSource`
2321
2322 URL referenced by the annotation.
2323
2324 - `Type URL`
2325
2326 Type discriminator that is always `url`.
2327
2328 - `const URLURL URL = "url"`
2329
2330 - `URL string`
2331
2332 URL referenced by the annotation.
2333
2334 - `Type URL`
2335
2336 Type discriminator that is always `url` for this annotation.
2337
2338 - `const URLURL URL = "url"`
2339
2340 - `Text string`
2341
2342 Assistant generated text.
2343
2344 - `Type OutputText`
2345
2346 Type discriminator that is always `output_text`.
2347
2348 - `const OutputTextOutputText OutputText = "output_text"`
2349
2350 - `CreatedAt int64`
2351
2352 Unix timestamp (in seconds) for when the item was created.
2353
2354 - `Object ChatKitThreadItem`
2355
2356 Type discriminator that is always `chatkit.thread_item`.
2357
2358 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2359
2360 - `ThreadID string`
2361
2362 Identifier of the parent thread.
2363
2364 - `Type ChatKitAssistantMessage`
2365
2366 Type discriminator that is always `chatkit.assistant_message`.
2367
2368 - `const ChatKitAssistantMessageChatKitAssistantMessage ChatKitAssistantMessage = "chatkit.assistant_message"`
2369
2370 - `type ChatKitWidgetItem struct{…}`
2371
2372 Thread item that renders a widget payload.
2373
2374 - `ID string`
2375
2376 Identifier of the thread item.
2377
2378 - `CreatedAt int64`
2379
2380 Unix timestamp (in seconds) for when the item was created.
2381
2382 - `Object ChatKitThreadItem`
2383
2384 Type discriminator that is always `chatkit.thread_item`.
2385
2386 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2387
2388 - `ThreadID string`
2389
2390 Identifier of the parent thread.
2391
2392 - `Type ChatKitWidget`
2393
2394 Type discriminator that is always `chatkit.widget`.
2395
2396 - `const ChatKitWidgetChatKitWidget ChatKitWidget = "chatkit.widget"`
2397
2398 - `Widget string`
2399
2400 Serialized widget payload rendered in the UI.
2401
2402 - `type ChatKitThreadItemListDataChatKitClientToolCall struct{…}`
2403
2404 Record of a client side tool invocation initiated by the assistant.
2405
2406 - `ID string`
2407
2408 Identifier of the thread item.
2409
2410 - `Arguments string`
2411
2412 JSON-encoded arguments that were sent to the tool.
2413
2414 - `CallID string`
2415
2416 Identifier for the client tool call.
2417
2418 - `CreatedAt int64`
2419
2420 Unix timestamp (in seconds) for when the item was created.
2421
2422 - `Name string`
2423
2424 Tool name that was invoked.
2425
2426 - `Object ChatKitThreadItem`
2427
2428 Type discriminator that is always `chatkit.thread_item`.
2429
2430 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2431
2432 - `Output string`
2433
2434 JSON-encoded output captured from the tool. Defaults to null while execution is in progress.
2435
2436 - `Status string`
2437
2438 Execution status for the tool call.
2439
2440 - `const ChatKitThreadItemListDataChatKitClientToolCallStatusInProgress ChatKitThreadItemListDataChatKitClientToolCallStatus = "in_progress"`
2441
2442 - `const ChatKitThreadItemListDataChatKitClientToolCallStatusCompleted ChatKitThreadItemListDataChatKitClientToolCallStatus = "completed"`
2443
2444 - `ThreadID string`
2445
2446 Identifier of the parent thread.
2447
2448 - `Type ChatKitClientToolCall`
2449
2450 Type discriminator that is always `chatkit.client_tool_call`.
2451
2452 - `const ChatKitClientToolCallChatKitClientToolCall ChatKitClientToolCall = "chatkit.client_tool_call"`
2453
2454 - `type ChatKitThreadItemListDataChatKitTask struct{…}`
2455
2456 Task emitted by the workflow to show progress and status updates.
2457
2458 - `ID string`
2459
2460 Identifier of the thread item.
2461
2462 - `CreatedAt int64`
2463
2464 Unix timestamp (in seconds) for when the item was created.
2465
2466 - `Heading string`
2467
2468 Optional heading for the task. Defaults to null when not provided.
2469
2470 - `Object ChatKitThreadItem`
2471
2472 Type discriminator that is always `chatkit.thread_item`.
2473
2474 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2475
2476 - `Summary string`
2477
2478 Optional summary that describes the task. Defaults to null when omitted.
2479
2480 - `TaskType string`
2481
2482 Subtype for the task.
2483
2484 - `const ChatKitThreadItemListDataChatKitTaskTaskTypeCustom ChatKitThreadItemListDataChatKitTaskTaskType = "custom"`
2485
2486 - `const ChatKitThreadItemListDataChatKitTaskTaskTypeThought ChatKitThreadItemListDataChatKitTaskTaskType = "thought"`
2487
2488 - `ThreadID string`
2489
2490 Identifier of the parent thread.
2491
2492 - `Type ChatKitTask`
2493
2494 Type discriminator that is always `chatkit.task`.
2495
2496 - `const ChatKitTaskChatKitTask ChatKitTask = "chatkit.task"`
2497
2498 - `type ChatKitThreadItemListDataChatKitTaskGroup struct{…}`
2499
2500 Collection of workflow tasks grouped together in the thread.
2501
2502 - `ID string`
2503
2504 Identifier of the thread item.
2505
2506 - `CreatedAt int64`
2507
2508 Unix timestamp (in seconds) for when the item was created.
2509
2510 - `Object ChatKitThreadItem`
2511
2512 Type discriminator that is always `chatkit.thread_item`.
2513
2514 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2515
2516 - `Tasks []ChatKitThreadItemListDataChatKitTaskGroupTask`
2517
2518 Tasks included in the group.
2519
2520 - `Heading string`
2521
2522 Optional heading for the grouped task. Defaults to null when not provided.
2523
2524 - `Summary string`
2525
2526 Optional summary that describes the grouped task. Defaults to null when omitted.
2527
2528 - `Type string`
2529
2530 Subtype for the grouped task.
2531
2532 - `const ChatKitThreadItemListDataChatKitTaskGroupTaskTypeCustom ChatKitThreadItemListDataChatKitTaskGroupTaskType = "custom"`
2533
2534 - `const ChatKitThreadItemListDataChatKitTaskGroupTaskTypeThought ChatKitThreadItemListDataChatKitTaskGroupTaskType = "thought"`
2535
2536 - `ThreadID string`
2537
2538 Identifier of the parent thread.
2539
2540 - `Type ChatKitTaskGroup`
2541
2542 Type discriminator that is always `chatkit.task_group`.
2543
2544 - `const ChatKitTaskGroupChatKitTaskGroup ChatKitTaskGroup = "chatkit.task_group"`
2545
2546 - `FirstID string`
2547
2548 The ID of the first item in the list.
2549
2550 - `HasMore bool`
2551
2552 Whether there are more items available.
2553
2554 - `LastID string`
2555
2556 The ID of the last item in the list.
2557
2558 - `Object List`
2559
2560 The type of object returned, must be `list`.
2561
2562 - `const ListList List = "list"`
2563
2564### ChatKit Thread User Message Item
2565
2566- `type ChatKitThreadUserMessageItem struct{…}`
2567
2568 User-authored messages within a thread.
2569
2570 - `ID string`
2571
2572 Identifier of the thread item.
2573
2574 - `Attachments []ChatKitAttachment`
2575
2576 Attachments associated with the user message. Defaults to an empty list.
2577
2578 - `ID string`
2579
2580 Identifier for the attachment.
2581
2582 - `MimeType string`
2583
2584 MIME type of the attachment.
2585
2586 - `Name string`
2587
2588 Original display name for the attachment.
2589
2590 - `PreviewURL string`
2591
2592 Preview URL for rendering the attachment inline.
2593
2594 - `Type ChatKitAttachmentType`
2595
2596 Attachment discriminator.
2597
2598 - `const ChatKitAttachmentTypeImage ChatKitAttachmentType = "image"`
2599
2600 - `const ChatKitAttachmentTypeFile ChatKitAttachmentType = "file"`
2601
2602 - `Content []ChatKitThreadUserMessageItemContentUnion`
2603
2604 Ordered content elements supplied by the user.
2605
2606 - `type ChatKitThreadUserMessageItemContentInputText struct{…}`
2607
2608 Text block that a user contributed to the thread.
2609
2610 - `Text string`
2611
2612 Plain-text content supplied by the user.
2613
2614 - `Type InputText`
2615
2616 Type discriminator that is always `input_text`.
2617
2618 - `const InputTextInputText InputText = "input_text"`
2619
2620 - `type ChatKitThreadUserMessageItemContentQuotedText struct{…}`
2621
2622 Quoted snippet that the user referenced in their message.
2623
2624 - `Text string`
2625
2626 Quoted text content.
2627
2628 - `Type QuotedText`
2629
2630 Type discriminator that is always `quoted_text`.
2631
2632 - `const QuotedTextQuotedText QuotedText = "quoted_text"`
2633
2634 - `CreatedAt int64`
2635
2636 Unix timestamp (in seconds) for when the item was created.
2637
2638 - `InferenceOptions ChatKitThreadUserMessageItemInferenceOptions`
2639
2640 Inference overrides applied to the message. Defaults to null when unset.
2641
2642 - `Model string`
2643
2644 Model name that generated the response. Defaults to null when using the session default.
2645
2646 - `ToolChoice ChatKitThreadUserMessageItemInferenceOptionsToolChoice`
2647
2648 Preferred tool to invoke. Defaults to null when ChatKit should auto-select.
2649
2650 - `ID string`
2651
2652 Identifier of the requested tool.
2653
2654 - `Object ChatKitThreadItem`
2655
2656 Type discriminator that is always `chatkit.thread_item`.
2657
2658 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2659
2660 - `ThreadID string`
2661
2662 Identifier of the parent thread.
2663
2664 - `Type ChatKitUserMessage`
2665
2666 - `const ChatKitUserMessageChatKitUserMessage ChatKitUserMessage = "chatkit.user_message"`
2667
2668### ChatKit Widget Item
2669
2670- `type ChatKitWidgetItem struct{…}`
2671
2672 Thread item that renders a widget payload.
2673
2674 - `ID string`
2675
2676 Identifier of the thread item.
2677
2678 - `CreatedAt int64`
2679
2680 Unix timestamp (in seconds) for when the item was created.
2681
2682 - `Object ChatKitThreadItem`
2683
2684 Type discriminator that is always `chatkit.thread_item`.
2685
2686 - `const ChatKitThreadItemChatKitThreadItem ChatKitThreadItem = "chatkit.thread_item"`
2687
2688 - `ThreadID string`
2689
2690 Identifier of the parent thread.
2691
2692 - `Type ChatKitWidget`
2693
2694 Type discriminator that is always `chatkit.widget`.
2695
2696 - `const ChatKitWidgetChatKitWidget ChatKitWidget = "chatkit.widget"`
2697
2698 - `Widget string`
2699
2700 Serialized widget payload rendered in the UI.