Class: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/evals/create_eval_completions_run_data_source.rb,
sig/openai/models/evals/create_eval_completions_run_data_source.rbs

Overview

See Also:

  • OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource#sampling_params

Defined Under Namespace

Modules: ResponseFormat

Constant Summary collapse

OpenAI =

Returns:

  • (:ResponseFormatText)

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(max_completion_tokens: nil, reasoning_effort: nil, response_format: nil, seed: nil, temperature: nil, tools: nil, top_p: nil) ⇒ SamplingParams

Returns a new instance of SamplingParams.

Parameters:

  • max_completion_tokens (defaults to: nil) —

    The maximum number of tokens in the generated output.

  • reasoning_effort (defaults to: nil) —

    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 (defaults to: nil) —

    An object specifying the format that the model must output.

    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 the older JSON mode, which ensures the message the model generates is valid JSON. Using json_schema is preferred for models that support it.

  • seed (defaults to: nil) —

    A seed value to initialize the randomness, during sampling.

  • temperature (defaults to: nil) —

    A higher temperature increases randomness in the outputs.

  • tools (defaults to: nil) —

    A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.

  • top_p (defaults to: nil) —

    An alternative to temperature for nucleus sampling; 1.0 includes all tokens.

  • max_completion_tokens: (Integer) (defaults to: nil)
  • reasoning_effort: (OpenAI::Models::reasoning_effort, nil) (defaults to: nil)
  • response_format: (OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::response_format) (defaults to: nil)
  • seed: (Integer) (defaults to: nil)
  • temperature: (Float) (defaults to: nil)
  • tools: (::Array[OpenAI::Chat::ChatCompletionFunctionTool]) (defaults to: nil)
  • top_p: (Float) (defaults to: nil)


# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 566

Instance Attribute Details

#max_completion_tokens ⇒ Integer?

The maximum number of tokens in the generated output.

Returns:

  • (Integer, nil)


509
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 509

optional :max_completion_tokens, Integer

#reasoning_effort ⇒ OpenAI::Models::reasoning_effort?

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.

Returns:

  • (OpenAI::Models::reasoning_effort, nil)


520
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 520

optional :reasoning_effort, enum: -> { OpenAI::ReasoningEffort }, nil?: true

#response_format ⇒ OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::response_format?

An object specifying the format that the model must output.

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 the older JSON mode, which ensures the message the model generates is valid JSON. Using json_schema is preferred for models that support it.

Returns:

  • (OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::response_format, nil)


535
536
537
538
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 535

optional(
  :response_format,
  union: -> { OpenAI::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::ResponseFormat }
)

#seed ⇒ Integer?

A seed value to initialize the randomness, during sampling.

Returns:

  • (Integer, nil)


544
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 544

optional :seed, Integer

#temperature ⇒ Float?

A higher temperature increases randomness in the outputs.

Returns:

  • (Float, nil)


550
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 550

optional :temperature, Float

#tools ⇒ ::Array[OpenAI::Chat::ChatCompletionFunctionTool]?

A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.

Returns:

  • (::Array[OpenAI::Chat::ChatCompletionFunctionTool], nil)


558
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 558

optional :tools, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Chat::ChatCompletionFunctionTool] }

#top_p ⇒ Float?

An alternative to temperature for nucleus sampling; 1.0 includes all tokens.

Returns:

  • (Float, nil)


564
# File 'lib/openai/models/evals/create_eval_completions_run_data_source.rb', line 564

optional :top_p, Float

Instance Method Details

#to_hash ⇒ { ?max_completion_tokens: Integer, ?reasoning_effort: OpenAI::Models::reasoning_effort?, ?response_format: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::response_format, ?seed: Integer, ?temperature: Float, ?tools: ::Array[OpenAI::Chat::ChatCompletionFunctionTool], ?top_p: Float }

Returns:

  • ({ ?max_completion_tokens: Integer, ?reasoning_effort: OpenAI::Models::reasoning_effort?, ?response_format: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::response_format, ?seed: Integer, ?temperature: Float, ?tools: ::Array[OpenAI::Chat::ChatCompletionFunctionTool], ?top_p: Float })


561
562
563
564
565
566
567
568
569
# File 'sig/openai/models/evals/create_eval_completions_run_data_source.rbs', line 561

def to_hash: -> {
  ?max_completion_tokens: Integer,
  ?reasoning_effort: OpenAI::Models::reasoning_effort?,
  ?response_format: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::SamplingParams::response_format,
  ?seed: Integer,
  ?temperature: Float,
  ?tools: ::Array[OpenAI::Chat::ChatCompletionFunctionTool],
  ?top_p: Float
}