Method: OpenAI::Resources::Beta::Threads::Runs#create

Defined in:
lib/openai/resources/beta/threads/runs.rb

#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 #create_stream_raw for streaming counterpart.

Some parameter documentations has been truncated, see Models::Beta::Threads::RunCreateParams for more details.

Create a run.

Parameters:

Returns:

See Also:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/openai/resources/beta/threads/runs.rb', line 65

def create(thread_id, params)
  parsed, options = OpenAI::Beta::Threads::RunCreateParams.dump_request(params)
  if parsed[:stream]
    message = "Please use `#create_stream_raw` for the streaming use case."
    raise ArgumentError.new(message)
  end
  query_params = [:include]
  @client.request(
    method: :post,
    path: ["threads/%1$s/runs", thread_id],
    query: parsed.slice(*query_params),
    body: parsed.except(*query_params),
    model: OpenAI::Beta::Threads::Run,
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end