Class: OpenAI::Resources::Beta::Threads::Runs Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/beta/threads/runs.rb,
lib/openai/resources/beta/threads/runs/steps.rb,
sig/openai/resources/beta/threads/runs.rbs,
sig/openai/resources/beta/threads/runs/steps.rbs

Overview

Deprecated.

The Assistants API is deprecated in favor of the Responses API

Build Assistants that can call models and use tools.

Defined Under Namespace

Classes: Steps

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Runs

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Runs.

Parameters:



601
602
603
604
# File 'lib/openai/resources/beta/threads/runs.rb', line 601

def initialize(client:)
  @client = client
  @steps = OpenAI::Resources::Beta::Threads::Runs::Steps.new(client: client)
end

Instance Attribute Details

#steps ⇒ OpenAI::Resources::Beta::Threads::Runs::Steps (readonly)

Build Assistants that can call models and use tools.



13
14
15
# File 'lib/openai/resources/beta/threads/runs.rb', line 13

def steps
  @steps
end

Instance Method Details

#cancel(run_id, thread_id:, request_options: {}) ⇒ OpenAI::Models::Beta::Threads::Run

Deprecated.

The Assistants API is deprecated in favor of the Responses API

Cancels a run that is in_progress.

Parameters:

  • run_id (String) —

    The ID of the run to cancel.

  • thread_id (String) —

    The ID of the thread to which this run belongs.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/openai/resources/beta/threads/runs.rb', line 482

def cancel(run_id, params)
  parsed, options = OpenAI::Beta::Threads::RunCancelParams.dump_request(params)
  thread_id = parsed.delete(:thread_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :post,
    path: ["threads/%1$s/runs/%2$s/cancel", thread_id, run_id],
    model: OpenAI::Beta::Threads::Run,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#create(thread_id, assistant_id:, include: nil, additional_instructions: nil, additional_messages: nil, instructions: nil, max_completion_tokens: nil, max_prompt_tokens: nil, metadata: nil, model: nil, parallel_tool_calls: nil, reasoning_effort: nil, response_format: nil, temperature: nil, tool_choice: nil, tools: nil, top_p: nil, truncation_strategy: nil, request_options: {}) ⇒ OpenAI::Models::Beta::Threads::Run

Deprecated.

The Assistants API is deprecated in favor of the Responses API

See OpenAI::Resources::Beta::Threads::Runs#create_stream_raw for streaming counterpart.

Create a run.

Parameters:

  • thread_id (String) —

    Path param: The ID of the thread to run.

  • assistant_id (String) —

    Body param: The ID of the assistant to use to execute this run.

  • include (Array<Symbol, OpenAI::Models::Beta::Threads::Runs::RunStepInclude>) —

    Query param: 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.

  • additional_instructions (String, nil) —

    Body param: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.

  • additional_messages (Array<OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage>, nil) —

    Body param: Adds additional messages to the thread before creating the run.

  • instructions (String, nil) —

    Body param: Overrides the instructions of the assistant. This is useful for modifying the behavior on a per-run basis.

  • max_completion_tokens (Integer, nil) —

    Body param: The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info.

  • max_prompt_tokens (Integer, nil) —

    Body param: The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info.

  • metadata (Hash{Symbol=>String}, nil) —

    Body param: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

    Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

  • model (String, Symbol, OpenAI::Models::ChatModel, nil) —

    Body param: The ID of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.

  • parallel_tool_calls (Boolean) —

    Body param: Whether to enable parallel function calling during tool use.

  • reasoning_effort (Symbol, OpenAI::Models::ReasoningEffort, nil) —

    Body param: Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.

  • response_format (Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil) —

    Body param: Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106.

    Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

    Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.

    Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

  • temperature (Float, nil) —

    Body param: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

  • tool_choice (Symbol, OpenAI::Models::Beta::AssistantToolChoiceOption::Auto, OpenAI::Models::Beta::AssistantToolChoice, nil) —

    Body param: Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like {"type": "file_search"} or {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

  • tools (Array<OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::FileSearchTool, OpenAI::Models::Beta::FunctionTool>, nil) —

    Body param: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.

  • top_p (Float, nil) —

    Body param: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both.

  • truncation_strategy (OpenAI::Models::Beta::Threads::RunCreateParams::TruncationStrategy, nil) —

    Body param: Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/openai/resources/beta/threads/runs.rb', line 156

def create(thread_id, params)
  query_params = [:include]
  parsed, options = OpenAI::Beta::Threads::RunCreateParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed.slice(*query_params))
  if parsed[:stream]
    message = "Please use `#create_stream_raw` for the streaming use case."
    raise ArgumentError.new(message)
  end

  @client.request(
    method: :post,
    path: ["threads/%1$s/runs", thread_id],
    query: query,
    body: parsed.except(*query_params),
    model: OpenAI::Beta::Threads::Run,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#create_stream_raw(thread_id, assistant_id:, include: nil, additional_instructions: nil, additional_messages: nil, instructions: nil, max_completion_tokens: nil, max_prompt_tokens: nil, metadata: nil, model: nil, parallel_tool_calls: nil, reasoning_effort: nil, response_format: nil, temperature: nil, tool_choice: nil, tools: nil, top_p: nil, truncation_strategy: nil, request_options: {}) ⇒ OpenAI::Internal::Stream<OpenAI::Models::Beta::AssistantStreamEvent::ThreadCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunQueued, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunRequiresAction, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunIncomplete, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunFailed, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCancelling, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCancelled, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunExpired, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepDelta, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepFailed, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCancelled, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepExpired, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageDelta, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageIncomplete, OpenAI::Models::Beta::AssistantStreamEvent::ErrorEvent>

Deprecated.

The Assistants API is deprecated in favor of the Responses API

See OpenAI::Resources::Beta::Threads::Runs#create for non-streaming counterpart.

Create a run.

Parameters:

  • thread_id (String) —

    Path param: The ID of the thread to run.

  • assistant_id (String) —

    Body param: The ID of the assistant to use to execute this run.

  • include (Array<Symbol, OpenAI::Models::Beta::Threads::Runs::RunStepInclude>) —

    Query param: 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.

  • additional_instructions (String, nil) —

    Body param: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.

  • additional_messages (Array<OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage>, nil) —

    Body param: Adds additional messages to the thread before creating the run.

  • instructions (String, nil) —

    Body param: Overrides the instructions of the assistant. This is useful for modifying the behavior on a per-run basis.

  • max_completion_tokens (Integer, nil) —

    Body param: The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info.

  • max_prompt_tokens (Integer, nil) —

    Body param: The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info.

  • metadata (Hash{Symbol=>String}, nil) —

    Body param: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

    Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

  • model (String, Symbol, OpenAI::Models::ChatModel, nil) —

    Body param: The ID of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.

  • parallel_tool_calls (Boolean) —

    Body param: Whether to enable parallel function calling during tool use.

  • reasoning_effort (Symbol, OpenAI::Models::ReasoningEffort, nil) —

    Body param: Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.

  • response_format (Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil) —

    Body param: Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106.

    Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

    Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.

    Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

  • temperature (Float, nil) —

    Body param: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

  • tool_choice (Symbol, OpenAI::Models::Beta::AssistantToolChoiceOption::Auto, OpenAI::Models::Beta::AssistantToolChoice, nil) —

    Body param: Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like {"type": "file_search"} or {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

  • tools (Array<OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::FileSearchTool, OpenAI::Models::Beta::FunctionTool>, nil) —

    Body param: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.

  • top_p (Float, nil) —

    Body param: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both.

  • truncation_strategy (OpenAI::Models::Beta::Threads::RunCreateParams::TruncationStrategy, nil) —

    Body param: Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/openai/resources/beta/threads/runs.rb', line 317

def create_stream_raw(thread_id, params)
  query_params = [:include]
  parsed, options = OpenAI::Beta::Threads::RunCreateParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed.slice(*query_params))
  unless parsed.fetch(:stream, true)
    message = "Please use `#create` for the non-streaming use case."
    raise ArgumentError.new(message)
  end

  parsed.store(:stream, true)
  @client.request(
    method: :post,
    path: ["threads/%1$s/runs", thread_id],
    query: query,
    headers: {"accept" => "text/event-stream", "accept-encoding" => "identity"},
    body: parsed.except(*query_params),
    stream: OpenAI::Internal::Stream,
    model: OpenAI::Beta::AssistantStreamEvent,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#list(thread_id, after: nil, before: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::CursorPage<OpenAI::Models::Beta::Threads::Run>

Deprecated.

The Assistants API is deprecated in favor of the Responses API

Returns a list of runs belonging to a thread.

Parameters:

  • thread_id (String) —

    The ID of the thread the run belongs to.

  • 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.

  • limit (Integer) —

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

  • order (Symbol, OpenAI::Models::Beta::Threads::RunListParams::Order) —

    Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/openai/resources/beta/threads/runs.rb', line 451

def list(thread_id, params = {})
  parsed, options = OpenAI::Beta::Threads::RunListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["threads/%1$s/runs", thread_id],
    query: query,
    page: OpenAI::Internal::CursorPage,
    model: OpenAI::Beta::Threads::Run,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#retrieve(run_id, thread_id:, request_options: {}) ⇒ OpenAI::Models::Beta::Threads::Run

Deprecated.

The Assistants API is deprecated in favor of the Responses API

Retrieves a run.

Parameters:

  • run_id (String) —

    The ID of the run to retrieve.

  • thread_id (String) —

    The ID of the thread that was run.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/openai/resources/beta/threads/runs.rb', line 359

def retrieve(run_id, params)
  parsed, options = OpenAI::Beta::Threads::RunRetrieveParams.dump_request(params)
  thread_id = parsed.delete(:thread_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :get,
    path: ["threads/%1$s/runs/%2$s", thread_id, run_id],
    model: OpenAI::Beta::Threads::Run,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#submit_tool_outputs(run_id, thread_id:, tool_outputs:, request_options: {}) ⇒ OpenAI::Models::Beta::Threads::Run

Deprecated.

The Assistants API is deprecated in favor of the Responses API

See OpenAI::Resources::Beta::Threads::Runs#submit_tool_outputs_stream_raw for streaming counterpart.

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:

Returns:

See Also:



525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/openai/resources/beta/threads/runs.rb', line 525

def submit_tool_outputs(run_id, params)
  parsed, options = OpenAI::Beta::Threads::RunSubmitToolOutputsParams.dump_request(params)
  if parsed[:stream]
    message = "Please use `#submit_tool_outputs_stream_raw` for the streaming use case."
    raise ArgumentError.new(message)
  end

  thread_id = parsed.delete(:thread_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :post,
    path: ["threads/%1$s/runs/%2$s/submit_tool_outputs", thread_id, run_id],
    body: parsed,
    model: OpenAI::Beta::Threads::Run,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#submit_tool_outputs_stream_raw(run_id, thread_id:, tool_outputs:, request_options: {}) ⇒ OpenAI::Internal::Stream<OpenAI::Models::Beta::AssistantStreamEvent::ThreadCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunQueued, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunRequiresAction, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunIncomplete, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunFailed, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCancelling, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCancelled, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunExpired, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepDelta, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepFailed, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCancelled, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepExpired, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageDelta, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageIncomplete, OpenAI::Models::Beta::AssistantStreamEvent::ErrorEvent>

Deprecated.

The Assistants API is deprecated in favor of the Responses API

See OpenAI::Resources::Beta::Threads::Runs#submit_tool_outputs for non-streaming counterpart.

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:

Returns:

See Also:



574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'lib/openai/resources/beta/threads/runs.rb', line 574

def submit_tool_outputs_stream_raw(run_id, params)
  parsed, options = OpenAI::Beta::Threads::RunSubmitToolOutputsParams.dump_request(params)
  unless parsed.fetch(:stream, true)
    message = "Please use `#submit_tool_outputs` for the non-streaming use case."
    raise ArgumentError.new(message)
  end

  parsed.store(:stream, true)
  thread_id = parsed.delete(:thread_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :post,
    path: ["threads/%1$s/runs/%2$s/submit_tool_outputs", thread_id, run_id],
    headers: {"accept" => "text/event-stream", "accept-encoding" => "identity"},
    body: parsed,
    stream: OpenAI::Internal::Stream,
    model: OpenAI::Beta::AssistantStreamEvent,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#update(run_id, thread_id:, metadata: nil, request_options: {}) ⇒ OpenAI::Models::Beta::Threads::Run

Deprecated.

The Assistants API is deprecated in favor of the Responses API

Modifies a run.

Parameters:

  • run_id (String) —

    Path param: The ID of the run to modify.

  • thread_id (String) —

    Path param: The ID of the thread that was run.

  • metadata (Hash{Symbol=>String}, nil) —

    Body param: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

    Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/openai/resources/beta/threads/runs.rb', line 401

def update(run_id, params)
  parsed, options = OpenAI::Beta::Threads::RunUpdateParams.dump_request(params)
  thread_id = parsed.delete(:thread_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :post,
    path: ["threads/%1$s/runs/%2$s", thread_id, run_id],
    body: parsed,
    model: OpenAI::Beta::Threads::Run,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end