Class: OpenApiOpenAIClient::AssistantsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_openai/api/assistants_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AssistantsApi

Returns a new instance of AssistantsApi.



19
20
21
# File 'lib/openapi_openai/api/assistants_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/openapi_openai/api/assistants_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_run(thread_id, run_id, opts = {}) ⇒ RunObject

Cancels a run that is in_progress.

Parameters:

  • thread_id (String)

    The ID of the thread to which this run belongs.

  • run_id (String)

    The ID of the run to cancel.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/openapi_openai/api/assistants_api.rb', line 27

def cancel_run(thread_id, run_id, opts = {})
  data, _status_code, _headers = cancel_run_with_http_info(thread_id, run_id, opts)
  data
end

#cancel_run_with_http_info(thread_id, run_id, opts = {}) ⇒ Array<(RunObject, Integer, Hash)>

Cancels a run that is `in_progress`.

Parameters:

  • thread_id (String)

    The ID of the thread to which this run belongs.

  • run_id (String)

    The ID of the run to cancel.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RunObject, Integer, Hash)>)

    RunObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 37

def cancel_run_with_http_info(thread_id, run_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.cancel_run ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.cancel_run"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling AssistantsApi.cancel_run"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs/{run_id}/cancel'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{run_id}', CGI.escape(run_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RunObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.cancel_run",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#cancel_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_assistant(create_assistant_request, opts = {}) ⇒ AssistantObject

Create an assistant with a model and instructions.

Parameters:

Returns:



93
94
95
96
# File 'lib/openapi_openai/api/assistants_api.rb', line 93

def create_assistant(create_assistant_request, opts = {})
  data, _status_code, _headers = create_assistant_with_http_info(create_assistant_request, opts)
  data
end

#create_assistant_with_http_info(create_assistant_request, opts = {}) ⇒ Array<(AssistantObject, Integer, Hash)>

Create an assistant with a model and instructions.

Parameters:

Returns:

  • (Array<(AssistantObject, Integer, Hash)>)

    AssistantObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 102

def create_assistant_with_http_info(create_assistant_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.create_assistant ...'
  end
  # verify the required parameter 'create_assistant_request' is set
  if @api_client.config.client_side_validation && create_assistant_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_assistant_request' when calling AssistantsApi.create_assistant"
  end
  # resource path
  local_var_path = '/assistants'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_assistant_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AssistantObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.create_assistant",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#create_assistant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_message(thread_id, create_message_request, opts = {}) ⇒ MessageObject

Create a message.

Parameters:

  • thread_id (String)

    The ID of the thread to create a message for.

  • create_message_request (CreateMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



160
161
162
163
# File 'lib/openapi_openai/api/assistants_api.rb', line 160

def create_message(thread_id, create_message_request, opts = {})
  data, _status_code, _headers = create_message_with_http_info(thread_id, create_message_request, opts)
  data
end

#create_message_with_http_info(thread_id, create_message_request, opts = {}) ⇒ Array<(MessageObject, Integer, Hash)>

Create a message.

Parameters:

  • thread_id (String)

    The ID of the thread to create a message for.

  • create_message_request (CreateMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(MessageObject, Integer, Hash)>)

    MessageObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 170

def create_message_with_http_info(thread_id, create_message_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.create_message ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.create_message"
  end
  # verify the required parameter 'create_message_request' is set
  if @api_client.config.client_side_validation && create_message_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_message_request' when calling AssistantsApi.create_message"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/messages'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_message_request)

  # return_type
  return_type = opts[:debug_return_type] || 'MessageObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.create_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#create_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_run(thread_id, create_run_request, opts = {}) ⇒ RunObject

Create a run.

Parameters:

  • thread_id (String)

    The ID of the thread to run.

  • create_run_request (CreateRunRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls.file_search.results.content` to fetch the file search result content. See the file search tool documentation for more information.

Returns:



233
234
235
236
# File 'lib/openapi_openai/api/assistants_api.rb', line 233

def create_run(thread_id, create_run_request, opts = {})
  data, _status_code, _headers = create_run_with_http_info(thread_id, create_run_request, opts)
  data
end

#create_run_with_http_info(thread_id, create_run_request, opts = {}) ⇒ Array<(RunObject, Integer, Hash)>

Create a run.

Parameters:

  • thread_id (String)

    The ID of the thread to run.

  • create_run_request (CreateRunRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls.file_search.results.content` to fetch the file search result content. See the file search tool documentation for more information.

Returns:

  • (Array<(RunObject, Integer, Hash)>)

    RunObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 244

def create_run_with_http_info(thread_id, create_run_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.create_run ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.create_run"
  end
  # verify the required parameter 'create_run_request' is set
  if @api_client.config.client_side_validation && create_run_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_run_request' when calling AssistantsApi.create_run"
  end
  allowable_values = ["step_details.tool_calls[*].file_search.results[*].content"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include[]'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_run_request)

  # return_type
  return_type = opts[:debug_return_type] || 'RunObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.create_run",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#create_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_thread(opts = {}) ⇒ ThreadObject

Create a thread.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



310
311
312
313
# File 'lib/openapi_openai/api/assistants_api.rb', line 310

def create_thread(opts = {})
  data, _status_code, _headers = create_thread_with_http_info(opts)
  data
end

#create_thread_and_run(create_thread_and_run_request, opts = {}) ⇒ RunObject

Create a thread and run it in one request.

Parameters:

Returns:



372
373
374
375
# File 'lib/openapi_openai/api/assistants_api.rb', line 372

def create_thread_and_run(create_thread_and_run_request, opts = {})
  data, _status_code, _headers = create_thread_and_run_with_http_info(create_thread_and_run_request, opts)
  data
end

#create_thread_and_run_with_http_info(create_thread_and_run_request, opts = {}) ⇒ Array<(RunObject, Integer, Hash)>

Create a thread and run it in one request.

Parameters:

Returns:

  • (Array<(RunObject, Integer, Hash)>)

    RunObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 381

def create_thread_and_run_with_http_info(create_thread_and_run_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.create_thread_and_run ...'
  end
  # verify the required parameter 'create_thread_and_run_request' is set
  if @api_client.config.client_side_validation && create_thread_and_run_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_thread_and_run_request' when calling AssistantsApi.create_thread_and_run"
  end
  # resource path
  local_var_path = '/threads/runs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_thread_and_run_request)

  # return_type
  return_type = opts[:debug_return_type] || 'RunObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.create_thread_and_run",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#create_thread_and_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_thread_with_http_info(opts = {}) ⇒ Array<(ThreadObject, Integer, Hash)>

Create a thread.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(ThreadObject, Integer, Hash)>)

    ThreadObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 319

def create_thread_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.create_thread ...'
  end
  # resource path
  local_var_path = '/threads'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_thread_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'ThreadObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.create_thread",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#create_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_assistant(assistant_id, opts = {}) ⇒ DeleteAssistantResponse

Delete an assistant.

Parameters:

  • assistant_id (String)

    The ID of the assistant to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



438
439
440
441
# File 'lib/openapi_openai/api/assistants_api.rb', line 438

def delete_assistant(assistant_id, opts = {})
  data, _status_code, _headers = delete_assistant_with_http_info(assistant_id, opts)
  data
end

#delete_assistant_with_http_info(assistant_id, opts = {}) ⇒ Array<(DeleteAssistantResponse, Integer, Hash)>

Delete an assistant.

Parameters:

  • assistant_id (String)

    The ID of the assistant to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteAssistantResponse, Integer, Hash)>)

    DeleteAssistantResponse data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 447

def delete_assistant_with_http_info(assistant_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.delete_assistant ...'
  end
  # verify the required parameter 'assistant_id' is set
  if @api_client.config.client_side_validation && assistant_id.nil?
    fail ArgumentError, "Missing the required parameter 'assistant_id' when calling AssistantsApi.delete_assistant"
  end
  # resource path
  local_var_path = '/assistants/{assistant_id}'.sub('{assistant_id}', CGI.escape(assistant_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteAssistantResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.delete_assistant",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#delete_assistant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_message(thread_id, message_id, opts = {}) ⇒ DeleteMessageResponse

Deletes a message.

Parameters:

  • thread_id (String)

    The ID of the thread to which this message belongs.

  • message_id (String)

    The ID of the message to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



500
501
502
503
# File 'lib/openapi_openai/api/assistants_api.rb', line 500

def delete_message(thread_id, message_id, opts = {})
  data, _status_code, _headers = delete_message_with_http_info(thread_id, message_id, opts)
  data
end

#delete_message_with_http_info(thread_id, message_id, opts = {}) ⇒ Array<(DeleteMessageResponse, Integer, Hash)>

Deletes a message.

Parameters:

  • thread_id (String)

    The ID of the thread to which this message belongs.

  • message_id (String)

    The ID of the message to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteMessageResponse, Integer, Hash)>)

    DeleteMessageResponse data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 510

def delete_message_with_http_info(thread_id, message_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.delete_message ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.delete_message"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling AssistantsApi.delete_message"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/messages/{message_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{message_id}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteMessageResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.delete_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#delete_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_thread(thread_id, opts = {}) ⇒ DeleteThreadResponse

Delete a thread.

Parameters:

  • thread_id (String)

    The ID of the thread to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



566
567
568
569
# File 'lib/openapi_openai/api/assistants_api.rb', line 566

def delete_thread(thread_id, opts = {})
  data, _status_code, _headers = delete_thread_with_http_info(thread_id, opts)
  data
end

#delete_thread_with_http_info(thread_id, opts = {}) ⇒ Array<(DeleteThreadResponse, Integer, Hash)>

Delete a thread.

Parameters:

  • thread_id (String)

    The ID of the thread to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteThreadResponse, Integer, Hash)>)

    DeleteThreadResponse data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 575

def delete_thread_with_http_info(thread_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.delete_thread ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.delete_thread"
  end
  # resource path
  local_var_path = '/threads/{thread_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteThreadResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.delete_thread",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#delete_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_assistant(assistant_id, opts = {}) ⇒ AssistantObject

Retrieves an assistant.

Parameters:

  • assistant_id (String)

    The ID of the assistant to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



627
628
629
630
# File 'lib/openapi_openai/api/assistants_api.rb', line 627

def get_assistant(assistant_id, opts = {})
  data, _status_code, _headers = get_assistant_with_http_info(assistant_id, opts)
  data
end

#get_assistant_with_http_info(assistant_id, opts = {}) ⇒ Array<(AssistantObject, Integer, Hash)>

Retrieves an assistant.

Parameters:

  • assistant_id (String)

    The ID of the assistant to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AssistantObject, Integer, Hash)>)

    AssistantObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 636

def get_assistant_with_http_info(assistant_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.get_assistant ...'
  end
  # verify the required parameter 'assistant_id' is set
  if @api_client.config.client_side_validation && assistant_id.nil?
    fail ArgumentError, "Missing the required parameter 'assistant_id' when calling AssistantsApi.get_assistant"
  end
  # resource path
  local_var_path = '/assistants/{assistant_id}'.sub('{assistant_id}', CGI.escape(assistant_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AssistantObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.get_assistant",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#get_assistant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_message(thread_id, message_id, opts = {}) ⇒ MessageObject

Retrieve a message.

Parameters:

  • thread_id (String)

    The ID of the thread to which this message belongs.

  • message_id (String)

    The ID of the message to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



689
690
691
692
# File 'lib/openapi_openai/api/assistants_api.rb', line 689

def get_message(thread_id, message_id, opts = {})
  data, _status_code, _headers = get_message_with_http_info(thread_id, message_id, opts)
  data
end

#get_message_with_http_info(thread_id, message_id, opts = {}) ⇒ Array<(MessageObject, Integer, Hash)>

Retrieve a message.

Parameters:

  • thread_id (String)

    The ID of the thread to which this message belongs.

  • message_id (String)

    The ID of the message to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(MessageObject, Integer, Hash)>)

    MessageObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 699

def get_message_with_http_info(thread_id, message_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.get_message ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.get_message"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling AssistantsApi.get_message"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/messages/{message_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{message_id}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'MessageObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.get_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#get_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_run(thread_id, run_id, opts = {}) ⇒ RunObject

Retrieves a run.

Parameters:

  • thread_id (String)

    The ID of the thread that was run.

  • run_id (String)

    The ID of the run to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



756
757
758
759
# File 'lib/openapi_openai/api/assistants_api.rb', line 756

def get_run(thread_id, run_id, opts = {})
  data, _status_code, _headers = get_run_with_http_info(thread_id, run_id, opts)
  data
end

#get_run_step(thread_id, run_id, step_id, opts = {}) ⇒ RunStepObject

Retrieves a run step.

Parameters:

  • thread_id (String)

    The ID of the thread to which the run and run step belongs.

  • run_id (String)

    The ID of the run to which the run step belongs.

  • step_id (String)

    The ID of the run step to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls.file_search.results.content` to fetch the file search result content. See the file search tool documentation for more information.

Returns:



825
826
827
828
# File 'lib/openapi_openai/api/assistants_api.rb', line 825

def get_run_step(thread_id, run_id, step_id, opts = {})
  data, _status_code, _headers = get_run_step_with_http_info(thread_id, run_id, step_id, opts)
  data
end

#get_run_step_with_http_info(thread_id, run_id, step_id, opts = {}) ⇒ Array<(RunStepObject, Integer, Hash)>

Retrieves a run step.

Parameters:

  • thread_id (String)

    The ID of the thread to which the run and run step belongs.

  • run_id (String)

    The ID of the run to which the run step belongs.

  • step_id (String)

    The ID of the run step to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls.file_search.results.content` to fetch the file search result content. See the file search tool documentation for more information.

Returns:

  • (Array<(RunStepObject, Integer, Hash)>)

    RunStepObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 837

def get_run_step_with_http_info(thread_id, run_id, step_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.get_run_step ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.get_run_step"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling AssistantsApi.get_run_step"
  end
  # verify the required parameter 'step_id' is set
  if @api_client.config.client_side_validation && step_id.nil?
    fail ArgumentError, "Missing the required parameter 'step_id' when calling AssistantsApi.get_run_step"
  end
  allowable_values = ["step_details.tool_calls[*].file_search.results[*].content"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs/{run_id}/steps/{step_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{run_id}', CGI.escape(run_id.to_s)).sub('{step_id}', CGI.escape(step_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include[]'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RunStepObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.get_run_step",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#get_run_step\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_run_with_http_info(thread_id, run_id, opts = {}) ⇒ Array<(RunObject, Integer, Hash)>

Retrieves a run.

Parameters:

  • thread_id (String)

    The ID of the thread that was run.

  • run_id (String)

    The ID of the run to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RunObject, Integer, Hash)>)

    RunObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 766

def get_run_with_http_info(thread_id, run_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.get_run ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.get_run"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling AssistantsApi.get_run"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs/{run_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{run_id}', CGI.escape(run_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RunObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.get_run",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#get_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_thread(thread_id, opts = {}) ⇒ ThreadObject

Retrieves a thread.

Parameters:

  • thread_id (String)

    The ID of the thread to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



902
903
904
905
# File 'lib/openapi_openai/api/assistants_api.rb', line 902

def get_thread(thread_id, opts = {})
  data, _status_code, _headers = get_thread_with_http_info(thread_id, opts)
  data
end

#get_thread_with_http_info(thread_id, opts = {}) ⇒ Array<(ThreadObject, Integer, Hash)>

Retrieves a thread.

Parameters:

  • thread_id (String)

    The ID of the thread to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ThreadObject, Integer, Hash)>)

    ThreadObject data, response status code and response headers



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
# File 'lib/openapi_openai/api/assistants_api.rb', line 911

def get_thread_with_http_info(thread_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.get_thread ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.get_thread"
  end
  # resource path
  local_var_path = '/threads/{thread_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ThreadObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.get_thread",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#get_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_assistants(opts = {}) ⇒ ListAssistantsResponse

Returns a list of assistants.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

Returns:



966
967
968
969
# File 'lib/openapi_openai/api/assistants_api.rb', line 966

def list_assistants(opts = {})
  data, _status_code, _headers = list_assistants_with_http_info(opts)
  data
end

#list_assistants_with_http_info(opts = {}) ⇒ Array<(ListAssistantsResponse, Integer, Hash)>

Returns a list of assistants.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

Returns:

  • (Array<(ListAssistantsResponse, Integer, Hash)>)

    ListAssistantsResponse data, response status code and response headers



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
# File 'lib/openapi_openai/api/assistants_api.rb', line 978

def list_assistants_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.list_assistants ...'
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/assistants'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAssistantsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.list_assistants",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#list_assistants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_messages(thread_id, opts = {}) ⇒ ListMessagesResponse

Returns a list of messages for a given thread.

Parameters:

  • thread_id (String)

    The ID of the thread the messages belong to.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

  • :run_id (String)

    Filter messages by the run ID that generated them.

Returns:



1039
1040
1041
1042
# File 'lib/openapi_openai/api/assistants_api.rb', line 1039

def list_messages(thread_id, opts = {})
  data, _status_code, _headers = list_messages_with_http_info(thread_id, opts)
  data
end

#list_messages_with_http_info(thread_id, opts = {}) ⇒ Array<(ListMessagesResponse, Integer, Hash)>

Returns a list of messages for a given thread.

Parameters:

  • thread_id (String)

    The ID of the thread the messages belong to.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

  • :run_id (String)

    Filter messages by the run ID that generated them.

Returns:

  • (Array<(ListMessagesResponse, Integer, Hash)>)

    ListMessagesResponse data, response status code and response headers



1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
# File 'lib/openapi_openai/api/assistants_api.rb', line 1053

def list_messages_with_http_info(thread_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.list_messages ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.list_messages"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/messages'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'run_id'] = opts[:'run_id'] if !opts[:'run_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListMessagesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.list_messages",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#list_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_run_steps(thread_id, run_id, opts = {}) ⇒ ListRunStepsResponse

Returns a list of run steps belonging to a run.

Parameters:

  • thread_id (String)

    The ID of the thread the run and run steps belong to.

  • run_id (String)

    The ID of the run the run steps belong to.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

  • :include (Array<String>)

    A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls.file_search.results.content` to fetch the file search result content. See the file search tool documentation for more information.

Returns:



1120
1121
1122
1123
# File 'lib/openapi_openai/api/assistants_api.rb', line 1120

def list_run_steps(thread_id, run_id, opts = {})
  data, _status_code, _headers = list_run_steps_with_http_info(thread_id, run_id, opts)
  data
end

#list_run_steps_with_http_info(thread_id, run_id, opts = {}) ⇒ Array<(ListRunStepsResponse, Integer, Hash)>

Returns a list of run steps belonging to a run.

Parameters:

  • thread_id (String)

    The ID of the thread the run and run steps belong to.

  • run_id (String)

    The ID of the run the run steps belong to.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

  • :include (Array<String>)

    A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls.file_search.results.content` to fetch the file search result content. See the file search tool documentation for more information.

Returns:

  • (Array<(ListRunStepsResponse, Integer, Hash)>)

    ListRunStepsResponse data, response status code and response headers



1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/openapi_openai/api/assistants_api.rb', line 1135

def list_run_steps_with_http_info(thread_id, run_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.list_run_steps ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.list_run_steps"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling AssistantsApi.list_run_steps"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  allowable_values = ["step_details.tool_calls[*].file_search.results[*].content"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs/{run_id}/steps'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{run_id}', CGI.escape(run_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'include[]'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListRunStepsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.list_run_steps",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#list_run_steps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_runs(thread_id, opts = {}) ⇒ ListRunsResponse

Returns a list of runs belonging to a thread.

Parameters:

  • thread_id (String)

    The ID of the thread the run belongs to.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

Returns:



1208
1209
1210
1211
# File 'lib/openapi_openai/api/assistants_api.rb', line 1208

def list_runs(thread_id, opts = {})
  data, _status_code, _headers = list_runs_with_http_info(thread_id, opts)
  data
end

#list_runs_with_http_info(thread_id, opts = {}) ⇒ Array<(ListRunsResponse, Integer, Hash)>

Returns a list of runs belonging to a thread.

Parameters:

  • thread_id (String)

    The ID of the thread the run belongs to.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. (default to 20)

  • :order (String)

    Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. (default to 'desc')

  • :after (String)

    A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • :before (String)

    A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

Returns:

  • (Array<(ListRunsResponse, Integer, Hash)>)

    ListRunsResponse data, response status code and response headers



1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
# File 'lib/openapi_openai/api/assistants_api.rb', line 1221

def list_runs_with_http_info(thread_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.list_runs ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.list_runs"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListRunsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.list_runs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#list_runs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#modify_assistant(assistant_id, modify_assistant_request, opts = {}) ⇒ AssistantObject

Modifies an assistant.

Parameters:

  • assistant_id (String)

    The ID of the assistant to modify.

  • modify_assistant_request (ModifyAssistantRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1282
1283
1284
1285
# File 'lib/openapi_openai/api/assistants_api.rb', line 1282

def modify_assistant(assistant_id, modify_assistant_request, opts = {})
  data, _status_code, _headers = modify_assistant_with_http_info(assistant_id, modify_assistant_request, opts)
  data
end

#modify_assistant_with_http_info(assistant_id, modify_assistant_request, opts = {}) ⇒ Array<(AssistantObject, Integer, Hash)>

Modifies an assistant.

Parameters:

  • assistant_id (String)

    The ID of the assistant to modify.

  • modify_assistant_request (ModifyAssistantRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AssistantObject, Integer, Hash)>)

    AssistantObject data, response status code and response headers



1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
# File 'lib/openapi_openai/api/assistants_api.rb', line 1292

def modify_assistant_with_http_info(assistant_id, modify_assistant_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.modify_assistant ...'
  end
  # verify the required parameter 'assistant_id' is set
  if @api_client.config.client_side_validation && assistant_id.nil?
    fail ArgumentError, "Missing the required parameter 'assistant_id' when calling AssistantsApi.modify_assistant"
  end
  # verify the required parameter 'modify_assistant_request' is set
  if @api_client.config.client_side_validation && modify_assistant_request.nil?
    fail ArgumentError, "Missing the required parameter 'modify_assistant_request' when calling AssistantsApi.modify_assistant"
  end
  # resource path
  local_var_path = '/assistants/{assistant_id}'.sub('{assistant_id}', CGI.escape(assistant_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(modify_assistant_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AssistantObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.modify_assistant",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#modify_assistant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#modify_message(thread_id, message_id, modify_message_request, opts = {}) ⇒ MessageObject

Modifies a message.

Parameters:

  • thread_id (String)

    The ID of the thread to which this message belongs.

  • message_id (String)

    The ID of the message to modify.

  • modify_message_request (ModifyMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1355
1356
1357
1358
# File 'lib/openapi_openai/api/assistants_api.rb', line 1355

def modify_message(thread_id, message_id, modify_message_request, opts = {})
  data, _status_code, _headers = modify_message_with_http_info(thread_id, message_id, modify_message_request, opts)
  data
end

#modify_message_with_http_info(thread_id, message_id, modify_message_request, opts = {}) ⇒ Array<(MessageObject, Integer, Hash)>

Modifies a message.

Parameters:

  • thread_id (String)

    The ID of the thread to which this message belongs.

  • message_id (String)

    The ID of the message to modify.

  • modify_message_request (ModifyMessageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(MessageObject, Integer, Hash)>)

    MessageObject data, response status code and response headers



1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
# File 'lib/openapi_openai/api/assistants_api.rb', line 1366

def modify_message_with_http_info(thread_id, message_id, modify_message_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.modify_message ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.modify_message"
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling AssistantsApi.modify_message"
  end
  # verify the required parameter 'modify_message_request' is set
  if @api_client.config.client_side_validation && modify_message_request.nil?
    fail ArgumentError, "Missing the required parameter 'modify_message_request' when calling AssistantsApi.modify_message"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/messages/{message_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{message_id}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(modify_message_request)

  # return_type
  return_type = opts[:debug_return_type] || 'MessageObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.modify_message",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#modify_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#modify_run(thread_id, run_id, modify_run_request, opts = {}) ⇒ RunObject

Modifies a run.

Parameters:

  • thread_id (String)

    The ID of the thread that was run.

  • run_id (String)

    The ID of the run to modify.

  • modify_run_request (ModifyRunRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1433
1434
1435
1436
# File 'lib/openapi_openai/api/assistants_api.rb', line 1433

def modify_run(thread_id, run_id, modify_run_request, opts = {})
  data, _status_code, _headers = modify_run_with_http_info(thread_id, run_id, modify_run_request, opts)
  data
end

#modify_run_with_http_info(thread_id, run_id, modify_run_request, opts = {}) ⇒ Array<(RunObject, Integer, Hash)>

Modifies a run.

Parameters:

  • thread_id (String)

    The ID of the thread that was run.

  • run_id (String)

    The ID of the run to modify.

  • modify_run_request (ModifyRunRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RunObject, Integer, Hash)>)

    RunObject data, response status code and response headers



1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
# File 'lib/openapi_openai/api/assistants_api.rb', line 1444

def modify_run_with_http_info(thread_id, run_id, modify_run_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.modify_run ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.modify_run"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling AssistantsApi.modify_run"
  end
  # verify the required parameter 'modify_run_request' is set
  if @api_client.config.client_side_validation && modify_run_request.nil?
    fail ArgumentError, "Missing the required parameter 'modify_run_request' when calling AssistantsApi.modify_run"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs/{run_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{run_id}', CGI.escape(run_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(modify_run_request)

  # return_type
  return_type = opts[:debug_return_type] || 'RunObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.modify_run",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#modify_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#modify_thread(thread_id, modify_thread_request, opts = {}) ⇒ ThreadObject

Modifies a thread.

Parameters:

  • thread_id (String)

    The ID of the thread to modify. Only the `metadata` can be modified.

  • modify_thread_request (ModifyThreadRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1510
1511
1512
1513
# File 'lib/openapi_openai/api/assistants_api.rb', line 1510

def modify_thread(thread_id, modify_thread_request, opts = {})
  data, _status_code, _headers = modify_thread_with_http_info(thread_id, modify_thread_request, opts)
  data
end

#modify_thread_with_http_info(thread_id, modify_thread_request, opts = {}) ⇒ Array<(ThreadObject, Integer, Hash)>

Modifies a thread.

Parameters:

  • thread_id (String)

    The ID of the thread to modify. Only the `metadata` can be modified.

  • modify_thread_request (ModifyThreadRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ThreadObject, Integer, Hash)>)

    ThreadObject data, response status code and response headers



1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
# File 'lib/openapi_openai/api/assistants_api.rb', line 1520

def modify_thread_with_http_info(thread_id, modify_thread_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.modify_thread ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.modify_thread"
  end
  # verify the required parameter 'modify_thread_request' is set
  if @api_client.config.client_side_validation && modify_thread_request.nil?
    fail ArgumentError, "Missing the required parameter 'modify_thread_request' when calling AssistantsApi.modify_thread"
  end
  # resource path
  local_var_path = '/threads/{thread_id}'.sub('{thread_id}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(modify_thread_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ThreadObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.modify_thread",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#modify_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#submit_tool_ouputs_to_run(thread_id, run_id, submit_tool_outputs_run_request, opts = {}) ⇒ RunObject

When a run has the status: \"requires_action\" and required_action.type is submit_tool_outputs, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

Parameters:

  • thread_id (String)

    The ID of the thread to which this run belongs.

  • run_id (String)

    The ID of the run that requires the tool output submission.

  • submit_tool_outputs_run_request (SubmitToolOutputsRunRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1583
1584
1585
1586
# File 'lib/openapi_openai/api/assistants_api.rb', line 1583

def submit_tool_ouputs_to_run(thread_id, run_id, submit_tool_outputs_run_request, opts = {})
  data, _status_code, _headers = submit_tool_ouputs_to_run_with_http_info(thread_id, run_id, submit_tool_outputs_run_request, opts)
  data
end

#submit_tool_ouputs_to_run_with_http_info(thread_id, run_id, submit_tool_outputs_run_request, opts = {}) ⇒ Array<(RunObject, Integer, Hash)>

When a run has the `status: &quot;requires_action&quot;` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

Parameters:

  • thread_id (String)

    The ID of the thread to which this run belongs.

  • run_id (String)

    The ID of the run that requires the tool output submission.

  • submit_tool_outputs_run_request (SubmitToolOutputsRunRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RunObject, Integer, Hash)>)

    RunObject data, response status code and response headers



1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
# File 'lib/openapi_openai/api/assistants_api.rb', line 1594

def submit_tool_ouputs_to_run_with_http_info(thread_id, run_id, submit_tool_outputs_run_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssistantsApi.submit_tool_ouputs_to_run ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling AssistantsApi.submit_tool_ouputs_to_run"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling AssistantsApi.submit_tool_ouputs_to_run"
  end
  # verify the required parameter 'submit_tool_outputs_run_request' is set
  if @api_client.config.client_side_validation && submit_tool_outputs_run_request.nil?
    fail ArgumentError, "Missing the required parameter 'submit_tool_outputs_run_request' when calling AssistantsApi.submit_tool_ouputs_to_run"
  end
  # resource path
  local_var_path = '/threads/{thread_id}/runs/{run_id}/submit_tool_outputs'.sub('{thread_id}', CGI.escape(thread_id.to_s)).sub('{run_id}', CGI.escape(run_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(submit_tool_outputs_run_request)

  # return_type
  return_type = opts[:debug_return_type] || 'RunObject'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AssistantsApi.submit_tool_ouputs_to_run",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssistantsApi#submit_tool_ouputs_to_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end