-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstructured_outputs.go
More file actions
1388 lines (1248 loc) · 49.8 KB
/
structured_outputs.go
File metadata and controls
1388 lines (1248 loc) · 49.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
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
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by Fern. DO NOT EDIT.
package api
import (
json "encoding/json"
fmt "fmt"
internal "github.com/VapiAI/server-sdk-go/internal"
big "math/big"
time "time"
)
var (
structuredOutputControllerFindAllRequestFieldId = big.NewInt(1 << 0)
structuredOutputControllerFindAllRequestFieldName = big.NewInt(1 << 1)
structuredOutputControllerFindAllRequestFieldPage = big.NewInt(1 << 2)
structuredOutputControllerFindAllRequestFieldSortOrder = big.NewInt(1 << 3)
structuredOutputControllerFindAllRequestFieldLimit = big.NewInt(1 << 4)
structuredOutputControllerFindAllRequestFieldCreatedAtGt = big.NewInt(1 << 5)
structuredOutputControllerFindAllRequestFieldCreatedAtLt = big.NewInt(1 << 6)
structuredOutputControllerFindAllRequestFieldCreatedAtGe = big.NewInt(1 << 7)
structuredOutputControllerFindAllRequestFieldCreatedAtLe = big.NewInt(1 << 8)
structuredOutputControllerFindAllRequestFieldUpdatedAtGt = big.NewInt(1 << 9)
structuredOutputControllerFindAllRequestFieldUpdatedAtLt = big.NewInt(1 << 10)
structuredOutputControllerFindAllRequestFieldUpdatedAtGe = big.NewInt(1 << 11)
structuredOutputControllerFindAllRequestFieldUpdatedAtLe = big.NewInt(1 << 12)
)
type StructuredOutputControllerFindAllRequest struct {
// This will return structured outputs where the id matches the specified value.
Id *string `json:"-" url:"id,omitempty"`
// This will return structured outputs where the name matches the specified value.
Name *string `json:"-" url:"name,omitempty"`
// This is the page number to return. Defaults to 1.
Page *float64 `json:"-" url:"page,omitempty"`
// This is the sort order for pagination. Defaults to 'DESC'.
SortOrder *StructuredOutputControllerFindAllRequestSortOrder `json:"-" url:"sortOrder,omitempty"`
// This is the maximum number of items to return. Defaults to 100.
Limit *float64 `json:"-" url:"limit,omitempty"`
// This will return items where the createdAt is greater than the specified value.
CreatedAtGt *time.Time `json:"-" url:"createdAtGt,omitempty"`
// This will return items where the createdAt is less than the specified value.
CreatedAtLt *time.Time `json:"-" url:"createdAtLt,omitempty"`
// This will return items where the createdAt is greater than or equal to the specified value.
CreatedAtGe *time.Time `json:"-" url:"createdAtGe,omitempty"`
// This will return items where the createdAt is less than or equal to the specified value.
CreatedAtLe *time.Time `json:"-" url:"createdAtLe,omitempty"`
// This will return items where the updatedAt is greater than the specified value.
UpdatedAtGt *time.Time `json:"-" url:"updatedAtGt,omitempty"`
// This will return items where the updatedAt is less than the specified value.
UpdatedAtLt *time.Time `json:"-" url:"updatedAtLt,omitempty"`
// This will return items where the updatedAt is greater than or equal to the specified value.
UpdatedAtGe *time.Time `json:"-" url:"updatedAtGe,omitempty"`
// This will return items where the updatedAt is less than or equal to the specified value.
UpdatedAtLe *time.Time `json:"-" url:"updatedAtLe,omitempty"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
}
func (s *StructuredOutputControllerFindAllRequest) require(field *big.Int) {
if s.explicitFields == nil {
s.explicitFields = big.NewInt(0)
}
s.explicitFields.Or(s.explicitFields, field)
}
// SetId sets the Id field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetId(id *string) {
s.Id = id
s.require(structuredOutputControllerFindAllRequestFieldId)
}
// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetName(name *string) {
s.Name = name
s.require(structuredOutputControllerFindAllRequestFieldName)
}
// SetPage sets the Page field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetPage(page *float64) {
s.Page = page
s.require(structuredOutputControllerFindAllRequestFieldPage)
}
// SetSortOrder sets the SortOrder field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetSortOrder(sortOrder *StructuredOutputControllerFindAllRequestSortOrder) {
s.SortOrder = sortOrder
s.require(structuredOutputControllerFindAllRequestFieldSortOrder)
}
// SetLimit sets the Limit field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetLimit(limit *float64) {
s.Limit = limit
s.require(structuredOutputControllerFindAllRequestFieldLimit)
}
// SetCreatedAtGt sets the CreatedAtGt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetCreatedAtGt(createdAtGt *time.Time) {
s.CreatedAtGt = createdAtGt
s.require(structuredOutputControllerFindAllRequestFieldCreatedAtGt)
}
// SetCreatedAtLt sets the CreatedAtLt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetCreatedAtLt(createdAtLt *time.Time) {
s.CreatedAtLt = createdAtLt
s.require(structuredOutputControllerFindAllRequestFieldCreatedAtLt)
}
// SetCreatedAtGe sets the CreatedAtGe field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetCreatedAtGe(createdAtGe *time.Time) {
s.CreatedAtGe = createdAtGe
s.require(structuredOutputControllerFindAllRequestFieldCreatedAtGe)
}
// SetCreatedAtLe sets the CreatedAtLe field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetCreatedAtLe(createdAtLe *time.Time) {
s.CreatedAtLe = createdAtLe
s.require(structuredOutputControllerFindAllRequestFieldCreatedAtLe)
}
// SetUpdatedAtGt sets the UpdatedAtGt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetUpdatedAtGt(updatedAtGt *time.Time) {
s.UpdatedAtGt = updatedAtGt
s.require(structuredOutputControllerFindAllRequestFieldUpdatedAtGt)
}
// SetUpdatedAtLt sets the UpdatedAtLt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetUpdatedAtLt(updatedAtLt *time.Time) {
s.UpdatedAtLt = updatedAtLt
s.require(structuredOutputControllerFindAllRequestFieldUpdatedAtLt)
}
// SetUpdatedAtGe sets the UpdatedAtGe field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetUpdatedAtGe(updatedAtGe *time.Time) {
s.UpdatedAtGe = updatedAtGe
s.require(structuredOutputControllerFindAllRequestFieldUpdatedAtGe)
}
// SetUpdatedAtLe sets the UpdatedAtLe field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindAllRequest) SetUpdatedAtLe(updatedAtLe *time.Time) {
s.UpdatedAtLe = updatedAtLe
s.require(structuredOutputControllerFindAllRequestFieldUpdatedAtLe)
}
var (
structuredOutputControllerFindOneRequestFieldId = big.NewInt(1 << 0)
)
type StructuredOutputControllerFindOneRequest struct {
Id string `json:"-" url:"-"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
}
func (s *StructuredOutputControllerFindOneRequest) require(field *big.Int) {
if s.explicitFields == nil {
s.explicitFields = big.NewInt(0)
}
s.explicitFields.Or(s.explicitFields, field)
}
// SetId sets the Id field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerFindOneRequest) SetId(id string) {
s.Id = id
s.require(structuredOutputControllerFindOneRequestFieldId)
}
var (
structuredOutputControllerRemoveRequestFieldId = big.NewInt(1 << 0)
)
type StructuredOutputControllerRemoveRequest struct {
Id string `json:"-" url:"-"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
}
func (s *StructuredOutputControllerRemoveRequest) require(field *big.Int) {
if s.explicitFields == nil {
s.explicitFields = big.NewInt(0)
}
s.explicitFields.Or(s.explicitFields, field)
}
// SetId sets the Id field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputControllerRemoveRequest) SetId(id string) {
s.Id = id
s.require(structuredOutputControllerRemoveRequestFieldId)
}
var (
structuredOutputRunDtoFieldPreviewEnabled = big.NewInt(1 << 0)
structuredOutputRunDtoFieldStructuredOutputId = big.NewInt(1 << 1)
structuredOutputRunDtoFieldStructuredOutput = big.NewInt(1 << 2)
structuredOutputRunDtoFieldCallIds = big.NewInt(1 << 3)
)
type StructuredOutputRunDto struct {
// This is the preview flag for the re-run. If true, the re-run will be executed and the response will be returned immediately and the call artifact will NOT be updated.
// If false (default), the re-run will be executed and the response will be updated in the call artifact.
PreviewEnabled *bool `json:"previewEnabled,omitempty" url:"-"`
// This is the ID of the structured output that will be run. This must be provided unless a transient structured output is provided.
// When the re-run is executed, only the value of this structured output will be replaced with the new value, or added if not present.
StructuredOutputId *string `json:"structuredOutputId,omitempty" url:"-"`
// This is the transient structured output that will be run. This must be provided if a structured output ID is not provided.
// When the re-run is executed, the structured output value will be added to the existing artifact.
StructuredOutput *CreateStructuredOutputDto `json:"structuredOutput,omitempty" url:"-"`
// This is the array of callIds that will be updated with the new structured output value. If preview is true, this array must be provided and contain exactly 1 callId.
// If preview is false, up to 100 callIds may be provided.
CallIds []string `json:"callIds" url:"-"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
}
func (s *StructuredOutputRunDto) require(field *big.Int) {
if s.explicitFields == nil {
s.explicitFields = big.NewInt(0)
}
s.explicitFields.Or(s.explicitFields, field)
}
// SetPreviewEnabled sets the PreviewEnabled field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputRunDto) SetPreviewEnabled(previewEnabled *bool) {
s.PreviewEnabled = previewEnabled
s.require(structuredOutputRunDtoFieldPreviewEnabled)
}
// SetStructuredOutputId sets the StructuredOutputId field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputRunDto) SetStructuredOutputId(structuredOutputId *string) {
s.StructuredOutputId = structuredOutputId
s.require(structuredOutputRunDtoFieldStructuredOutputId)
}
// SetStructuredOutput sets the StructuredOutput field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputRunDto) SetStructuredOutput(structuredOutput *CreateStructuredOutputDto) {
s.StructuredOutput = structuredOutput
s.require(structuredOutputRunDtoFieldStructuredOutput)
}
// SetCallIds sets the CallIds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutputRunDto) SetCallIds(callIds []string) {
s.CallIds = callIds
s.require(structuredOutputRunDtoFieldCallIds)
}
func (s *StructuredOutputRunDto) UnmarshalJSON(data []byte) error {
type unmarshaler StructuredOutputRunDto
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*s = StructuredOutputRunDto(body)
return nil
}
func (s *StructuredOutputRunDto) MarshalJSON() ([]byte, error) {
type embed StructuredOutputRunDto
var marshaler = struct {
embed
}{
embed: embed(*s),
}
explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields)
return json.Marshal(explicitMarshaler)
}
var (
updateStructuredOutputDtoFieldId = big.NewInt(1 << 0)
updateStructuredOutputDtoFieldSchemaOverride = big.NewInt(1 << 1)
updateStructuredOutputDtoFieldType = big.NewInt(1 << 2)
updateStructuredOutputDtoFieldRegex = big.NewInt(1 << 3)
updateStructuredOutputDtoFieldModel = big.NewInt(1 << 4)
updateStructuredOutputDtoFieldCompliancePlan = big.NewInt(1 << 5)
updateStructuredOutputDtoFieldName = big.NewInt(1 << 6)
updateStructuredOutputDtoFieldDescription = big.NewInt(1 << 7)
updateStructuredOutputDtoFieldAssistantIds = big.NewInt(1 << 8)
updateStructuredOutputDtoFieldWorkflowIds = big.NewInt(1 << 9)
updateStructuredOutputDtoFieldSchema = big.NewInt(1 << 10)
)
type UpdateStructuredOutputDto struct {
Id string `json:"-" url:"-"`
SchemaOverride string `json:"-" url:"schemaOverride"`
// This is the type of structured output.
//
// - 'ai': Uses an LLM to extract structured data from the conversation (default).
// - 'regex': Uses a regex pattern to extract data from the transcript without an LLM.
Type *UpdateStructuredOutputDtoType `json:"type,omitempty" url:"-"`
// This is the regex pattern to match against the transcript.
//
// Only used when type is 'regex'. Supports both raw patterns (e.g. '\d+') and
// regex literal format (e.g. '/\d+/gi'). Uses RE2 syntax for safety.
//
// The result depends on the schema type:
// - boolean: true if the pattern matches, false otherwise
// - string: the first match or first capture group
// - number/integer: the first match parsed as a number
// - array: all matches
Regex *string `json:"regex,omitempty" url:"-"`
// This is the model that will be used to extract the structured output.
//
// To provide your own custom system and user prompts for structured output extraction, populate the messages array with your system and user messages. You can specify liquid templating in your system and user messages.
// Between the system or user messages, you must reference either 'transcript' or 'messages' with the `{{}}` syntax to access the conversation history.
// Between the system or user messages, you must reference a variation of the structured output with the `{{}}` syntax to access the structured output definition.
// i.e.:
// `{{structuredOutput}}`
// `{{structuredOutput.name}}`
// `{{structuredOutput.description}}`
// `{{structuredOutput.schema}}`
//
// If model is not specified, GPT-4.1 will be used by default for extraction, utilizing default system and user prompts.
// If messages or required fields are not specified, the default system and user prompts will be used.
Model *UpdateStructuredOutputDtoModel `json:"model,omitempty" url:"-"`
// Compliance configuration for this output. Only enable overrides if no sensitive data will be stored.
CompliancePlan *ComplianceOverride `json:"compliancePlan,omitempty" url:"-"`
// This is the name of the structured output.
Name *string `json:"name,omitempty" url:"-"`
// This is the description of what the structured output extracts.
//
// Use this to provide context about what data will be extracted and how it will be used.
Description *string `json:"description,omitempty" url:"-"`
// These are the assistant IDs that this structured output is linked to.
//
// When linked to assistants, this structured output will be available for extraction during those assistant's calls.
AssistantIds []string `json:"assistantIds,omitempty" url:"-"`
// These are the workflow IDs that this structured output is linked to.
//
// When linked to workflows, this structured output will be available for extraction during those workflow's execution.
WorkflowIds []string `json:"workflowIds,omitempty" url:"-"`
// This is the JSON Schema definition for the structured output.
//
// Defines the structure and validation rules for the data that will be extracted. Supports all JSON Schema features including:
// - Objects and nested properties
// - Arrays and array validation
// - String, number, boolean, and null types
// - Enums and const values
// - Validation constraints (min/max, patterns, etc.)
// - Composition with allOf, anyOf, oneOf
Schema *JsonSchema `json:"schema,omitempty" url:"-"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
}
func (u *UpdateStructuredOutputDto) require(field *big.Int) {
if u.explicitFields == nil {
u.explicitFields = big.NewInt(0)
}
u.explicitFields.Or(u.explicitFields, field)
}
// SetId sets the Id field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetId(id string) {
u.Id = id
u.require(updateStructuredOutputDtoFieldId)
}
// SetSchemaOverride sets the SchemaOverride field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetSchemaOverride(schemaOverride string) {
u.SchemaOverride = schemaOverride
u.require(updateStructuredOutputDtoFieldSchemaOverride)
}
// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetType(type_ *UpdateStructuredOutputDtoType) {
u.Type = type_
u.require(updateStructuredOutputDtoFieldType)
}
// SetRegex sets the Regex field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetRegex(regex *string) {
u.Regex = regex
u.require(updateStructuredOutputDtoFieldRegex)
}
// SetModel sets the Model field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetModel(model *UpdateStructuredOutputDtoModel) {
u.Model = model
u.require(updateStructuredOutputDtoFieldModel)
}
// SetCompliancePlan sets the CompliancePlan field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetCompliancePlan(compliancePlan *ComplianceOverride) {
u.CompliancePlan = compliancePlan
u.require(updateStructuredOutputDtoFieldCompliancePlan)
}
// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetName(name *string) {
u.Name = name
u.require(updateStructuredOutputDtoFieldName)
}
// SetDescription sets the Description field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetDescription(description *string) {
u.Description = description
u.require(updateStructuredOutputDtoFieldDescription)
}
// SetAssistantIds sets the AssistantIds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetAssistantIds(assistantIds []string) {
u.AssistantIds = assistantIds
u.require(updateStructuredOutputDtoFieldAssistantIds)
}
// SetWorkflowIds sets the WorkflowIds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetWorkflowIds(workflowIds []string) {
u.WorkflowIds = workflowIds
u.require(updateStructuredOutputDtoFieldWorkflowIds)
}
// SetSchema sets the Schema field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateStructuredOutputDto) SetSchema(schema *JsonSchema) {
u.Schema = schema
u.require(updateStructuredOutputDtoFieldSchema)
}
func (u *UpdateStructuredOutputDto) UnmarshalJSON(data []byte) error {
type unmarshaler UpdateStructuredOutputDto
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*u = UpdateStructuredOutputDto(body)
return nil
}
func (u *UpdateStructuredOutputDto) MarshalJSON() ([]byte, error) {
type embed UpdateStructuredOutputDto
var marshaler = struct {
embed
}{
embed: embed(*u),
}
explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields)
return json.Marshal(explicitMarshaler)
}
var (
structuredOutputFieldType = big.NewInt(1 << 0)
structuredOutputFieldRegex = big.NewInt(1 << 1)
structuredOutputFieldModel = big.NewInt(1 << 2)
structuredOutputFieldCompliancePlan = big.NewInt(1 << 3)
structuredOutputFieldId = big.NewInt(1 << 4)
structuredOutputFieldOrgId = big.NewInt(1 << 5)
structuredOutputFieldCreatedAt = big.NewInt(1 << 6)
structuredOutputFieldUpdatedAt = big.NewInt(1 << 7)
structuredOutputFieldName = big.NewInt(1 << 8)
structuredOutputFieldDescription = big.NewInt(1 << 9)
structuredOutputFieldAssistantIds = big.NewInt(1 << 10)
structuredOutputFieldWorkflowIds = big.NewInt(1 << 11)
structuredOutputFieldSchema = big.NewInt(1 << 12)
)
type StructuredOutput struct {
// This is the type of structured output.
//
// - 'ai': Uses an LLM to extract structured data from the conversation (default).
// - 'regex': Uses a regex pattern to extract data from the transcript without an LLM.
Type *StructuredOutputType `json:"type,omitempty" url:"type,omitempty"`
// This is the regex pattern to match against the transcript.
//
// Only used when type is 'regex'. Supports both raw patterns (e.g. '\d+') and
// regex literal format (e.g. '/\d+/gi'). Uses RE2 syntax for safety.
//
// The result depends on the schema type:
// - boolean: true if the pattern matches, false otherwise
// - string: the first match or first capture group
// - number/integer: the first match parsed as a number
// - array: all matches
Regex *string `json:"regex,omitempty" url:"regex,omitempty"`
// This is the model that will be used to extract the structured output.
//
// To provide your own custom system and user prompts for structured output extraction, populate the messages array with your system and user messages. You can specify liquid templating in your system and user messages.
// Between the system or user messages, you must reference either 'transcript' or 'messages' with the `{{}}` syntax to access the conversation history.
// Between the system or user messages, you must reference a variation of the structured output with the `{{}}` syntax to access the structured output definition.
// i.e.:
// `{{structuredOutput}}`
// `{{structuredOutput.name}}`
// `{{structuredOutput.description}}`
// `{{structuredOutput.schema}}`
//
// If model is not specified, GPT-4.1 will be used by default for extraction, utilizing default system and user prompts.
// If messages or required fields are not specified, the default system and user prompts will be used.
Model *StructuredOutputModel `json:"model,omitempty" url:"model,omitempty"`
// Compliance configuration for this output. Only enable overrides if no sensitive data will be stored.
CompliancePlan *ComplianceOverride `json:"compliancePlan,omitempty" url:"compliancePlan,omitempty"`
// This is the unique identifier for the structured output.
Id string `json:"id" url:"id"`
// This is the unique identifier for the org that this structured output belongs to.
OrgId string `json:"orgId" url:"orgId"`
// This is the ISO 8601 date-time string of when the structured output was created.
CreatedAt time.Time `json:"createdAt" url:"createdAt"`
// This is the ISO 8601 date-time string of when the structured output was last updated.
UpdatedAt time.Time `json:"updatedAt" url:"updatedAt"`
// This is the name of the structured output.
Name string `json:"name" url:"name"`
// This is the description of what the structured output extracts.
//
// Use this to provide context about what data will be extracted and how it will be used.
Description *string `json:"description,omitempty" url:"description,omitempty"`
// These are the assistant IDs that this structured output is linked to.
//
// When linked to assistants, this structured output will be available for extraction during those assistant's calls.
AssistantIds []string `json:"assistantIds,omitempty" url:"assistantIds,omitempty"`
// These are the workflow IDs that this structured output is linked to.
//
// When linked to workflows, this structured output will be available for extraction during those workflow's execution.
WorkflowIds []string `json:"workflowIds,omitempty" url:"workflowIds,omitempty"`
// This is the JSON Schema definition for the structured output.
//
// Defines the structure and validation rules for the data that will be extracted. Supports all JSON Schema features including:
// - Objects and nested properties
// - Arrays and array validation
// - String, number, boolean, and null types
// - Enums and const values
// - Validation constraints (min/max, patterns, etc.)
// - Composition with allOf, anyOf, oneOf
Schema *JsonSchema `json:"schema" url:"schema"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (s *StructuredOutput) GetType() *StructuredOutputType {
if s == nil {
return nil
}
return s.Type
}
func (s *StructuredOutput) GetRegex() *string {
if s == nil {
return nil
}
return s.Regex
}
func (s *StructuredOutput) GetModel() *StructuredOutputModel {
if s == nil {
return nil
}
return s.Model
}
func (s *StructuredOutput) GetCompliancePlan() *ComplianceOverride {
if s == nil {
return nil
}
return s.CompliancePlan
}
func (s *StructuredOutput) GetId() string {
if s == nil {
return ""
}
return s.Id
}
func (s *StructuredOutput) GetOrgId() string {
if s == nil {
return ""
}
return s.OrgId
}
func (s *StructuredOutput) GetCreatedAt() time.Time {
if s == nil {
return time.Time{}
}
return s.CreatedAt
}
func (s *StructuredOutput) GetUpdatedAt() time.Time {
if s == nil {
return time.Time{}
}
return s.UpdatedAt
}
func (s *StructuredOutput) GetName() string {
if s == nil {
return ""
}
return s.Name
}
func (s *StructuredOutput) GetDescription() *string {
if s == nil {
return nil
}
return s.Description
}
func (s *StructuredOutput) GetAssistantIds() []string {
if s == nil {
return nil
}
return s.AssistantIds
}
func (s *StructuredOutput) GetWorkflowIds() []string {
if s == nil {
return nil
}
return s.WorkflowIds
}
func (s *StructuredOutput) GetSchema() *JsonSchema {
if s == nil {
return nil
}
return s.Schema
}
func (s *StructuredOutput) GetExtraProperties() map[string]interface{} {
if s == nil {
return nil
}
return s.extraProperties
}
func (s *StructuredOutput) require(field *big.Int) {
if s.explicitFields == nil {
s.explicitFields = big.NewInt(0)
}
s.explicitFields.Or(s.explicitFields, field)
}
// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetType(type_ *StructuredOutputType) {
s.Type = type_
s.require(structuredOutputFieldType)
}
// SetRegex sets the Regex field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetRegex(regex *string) {
s.Regex = regex
s.require(structuredOutputFieldRegex)
}
// SetModel sets the Model field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetModel(model *StructuredOutputModel) {
s.Model = model
s.require(structuredOutputFieldModel)
}
// SetCompliancePlan sets the CompliancePlan field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetCompliancePlan(compliancePlan *ComplianceOverride) {
s.CompliancePlan = compliancePlan
s.require(structuredOutputFieldCompliancePlan)
}
// SetId sets the Id field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetId(id string) {
s.Id = id
s.require(structuredOutputFieldId)
}
// SetOrgId sets the OrgId field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetOrgId(orgId string) {
s.OrgId = orgId
s.require(structuredOutputFieldOrgId)
}
// SetCreatedAt sets the CreatedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetCreatedAt(createdAt time.Time) {
s.CreatedAt = createdAt
s.require(structuredOutputFieldCreatedAt)
}
// SetUpdatedAt sets the UpdatedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetUpdatedAt(updatedAt time.Time) {
s.UpdatedAt = updatedAt
s.require(structuredOutputFieldUpdatedAt)
}
// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetName(name string) {
s.Name = name
s.require(structuredOutputFieldName)
}
// SetDescription sets the Description field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetDescription(description *string) {
s.Description = description
s.require(structuredOutputFieldDescription)
}
// SetAssistantIds sets the AssistantIds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetAssistantIds(assistantIds []string) {
s.AssistantIds = assistantIds
s.require(structuredOutputFieldAssistantIds)
}
// SetWorkflowIds sets the WorkflowIds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetWorkflowIds(workflowIds []string) {
s.WorkflowIds = workflowIds
s.require(structuredOutputFieldWorkflowIds)
}
// SetSchema sets the Schema field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *StructuredOutput) SetSchema(schema *JsonSchema) {
s.Schema = schema
s.require(structuredOutputFieldSchema)
}
func (s *StructuredOutput) UnmarshalJSON(data []byte) error {
type embed StructuredOutput
var unmarshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
UpdatedAt *internal.DateTime `json:"updatedAt"`
}{
embed: embed(*s),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*s = StructuredOutput(unmarshaler.embed)
s.CreatedAt = unmarshaler.CreatedAt.Time()
s.UpdatedAt = unmarshaler.UpdatedAt.Time()
extraProperties, err := internal.ExtractExtraProperties(data, *s)
if err != nil {
return err
}
s.extraProperties = extraProperties
s.rawJSON = json.RawMessage(data)
return nil
}
func (s *StructuredOutput) MarshalJSON() ([]byte, error) {
type embed StructuredOutput
var marshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
UpdatedAt *internal.DateTime `json:"updatedAt"`
}{
embed: embed(*s),
CreatedAt: internal.NewDateTime(s.CreatedAt),
UpdatedAt: internal.NewDateTime(s.UpdatedAt),
}
explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields)
return json.Marshal(explicitMarshaler)
}
func (s *StructuredOutput) String() string {
if s == nil {
return "<nil>"
}
if len(s.rawJSON) > 0 {
if value, err := internal.StringifyJSON(s.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
// This is the model that will be used to extract the structured output.
//
// To provide your own custom system and user prompts for structured output extraction, populate the messages array with your system and user messages. You can specify liquid templating in your system and user messages.
// Between the system or user messages, you must reference either 'transcript' or 'messages' with the `{{}}` syntax to access the conversation history.
// Between the system or user messages, you must reference a variation of the structured output with the `{{}}` syntax to access the structured output definition.
// i.e.:
// `{{structuredOutput}}`
// `{{structuredOutput.name}}`
// `{{structuredOutput.description}}`
// `{{structuredOutput.schema}}`
//
// If model is not specified, GPT-4.1 will be used by default for extraction, utilizing default system and user prompts.
// If messages or required fields are not specified, the default system and user prompts will be used.
type StructuredOutputModel struct {
Provider string
Openai *WorkflowOpenAiModel
Anthropic *WorkflowAnthropicModel
AnthropicBedrock *WorkflowAnthropicBedrockModel
Google *WorkflowGoogleModel
CustomLlm *WorkflowCustomModel
}
func (s *StructuredOutputModel) GetProvider() string {
if s == nil {
return ""
}
return s.Provider
}
func (s *StructuredOutputModel) GetOpenai() *WorkflowOpenAiModel {
if s == nil {
return nil
}
return s.Openai
}
func (s *StructuredOutputModel) GetAnthropic() *WorkflowAnthropicModel {
if s == nil {
return nil
}
return s.Anthropic
}
func (s *StructuredOutputModel) GetAnthropicBedrock() *WorkflowAnthropicBedrockModel {
if s == nil {
return nil
}
return s.AnthropicBedrock
}
func (s *StructuredOutputModel) GetGoogle() *WorkflowGoogleModel {
if s == nil {
return nil
}
return s.Google
}
func (s *StructuredOutputModel) GetCustomLlm() *WorkflowCustomModel {
if s == nil {
return nil
}
return s.CustomLlm
}
func (s *StructuredOutputModel) UnmarshalJSON(data []byte) error {
var unmarshaler struct {
Provider string `json:"provider"`
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
s.Provider = unmarshaler.Provider
if unmarshaler.Provider == "" {
return fmt.Errorf("%T did not include discriminant provider", s)
}
switch unmarshaler.Provider {
case "openai":
value := new(WorkflowOpenAiModel)
if err := json.Unmarshal(data, &value); err != nil {
return err
}
s.Openai = value
case "anthropic":
value := new(WorkflowAnthropicModel)
if err := json.Unmarshal(data, &value); err != nil {
return err
}
s.Anthropic = value
case "anthropic-bedrock":
value := new(WorkflowAnthropicBedrockModel)
if err := json.Unmarshal(data, &value); err != nil {
return err
}
s.AnthropicBedrock = value
case "google":
value := new(WorkflowGoogleModel)
if err := json.Unmarshal(data, &value); err != nil {
return err
}
s.Google = value
case "custom-llm":
value := new(WorkflowCustomModel)
if err := json.Unmarshal(data, &value); err != nil {
return err
}
s.CustomLlm = value
}
return nil
}
func (s StructuredOutputModel) MarshalJSON() ([]byte, error) {
if err := s.validate(); err != nil {
return nil, err
}
if s.Openai != nil {
return internal.MarshalJSONWithExtraProperty(s.Openai, "provider", "openai")
}
if s.Anthropic != nil {
return internal.MarshalJSONWithExtraProperty(s.Anthropic, "provider", "anthropic")
}
if s.AnthropicBedrock != nil {
return internal.MarshalJSONWithExtraProperty(s.AnthropicBedrock, "provider", "anthropic-bedrock")
}
if s.Google != nil {
return internal.MarshalJSONWithExtraProperty(s.Google, "provider", "google")
}
if s.CustomLlm != nil {
return internal.MarshalJSONWithExtraProperty(s.CustomLlm, "provider", "custom-llm")
}
return nil, fmt.Errorf("type %T does not define a non-empty union type", s)
}
type StructuredOutputModelVisitor interface {
VisitOpenai(*WorkflowOpenAiModel) error
VisitAnthropic(*WorkflowAnthropicModel) error
VisitAnthropicBedrock(*WorkflowAnthropicBedrockModel) error
VisitGoogle(*WorkflowGoogleModel) error
VisitCustomLlm(*WorkflowCustomModel) error
}
func (s *StructuredOutputModel) Accept(visitor StructuredOutputModelVisitor) error {
if s.Openai != nil {
return visitor.VisitOpenai(s.Openai)
}
if s.Anthropic != nil {
return visitor.VisitAnthropic(s.Anthropic)
}
if s.AnthropicBedrock != nil {
return visitor.VisitAnthropicBedrock(s.AnthropicBedrock)
}
if s.Google != nil {
return visitor.VisitGoogle(s.Google)
}
if s.CustomLlm != nil {
return visitor.VisitCustomLlm(s.CustomLlm)
}
return fmt.Errorf("type %T does not define a non-empty union type", s)
}
func (s *StructuredOutputModel) validate() error {
if s == nil {
return fmt.Errorf("type %T is nil", s)
}
var fields []string
if s.Openai != nil {
fields = append(fields, "openai")
}
if s.Anthropic != nil {
fields = append(fields, "anthropic")
}
if s.AnthropicBedrock != nil {
fields = append(fields, "anthropic-bedrock")
}
if s.Google != nil {
fields = append(fields, "google")
}
if s.CustomLlm != nil {
fields = append(fields, "custom-llm")
}
if len(fields) == 0 {
if s.Provider != "" {
return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Provider)
}
return fmt.Errorf("type %T is empty", s)
}
if len(fields) > 1 {
return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields)
}
if s.Provider != "" {