-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathexamplebulk.go
More file actions
125 lines (103 loc) · 5.27 KB
/
examplebulk.go
File metadata and controls
125 lines (103 loc) · 5.27 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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package langsmith
import (
"context"
"net/http"
"slices"
"github.com/langchain-ai/langsmith-go/internal/apijson"
"github.com/langchain-ai/langsmith-go/internal/param"
"github.com/langchain-ai/langsmith-go/internal/requestconfig"
"github.com/langchain-ai/langsmith-go/option"
)
// ExampleBulkService 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 [NewExampleBulkService] method instead.
type ExampleBulkService struct {
Options []option.RequestOption
}
// NewExampleBulkService 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 NewExampleBulkService(opts ...option.RequestOption) (r *ExampleBulkService) {
r = &ExampleBulkService{}
r.Options = opts
return
}
// Create bulk examples.
func (r *ExampleBulkService) New(ctx context.Context, body ExampleBulkNewParams, opts ...option.RequestOption) (res *[]Example, err error) {
opts = slices.Concat(r.Options, opts)
path := "api/v1/examples/bulk"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Legacy update examples in bulk. For update involving attachments, use PATCH
// /v1/platform/datasets/{dataset_id}/examples instead.
func (r *ExampleBulkService) PatchAll(ctx context.Context, body ExampleBulkPatchAllParams, opts ...option.RequestOption) (res *ExampleBulkPatchAllResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "api/v1/examples/bulk"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return res, err
}
type ExampleBulkPatchAllResponse = interface{}
type ExampleBulkNewParams struct {
// Schema for a batch of examples to be created.
Body []ExampleBulkNewParamsBody `json:"body" api:"required"`
}
func (r ExampleBulkNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
}
// Example with optional created_at to prevent duplicate versions in bulk
// operations.
type ExampleBulkNewParamsBody struct {
DatasetID param.Field[string] `json:"dataset_id" api:"required" format:"uuid"`
ID param.Field[string] `json:"id" format:"uuid"`
CreatedAt param.Field[string] `json:"created_at"`
Inputs param.Field[map[string]interface{}] `json:"inputs"`
Metadata param.Field[map[string]interface{}] `json:"metadata"`
Outputs param.Field[map[string]interface{}] `json:"outputs"`
SourceRunID param.Field[string] `json:"source_run_id" format:"uuid"`
Split param.Field[ExampleBulkNewParamsBodySplitUnion] `json:"split"`
// Use Legacy Message Format for LLM runs
UseLegacyMessageFormat param.Field[bool] `json:"use_legacy_message_format"`
UseSourceRunAttachments param.Field[[]string] `json:"use_source_run_attachments"`
UseSourceRunIo param.Field[bool] `json:"use_source_run_io"`
}
func (r ExampleBulkNewParamsBody) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Satisfied by [ExampleBulkNewParamsBodySplitArray], [shared.UnionString].
type ExampleBulkNewParamsBodySplitUnion interface {
ImplementsExampleBulkNewParamsBodySplitUnion()
}
type ExampleBulkNewParamsBodySplitArray []string
func (r ExampleBulkNewParamsBodySplitArray) ImplementsExampleBulkNewParamsBodySplitUnion() {}
type ExampleBulkPatchAllParams struct {
Body []ExampleBulkPatchAllParamsBody `json:"body" api:"required"`
}
func (r ExampleBulkPatchAllParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
}
// Bulk update class for Example (includes example id).
type ExampleBulkPatchAllParamsBody struct {
ID param.Field[string] `json:"id" api:"required" format:"uuid"`
AttachmentsOperations param.Field[AttachmentsOperationsParam] `json:"attachments_operations"`
DatasetID param.Field[string] `json:"dataset_id" format:"uuid"`
Inputs param.Field[map[string]interface{}] `json:"inputs"`
Metadata param.Field[map[string]interface{}] `json:"metadata"`
Outputs param.Field[map[string]interface{}] `json:"outputs"`
Overwrite param.Field[bool] `json:"overwrite"`
Split param.Field[ExampleBulkPatchAllParamsBodySplitUnion] `json:"split"`
}
func (r ExampleBulkPatchAllParamsBody) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Satisfied by [ExampleBulkPatchAllParamsBodySplitArray], [shared.UnionString].
type ExampleBulkPatchAllParamsBodySplitUnion interface {
ImplementsExampleBulkPatchAllParamsBodySplitUnion()
}
type ExampleBulkPatchAllParamsBodySplitArray []string
func (r ExampleBulkPatchAllParamsBodySplitArray) ImplementsExampleBulkPatchAllParamsBodySplitUnion() {
}