-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdatasetrun.go
More file actions
604 lines (543 loc) · 26.4 KB
/
datasetrun.go
File metadata and controls
604 lines (543 loc) · 26.4 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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package langsmith
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"reflect"
"slices"
"time"
"github.com/langchain-ai/langsmith-go/internal/apijson"
"github.com/langchain-ai/langsmith-go/internal/apiquery"
"github.com/langchain-ai/langsmith-go/internal/param"
"github.com/langchain-ai/langsmith-go/internal/requestconfig"
"github.com/langchain-ai/langsmith-go/option"
"github.com/tidwall/gjson"
)
// DatasetRunService contains methods and other services that help with interacting
// with the langChain API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewDatasetRunService] method instead.
type DatasetRunService struct {
Options []option.RequestOption
}
// NewDatasetRunService generates a new service that applies the given options to
// each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewDatasetRunService(opts ...option.RequestOption) (r *DatasetRunService) {
r = &DatasetRunService{}
r.Options = opts
return
}
// Fetch examples for a dataset, and fetch the runs for each example if they are
// associated with the given session_ids.
func (r *DatasetRunService) New(ctx context.Context, datasetID string, params DatasetRunNewParams, opts ...option.RequestOption) (res *DatasetRunNewResponseUnion, err error) {
var env apijson.UnionUnmarshaler[DatasetRunNewResponseUnion]
opts = slices.Concat(r.Options, opts)
if datasetID == "" {
err = errors.New("missing required dataset_id parameter")
return
}
path := fmt.Sprintf("api/v1/datasets/%s/runs", datasetID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...)
if err != nil {
return
}
res = &env.Value
return
}
// Fetch the number of regressions/improvements for each example in a dataset,
// between sessions[0] and sessions[1].
func (r *DatasetRunService) Delta(ctx context.Context, datasetID string, body DatasetRunDeltaParams, opts ...option.RequestOption) (res *SessionFeedbackDelta, err error) {
opts = slices.Concat(r.Options, opts)
if datasetID == "" {
err = errors.New("missing required dataset_id parameter")
return
}
path := fmt.Sprintf("api/v1/datasets/%s/runs/delta", datasetID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Example schema with list of runs.
type ExampleWithRuns struct {
ID string `json:"id,required" format:"uuid"`
DatasetID string `json:"dataset_id,required" format:"uuid"`
Inputs map[string]interface{} `json:"inputs,required"`
Name string `json:"name,required"`
Runs []ExampleWithRunsRun `json:"runs,required"`
AttachmentURLs map[string]interface{} `json:"attachment_urls,nullable"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
Metadata map[string]interface{} `json:"metadata,nullable"`
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
Outputs map[string]interface{} `json:"outputs,nullable"`
SourceRunID string `json:"source_run_id,nullable" format:"uuid"`
JSON exampleWithRunsJSON `json:"-"`
}
// exampleWithRunsJSON contains the JSON metadata for the struct [ExampleWithRuns]
type exampleWithRunsJSON struct {
ID apijson.Field
DatasetID apijson.Field
Inputs apijson.Field
Name apijson.Field
Runs apijson.Field
AttachmentURLs apijson.Field
CreatedAt apijson.Field
Metadata apijson.Field
ModifiedAt apijson.Field
Outputs apijson.Field
SourceRunID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExampleWithRuns) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exampleWithRunsJSON) RawJSON() string {
return r.raw
}
// Run schema.
type ExampleWithRunsRun struct {
ID string `json:"id,required" format:"uuid"`
AppPath string `json:"app_path,required"`
DottedOrder string `json:"dotted_order,required"`
Name string `json:"name,required"`
// Enum for run types.
RunType ExampleWithRunsRunsRunType `json:"run_type,required"`
SessionID string `json:"session_id,required" format:"uuid"`
Status string `json:"status,required"`
TraceID string `json:"trace_id,required" format:"uuid"`
ChildRunIDs []string `json:"child_run_ids,nullable" format:"uuid"`
CompletionCost string `json:"completion_cost,nullable"`
CompletionCostDetails map[string]string `json:"completion_cost_details,nullable"`
CompletionTokenDetails map[string]int64 `json:"completion_token_details,nullable"`
CompletionTokens int64 `json:"completion_tokens"`
DirectChildRunIDs []string `json:"direct_child_run_ids,nullable" format:"uuid"`
EndTime time.Time `json:"end_time,nullable" format:"date-time"`
Error string `json:"error,nullable"`
Events []map[string]interface{} `json:"events,nullable"`
ExecutionOrder int64 `json:"execution_order"`
Extra map[string]interface{} `json:"extra,nullable"`
FeedbackStats map[string]map[string]interface{} `json:"feedback_stats,nullable"`
FirstTokenTime time.Time `json:"first_token_time,nullable" format:"date-time"`
InDataset bool `json:"in_dataset,nullable"`
Inputs map[string]interface{} `json:"inputs,nullable"`
InputsPreview string `json:"inputs_preview,nullable"`
InputsS3URLs map[string]interface{} `json:"inputs_s3_urls,nullable"`
LastQueuedAt time.Time `json:"last_queued_at,nullable" format:"date-time"`
ManifestID string `json:"manifest_id,nullable" format:"uuid"`
ManifestS3ID string `json:"manifest_s3_id,nullable" format:"uuid"`
Messages []map[string]interface{} `json:"messages,nullable"`
Outputs map[string]interface{} `json:"outputs,nullable"`
OutputsPreview string `json:"outputs_preview,nullable"`
OutputsS3URLs map[string]interface{} `json:"outputs_s3_urls,nullable"`
ParentRunID string `json:"parent_run_id,nullable" format:"uuid"`
ParentRunIDs []string `json:"parent_run_ids,nullable" format:"uuid"`
PriceModelID string `json:"price_model_id,nullable" format:"uuid"`
PromptCost string `json:"prompt_cost,nullable"`
PromptCostDetails map[string]string `json:"prompt_cost_details,nullable"`
PromptTokenDetails map[string]int64 `json:"prompt_token_details,nullable"`
PromptTokens int64 `json:"prompt_tokens"`
ReferenceDatasetID string `json:"reference_dataset_id,nullable" format:"uuid"`
ReferenceExampleID string `json:"reference_example_id,nullable" format:"uuid"`
S3URLs map[string]interface{} `json:"s3_urls,nullable"`
Serialized map[string]interface{} `json:"serialized,nullable"`
ShareToken string `json:"share_token,nullable" format:"uuid"`
StartTime time.Time `json:"start_time" format:"date-time"`
Tags []string `json:"tags,nullable"`
ThreadID string `json:"thread_id,nullable"`
TotalCost string `json:"total_cost,nullable"`
TotalTokens int64 `json:"total_tokens"`
TraceFirstReceivedAt time.Time `json:"trace_first_received_at,nullable" format:"date-time"`
TraceMaxStartTime time.Time `json:"trace_max_start_time,nullable" format:"date-time"`
TraceMinStartTime time.Time `json:"trace_min_start_time,nullable" format:"date-time"`
TraceTier ExampleWithRunsRunsTraceTier `json:"trace_tier,nullable"`
TraceUpgrade bool `json:"trace_upgrade"`
TtlSeconds int64 `json:"ttl_seconds,nullable"`
JSON exampleWithRunsRunJSON `json:"-"`
}
// exampleWithRunsRunJSON contains the JSON metadata for the struct
// [ExampleWithRunsRun]
type exampleWithRunsRunJSON struct {
ID apijson.Field
AppPath apijson.Field
DottedOrder apijson.Field
Name apijson.Field
RunType apijson.Field
SessionID apijson.Field
Status apijson.Field
TraceID apijson.Field
ChildRunIDs apijson.Field
CompletionCost apijson.Field
CompletionCostDetails apijson.Field
CompletionTokenDetails apijson.Field
CompletionTokens apijson.Field
DirectChildRunIDs apijson.Field
EndTime apijson.Field
Error apijson.Field
Events apijson.Field
ExecutionOrder apijson.Field
Extra apijson.Field
FeedbackStats apijson.Field
FirstTokenTime apijson.Field
InDataset apijson.Field
Inputs apijson.Field
InputsPreview apijson.Field
InputsS3URLs apijson.Field
LastQueuedAt apijson.Field
ManifestID apijson.Field
ManifestS3ID apijson.Field
Messages apijson.Field
Outputs apijson.Field
OutputsPreview apijson.Field
OutputsS3URLs apijson.Field
ParentRunID apijson.Field
ParentRunIDs apijson.Field
PriceModelID apijson.Field
PromptCost apijson.Field
PromptCostDetails apijson.Field
PromptTokenDetails apijson.Field
PromptTokens apijson.Field
ReferenceDatasetID apijson.Field
ReferenceExampleID apijson.Field
S3URLs apijson.Field
Serialized apijson.Field
ShareToken apijson.Field
StartTime apijson.Field
Tags apijson.Field
ThreadID apijson.Field
TotalCost apijson.Field
TotalTokens apijson.Field
TraceFirstReceivedAt apijson.Field
TraceMaxStartTime apijson.Field
TraceMinStartTime apijson.Field
TraceTier apijson.Field
TraceUpgrade apijson.Field
TtlSeconds apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExampleWithRunsRun) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exampleWithRunsRunJSON) RawJSON() string {
return r.raw
}
// Enum for run types.
type ExampleWithRunsRunsRunType string
const (
ExampleWithRunsRunsRunTypeTool ExampleWithRunsRunsRunType = "tool"
ExampleWithRunsRunsRunTypeChain ExampleWithRunsRunsRunType = "chain"
ExampleWithRunsRunsRunTypeLlm ExampleWithRunsRunsRunType = "llm"
ExampleWithRunsRunsRunTypeRetriever ExampleWithRunsRunsRunType = "retriever"
ExampleWithRunsRunsRunTypeEmbedding ExampleWithRunsRunsRunType = "embedding"
ExampleWithRunsRunsRunTypePrompt ExampleWithRunsRunsRunType = "prompt"
ExampleWithRunsRunsRunTypeParser ExampleWithRunsRunsRunType = "parser"
)
func (r ExampleWithRunsRunsRunType) IsKnown() bool {
switch r {
case ExampleWithRunsRunsRunTypeTool, ExampleWithRunsRunsRunTypeChain, ExampleWithRunsRunsRunTypeLlm, ExampleWithRunsRunsRunTypeRetriever, ExampleWithRunsRunsRunTypeEmbedding, ExampleWithRunsRunsRunTypePrompt, ExampleWithRunsRunsRunTypeParser:
return true
}
return false
}
type ExampleWithRunsRunsTraceTier string
const (
ExampleWithRunsRunsTraceTierLonglived ExampleWithRunsRunsTraceTier = "longlived"
ExampleWithRunsRunsTraceTierShortlived ExampleWithRunsRunsTraceTier = "shortlived"
)
func (r ExampleWithRunsRunsTraceTier) IsKnown() bool {
switch r {
case ExampleWithRunsRunsTraceTierLonglived, ExampleWithRunsRunsTraceTierShortlived:
return true
}
return false
}
// Example schema with list of runs from ClickHouse.
//
// For non-grouped endpoint (/datasets/{dataset_id}/runs): runs from single
// session. For grouped endpoint (/datasets/{dataset_id}/group/runs): flat array of
// runs from all sessions, where each run has a session_id field for frontend to
// determine column placement.
type ExampleWithRunsCh struct {
ID string `json:"id,required" format:"uuid"`
DatasetID string `json:"dataset_id,required" format:"uuid"`
Inputs map[string]interface{} `json:"inputs,required"`
Name string `json:"name,required"`
Runs []ExampleWithRunsChRun `json:"runs,required"`
AttachmentURLs map[string]interface{} `json:"attachment_urls,nullable"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
Metadata map[string]interface{} `json:"metadata,nullable"`
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
Outputs map[string]interface{} `json:"outputs,nullable"`
SourceRunID string `json:"source_run_id,nullable" format:"uuid"`
JSON exampleWithRunsChJSON `json:"-"`
}
// exampleWithRunsChJSON contains the JSON metadata for the struct
// [ExampleWithRunsCh]
type exampleWithRunsChJSON struct {
ID apijson.Field
DatasetID apijson.Field
Inputs apijson.Field
Name apijson.Field
Runs apijson.Field
AttachmentURLs apijson.Field
CreatedAt apijson.Field
Metadata apijson.Field
ModifiedAt apijson.Field
Outputs apijson.Field
SourceRunID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExampleWithRunsCh) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exampleWithRunsChJSON) RawJSON() string {
return r.raw
}
// Run schema for comparison view.
type ExampleWithRunsChRun struct {
ID string `json:"id,required" format:"uuid"`
Name string `json:"name,required"`
// Enum for run types.
RunType ExampleWithRunsChRunsRunType `json:"run_type,required"`
SessionID string `json:"session_id,required" format:"uuid"`
Status string `json:"status,required"`
TraceID string `json:"trace_id,required" format:"uuid"`
AppPath string `json:"app_path,nullable"`
CompletionCost string `json:"completion_cost,nullable"`
CompletionTokens int64 `json:"completion_tokens,nullable"`
DottedOrder string `json:"dotted_order,nullable"`
EndTime time.Time `json:"end_time,nullable" format:"date-time"`
Error string `json:"error,nullable"`
Events []map[string]interface{} `json:"events,nullable"`
ExecutionOrder int64 `json:"execution_order"`
Extra map[string]interface{} `json:"extra,nullable"`
FeedbackStats map[string]map[string]interface{} `json:"feedback_stats,nullable"`
Feedbacks []FeedbackSchema `json:"feedbacks"`
Inputs map[string]interface{} `json:"inputs,nullable"`
InputsPreview string `json:"inputs_preview,nullable"`
InputsS3URLs map[string]interface{} `json:"inputs_s3_urls,nullable"`
ManifestID string `json:"manifest_id,nullable" format:"uuid"`
ManifestS3ID string `json:"manifest_s3_id,nullable" format:"uuid"`
Outputs map[string]interface{} `json:"outputs,nullable"`
OutputsPreview string `json:"outputs_preview,nullable"`
OutputsS3URLs map[string]interface{} `json:"outputs_s3_urls,nullable"`
ParentRunID string `json:"parent_run_id,nullable" format:"uuid"`
PromptCost string `json:"prompt_cost,nullable"`
PromptTokens int64 `json:"prompt_tokens,nullable"`
ReferenceExampleID string `json:"reference_example_id,nullable" format:"uuid"`
S3URLs map[string]interface{} `json:"s3_urls,nullable"`
Serialized map[string]interface{} `json:"serialized,nullable"`
StartTime time.Time `json:"start_time" format:"date-time"`
Tags []string `json:"tags,nullable"`
TotalCost string `json:"total_cost,nullable"`
TotalTokens int64 `json:"total_tokens,nullable"`
TraceMaxStartTime time.Time `json:"trace_max_start_time,nullable" format:"date-time"`
TraceMinStartTime time.Time `json:"trace_min_start_time,nullable" format:"date-time"`
JSON exampleWithRunsChRunJSON `json:"-"`
}
// exampleWithRunsChRunJSON contains the JSON metadata for the struct
// [ExampleWithRunsChRun]
type exampleWithRunsChRunJSON struct {
ID apijson.Field
Name apijson.Field
RunType apijson.Field
SessionID apijson.Field
Status apijson.Field
TraceID apijson.Field
AppPath apijson.Field
CompletionCost apijson.Field
CompletionTokens apijson.Field
DottedOrder apijson.Field
EndTime apijson.Field
Error apijson.Field
Events apijson.Field
ExecutionOrder apijson.Field
Extra apijson.Field
FeedbackStats apijson.Field
Feedbacks apijson.Field
Inputs apijson.Field
InputsPreview apijson.Field
InputsS3URLs apijson.Field
ManifestID apijson.Field
ManifestS3ID apijson.Field
Outputs apijson.Field
OutputsPreview apijson.Field
OutputsS3URLs apijson.Field
ParentRunID apijson.Field
PromptCost apijson.Field
PromptTokens apijson.Field
ReferenceExampleID apijson.Field
S3URLs apijson.Field
Serialized apijson.Field
StartTime apijson.Field
Tags apijson.Field
TotalCost apijson.Field
TotalTokens apijson.Field
TraceMaxStartTime apijson.Field
TraceMinStartTime apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExampleWithRunsChRun) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exampleWithRunsChRunJSON) RawJSON() string {
return r.raw
}
// Enum for run types.
type ExampleWithRunsChRunsRunType string
const (
ExampleWithRunsChRunsRunTypeTool ExampleWithRunsChRunsRunType = "tool"
ExampleWithRunsChRunsRunTypeChain ExampleWithRunsChRunsRunType = "chain"
ExampleWithRunsChRunsRunTypeLlm ExampleWithRunsChRunsRunType = "llm"
ExampleWithRunsChRunsRunTypeRetriever ExampleWithRunsChRunsRunType = "retriever"
ExampleWithRunsChRunsRunTypeEmbedding ExampleWithRunsChRunsRunType = "embedding"
ExampleWithRunsChRunsRunTypePrompt ExampleWithRunsChRunsRunType = "prompt"
ExampleWithRunsChRunsRunTypeParser ExampleWithRunsChRunsRunType = "parser"
)
func (r ExampleWithRunsChRunsRunType) IsKnown() bool {
switch r {
case ExampleWithRunsChRunsRunTypeTool, ExampleWithRunsChRunsRunTypeChain, ExampleWithRunsChRunsRunTypeLlm, ExampleWithRunsChRunsRunTypeRetriever, ExampleWithRunsChRunsRunTypeEmbedding, ExampleWithRunsChRunsRunTypePrompt, ExampleWithRunsChRunsRunTypeParser:
return true
}
return false
}
type QueryFeedbackDeltaParam struct {
BaselineSessionID param.Field[string] `json:"baseline_session_id,required" format:"uuid"`
ComparisonSessionIDs param.Field[[]string] `json:"comparison_session_ids,required" format:"uuid"`
FeedbackKey param.Field[string] `json:"feedback_key,required"`
ComparativeExperimentID param.Field[string] `json:"comparative_experiment_id" format:"uuid"`
Filters param.Field[map[string][]string] `json:"filters"`
Limit param.Field[int64] `json:"limit"`
Offset param.Field[int64] `json:"offset"`
}
func (r QueryFeedbackDeltaParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// List of feedback keys with number of improvements and regressions for each.
type SessionFeedbackDelta struct {
FeedbackDeltas map[string]SessionFeedbackDeltaFeedbackDelta `json:"feedback_deltas,required"`
JSON sessionFeedbackDeltaJSON `json:"-"`
}
// sessionFeedbackDeltaJSON contains the JSON metadata for the struct
// [SessionFeedbackDelta]
type sessionFeedbackDeltaJSON struct {
FeedbackDeltas apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SessionFeedbackDelta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sessionFeedbackDeltaJSON) RawJSON() string {
return r.raw
}
// Feedback key with number of improvements and regressions.
type SessionFeedbackDeltaFeedbackDelta struct {
ImprovedExamples []string `json:"improved_examples,required" format:"uuid"`
RegressedExamples []string `json:"regressed_examples,required" format:"uuid"`
JSON sessionFeedbackDeltaFeedbackDeltaJSON `json:"-"`
}
// sessionFeedbackDeltaFeedbackDeltaJSON contains the JSON metadata for the struct
// [SessionFeedbackDeltaFeedbackDelta]
type sessionFeedbackDeltaFeedbackDeltaJSON struct {
ImprovedExamples apijson.Field
RegressedExamples apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SessionFeedbackDeltaFeedbackDelta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sessionFeedbackDeltaFeedbackDeltaJSON) RawJSON() string {
return r.raw
}
type SortParamsForRunsComparisonView struct {
SortBy param.Field[string] `json:"sort_by,required"`
SortOrder param.Field[SortParamsForRunsComparisonViewSortOrder] `json:"sort_order"`
}
func (r SortParamsForRunsComparisonView) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type SortParamsForRunsComparisonViewSortOrder string
const (
SortParamsForRunsComparisonViewSortOrderAsc SortParamsForRunsComparisonViewSortOrder = "ASC"
SortParamsForRunsComparisonViewSortOrderDesc SortParamsForRunsComparisonViewSortOrder = "DESC"
)
func (r SortParamsForRunsComparisonViewSortOrder) IsKnown() bool {
switch r {
case SortParamsForRunsComparisonViewSortOrderAsc, SortParamsForRunsComparisonViewSortOrderDesc:
return true
}
return false
}
// Union satisfied by [DatasetRunNewResponseExamplesWithRuns] or
// [DatasetRunNewResponseArray].
type DatasetRunNewResponseUnion interface {
implementsDatasetRunNewResponseUnion()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*DatasetRunNewResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(DatasetRunNewResponseExamplesWithRuns{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(DatasetRunNewResponseArray{}),
},
)
}
type DatasetRunNewResponseExamplesWithRuns []ExampleWithRuns
func (r DatasetRunNewResponseExamplesWithRuns) implementsDatasetRunNewResponseUnion() {}
type DatasetRunNewResponseArray []ExampleWithRunsCh
func (r DatasetRunNewResponseArray) implementsDatasetRunNewResponseUnion() {}
type DatasetRunNewParams struct {
SessionIDs param.Field[[]string] `json:"session_ids,required" format:"uuid"`
// Response format, e.g., 'csv'
Format param.Field[DatasetRunNewParamsFormat] `query:"format"`
ComparativeExperimentID param.Field[string] `json:"comparative_experiment_id" format:"uuid"`
ExampleIDs param.Field[[]string] `json:"example_ids" format:"uuid"`
Filters param.Field[map[string][]string] `json:"filters"`
Limit param.Field[int64] `json:"limit"`
Offset param.Field[int64] `json:"offset"`
Preview param.Field[bool] `json:"preview"`
SortParams param.Field[SortParamsForRunsComparisonView] `json:"sort_params"`
Stream param.Field[bool] `json:"stream"`
}
func (r DatasetRunNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// URLQuery serializes [DatasetRunNewParams]'s query parameters as `url.Values`.
func (r DatasetRunNewParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Response format, e.g., 'csv'
type DatasetRunNewParamsFormat string
const (
DatasetRunNewParamsFormatCsv DatasetRunNewParamsFormat = "csv"
)
func (r DatasetRunNewParamsFormat) IsKnown() bool {
switch r {
case DatasetRunNewParamsFormatCsv:
return true
}
return false
}
type DatasetRunDeltaParams struct {
QueryFeedbackDelta QueryFeedbackDeltaParam `json:"query_feedback_delta,required"`
}
func (r DatasetRunDeltaParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.QueryFeedbackDelta)
}