@@ -82,38 +82,38 @@ func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string
82
82
// Retrieves a run.
83
83
//
84
84
// Deprecated: The Assistants API is deprecated in favor of the Responses API
85
- func (r * BetaThreadRunService ) Get (ctx context.Context , threadID string , runID string , opts ... option.RequestOption ) (res * Run , err error ) {
85
+ func (r * BetaThreadRunService ) Get (ctx context.Context , runID string , query BetaThreadRunGetParams , opts ... option.RequestOption ) (res * Run , err error ) {
86
86
opts = append (r .Options [:], opts ... )
87
87
opts = append ([]option.RequestOption {option .WithHeader ("OpenAI-Beta" , "assistants=v2" )}, opts ... )
88
- if threadID == "" {
88
+ if query . ThreadID == "" {
89
89
err = errors .New ("missing required thread_id parameter" )
90
90
return
91
91
}
92
92
if runID == "" {
93
93
err = errors .New ("missing required run_id parameter" )
94
94
return
95
95
}
96
- path := fmt .Sprintf ("threads/%s/runs/%s" , threadID , runID )
96
+ path := fmt .Sprintf ("threads/%s/runs/%s" , query . ThreadID , runID )
97
97
err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & res , opts ... )
98
98
return
99
99
}
100
100
101
101
// Modifies a run.
102
102
//
103
103
// Deprecated: The Assistants API is deprecated in favor of the Responses API
104
- func (r * BetaThreadRunService ) Update (ctx context.Context , threadID string , runID string , body BetaThreadRunUpdateParams , opts ... option.RequestOption ) (res * Run , err error ) {
104
+ func (r * BetaThreadRunService ) Update (ctx context.Context , runID string , params BetaThreadRunUpdateParams , opts ... option.RequestOption ) (res * Run , err error ) {
105
105
opts = append (r .Options [:], opts ... )
106
106
opts = append ([]option.RequestOption {option .WithHeader ("OpenAI-Beta" , "assistants=v2" )}, opts ... )
107
- if threadID == "" {
107
+ if params . ThreadID == "" {
108
108
err = errors .New ("missing required thread_id parameter" )
109
109
return
110
110
}
111
111
if runID == "" {
112
112
err = errors .New ("missing required run_id parameter" )
113
113
return
114
114
}
115
- path := fmt .Sprintf ("threads/%s/runs/%s" , threadID , runID )
116
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
115
+ path := fmt .Sprintf ("threads/%s/runs/%s" , params . ThreadID , runID )
116
+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & res , opts ... )
117
117
return
118
118
}
119
119
@@ -151,18 +151,18 @@ func (r *BetaThreadRunService) ListAutoPaging(ctx context.Context, threadID stri
151
151
// Cancels a run that is `in_progress`.
152
152
//
153
153
// Deprecated: The Assistants API is deprecated in favor of the Responses API
154
- func (r * BetaThreadRunService ) Cancel (ctx context.Context , threadID string , runID string , opts ... option.RequestOption ) (res * Run , err error ) {
154
+ func (r * BetaThreadRunService ) Cancel (ctx context.Context , runID string , body BetaThreadRunCancelParams , opts ... option.RequestOption ) (res * Run , err error ) {
155
155
opts = append (r .Options [:], opts ... )
156
156
opts = append ([]option.RequestOption {option .WithHeader ("OpenAI-Beta" , "assistants=v2" )}, opts ... )
157
- if threadID == "" {
157
+ if body . ThreadID == "" {
158
158
err = errors .New ("missing required thread_id parameter" )
159
159
return
160
160
}
161
161
if runID == "" {
162
162
err = errors .New ("missing required run_id parameter" )
163
163
return
164
164
}
165
- path := fmt .Sprintf ("threads/%s/runs/%s/cancel" , threadID , runID )
165
+ path := fmt .Sprintf ("threads/%s/runs/%s/cancel" , body . ThreadID , runID )
166
166
err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , nil , & res , opts ... )
167
167
return
168
168
}
@@ -173,19 +173,19 @@ func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runI
173
173
// request.
174
174
//
175
175
// Deprecated: The Assistants API is deprecated in favor of the Responses API
176
- func (r * BetaThreadRunService ) SubmitToolOutputs (ctx context.Context , threadID string , runID string , body BetaThreadRunSubmitToolOutputsParams , opts ... option.RequestOption ) (res * Run , err error ) {
176
+ func (r * BetaThreadRunService ) SubmitToolOutputs (ctx context.Context , runID string , params BetaThreadRunSubmitToolOutputsParams , opts ... option.RequestOption ) (res * Run , err error ) {
177
177
opts = append (r .Options [:], opts ... )
178
178
opts = append ([]option.RequestOption {option .WithHeader ("OpenAI-Beta" , "assistants=v2" )}, opts ... )
179
- if threadID == "" {
179
+ if params . ThreadID == "" {
180
180
err = errors .New ("missing required thread_id parameter" )
181
181
return
182
182
}
183
183
if runID == "" {
184
184
err = errors .New ("missing required run_id parameter" )
185
185
return
186
186
}
187
- path := fmt .Sprintf ("threads/%s/runs/%s/submit_tool_outputs" , threadID , runID )
188
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
187
+ path := fmt .Sprintf ("threads/%s/runs/%s/submit_tool_outputs" , params . ThreadID , runID )
188
+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & res , opts ... )
189
189
return
190
190
}
191
191
@@ -195,23 +195,23 @@ func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID s
195
195
// request.
196
196
//
197
197
// Deprecated: The Assistants API is deprecated in favor of the Responses API
198
- func (r * BetaThreadRunService ) SubmitToolOutputsStreaming (ctx context.Context , threadID string , runID string , body BetaThreadRunSubmitToolOutputsParams , opts ... option.RequestOption ) (stream * ssestream.Stream [AssistantStreamEventUnion ]) {
198
+ func (r * BetaThreadRunService ) SubmitToolOutputsStreaming (ctx context.Context , runID string , params BetaThreadRunSubmitToolOutputsParams , opts ... option.RequestOption ) (stream * ssestream.Stream [AssistantStreamEventUnion ]) {
199
199
var (
200
200
raw * http.Response
201
201
err error
202
202
)
203
203
opts = append (r .Options [:], opts ... )
204
204
opts = append ([]option.RequestOption {option .WithHeader ("OpenAI-Beta" , "assistants=v2" ), option .WithJSONSet ("stream" , true )}, opts ... )
205
- if threadID == "" {
205
+ if params . ThreadID == "" {
206
206
err = errors .New ("missing required thread_id parameter" )
207
207
return
208
208
}
209
209
if runID == "" {
210
210
err = errors .New ("missing required run_id parameter" )
211
211
return
212
212
}
213
- path := fmt .Sprintf ("threads/%s/runs/%s/submit_tool_outputs" , threadID , runID )
214
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & raw , opts ... )
213
+ path := fmt .Sprintf ("threads/%s/runs/%s/submit_tool_outputs" , params . ThreadID , runID )
214
+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & raw , opts ... )
215
215
return ssestream .NewStream [AssistantStreamEventUnion ](ssestream .NewDecoder (raw ), err )
216
216
}
217
217
@@ -868,7 +868,13 @@ func init() {
868
868
)
869
869
}
870
870
871
+ type BetaThreadRunGetParams struct {
872
+ ThreadID string `path:"thread_id,required" json:"-"`
873
+ paramObj
874
+ }
875
+
871
876
type BetaThreadRunUpdateParams struct {
877
+ ThreadID string `path:"thread_id,required" json:"-"`
872
878
// Set of 16 key-value pairs that can be attached to an object. This can be useful
873
879
// for storing additional information about the object in a structured format, and
874
880
// querying for objects via API or the dashboard.
@@ -927,7 +933,13 @@ const (
927
933
BetaThreadRunListParamsOrderDesc BetaThreadRunListParamsOrder = "desc"
928
934
)
929
935
936
+ type BetaThreadRunCancelParams struct {
937
+ ThreadID string `path:"thread_id,required" json:"-"`
938
+ paramObj
939
+ }
940
+
930
941
type BetaThreadRunSubmitToolOutputsParams struct {
942
+ ThreadID string `path:"thread_id,required" json:"-"`
931
943
// A list of tools for which the outputs are being submitted.
932
944
ToolOutputs []BetaThreadRunSubmitToolOutputsParamsToolOutput `json:"tool_outputs,omitzero,required"`
933
945
paramObj
0 commit comments