Class: Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/telnyx/models/ai/openai/chat_create_completion_params.rb

Overview

Defined Under Namespace

Modules: Stop, Tool, ToolChoice Classes: Message, ResponseFormat

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Class Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, #initialize, 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, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

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

Constructor Details

This class inherits a constructor from Telnyx::Internal::Type::BaseModel

Instance Attribute Details

#api_key_refString?

If you are using an external inference provider like xAI or OpenAI, this field allows you to pass along a reference to your API key. After creating an [integration secret](developers.telnyx.com/api-reference/integration-secrets/create-a-secret) for you API key, pass the secret’s ‘identifier` in this field.

Returns:

  • (String, nil)


26
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 26

optional :api_key_ref, String

#best_ofInteger?

This is used with ‘use_beam_search` to determine how many candidate beams to explore.

Returns:

  • (Integer, nil)


33
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 33

optional :best_of, Integer

#early_stoppingBoolean?

This is used with ‘use_beam_search`. If `true`, generation stops as soon as there are `best_of` complete candidates; if `false`, a heuristic is applied and the generation stops when is it very unlikely to find better candidates.

Returns:

  • (Boolean, nil)


41
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 41

optional :early_stopping, Telnyx::Internal::Type::Boolean

#enable_thinkingBoolean?

Whether to enable the thinking/reasoning phase for models that support it (e.g., QwQ, Qwen3). When set to false, the model will skip the internal reasoning step and respond directly, which can reduce latency. Defaults to true.

Returns:

  • (Boolean, nil)


49
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 49

optional :enable_thinking, Telnyx::Internal::Type::Boolean

#frequency_penaltyFloat?

Higher values will penalize the model from repeating the same output tokens.

Returns:

  • (Float, nil)


55
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 55

optional :frequency_penalty, Float

#guided_choiceArray<String>?

If specified, the output will be exactly one of the choices.

Returns:

  • (Array<String>, nil)


61
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 61

optional :guided_choice, Telnyx::Internal::Type::ArrayOf[String]

#guided_jsonHash{Symbol=>Object}?

Must be a valid JSON schema. If specified, the output will follow the JSON schema.

Returns:

  • (Hash{Symbol=>Object}, nil)


68
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 68

optional :guided_json, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]

#guided_regexString?

If specified, the output will follow the regex pattern.

Returns:

  • (String, nil)


74
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 74

optional :guided_regex, String

#length_penaltyFloat?

This is used with ‘use_beam_search` to prefer shorter or longer completions.

Returns:

  • (Float, nil)


80
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 80

optional :length_penalty, Float

#logprobsBoolean?

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the ‘content` of `message`.

Returns:

  • (Boolean, nil)


88
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 88

optional :logprobs, Telnyx::Internal::Type::Boolean

#max_tokensInteger?

Maximum number of completion tokens the model should generate.

Returns:

  • (Integer, nil)


94
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 94

optional :max_tokens, Integer

#messagesArray<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message>

A list of the previous chat messages for context.



16
17
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 16

required :messages,
-> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message] }

#min_pFloat?

This is an alternative to ‘top_p` that [many prefer](github.com/huggingface/transformers/issues/27670). Must be in [0, 1].

Returns:

  • (Float, nil)


102
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 102

optional :min_p, Float

#modelString?

The language model to chat with.

Returns:

  • (String, nil)


108
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 108

optional :model, String

#nFloat?

This will return multiple choices for you instead of a single chat completion.

Returns:

  • (Float, nil)


114
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 114

optional :n, Float

#presence_penaltyFloat?

Higher values will penalize the model from repeating the same output tokens.

Returns:

  • (Float, nil)


120
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 120

optional :presence_penalty, Float

#response_formatTelnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat?

Use this is you want to guarantee a JSON output without defining a schema. For control over the schema, use ‘guided_json`.



127
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 127

optional :response_format, -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat }

#seedInteger?

If specified, the system will make a best effort to sample deterministically, such that repeated requests with the same ‘seed` and parameters should return the same result.

Returns:

  • (Integer, nil)


135
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 135

optional :seed, Integer

#stopString, ...

Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.

Returns:

  • (String, Array<String>, nil)


142
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 142

optional :stop, union: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop }

#streamBoolean?

Whether or not to stream data-only server-sent events as they become available.

Returns:

  • (Boolean, nil)


148
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 148

optional :stream, Telnyx::Internal::Type::Boolean

#temperatureFloat?

Adjusts the “creativity” of the model. Lower values make the model more deterministic and repetitive, while higher values make the model more random and creative.

Returns:

  • (Float, nil)


156
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 156

optional :temperature, Float

#tool_choiceSymbol, ...



161
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 161

optional :tool_choice, enum: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice }

#toolsArray<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval>?

The ‘function` tool type follows the same schema as the [OpenAI Chat Completions API](platform.openai.com/docs/api-reference/chat). The `retrieval` tool type is unique to Telnyx. You may pass a list of [embedded storage buckets](developers.telnyx.com/api-reference/embeddings/embed-documents) for retrieval-augmented generation.



171
172
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 171

optional :tools,
-> { Telnyx::Internal::Type::ArrayOf[union: Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool] }

#top_logprobsInteger?

This is used with ‘logprobs`. An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

Returns:

  • (Integer, nil)


180
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 180

optional :top_logprobs, Integer

#top_pFloat?

An alternative or complement to ‘temperature`. This adjusts how many of the top possibilities to consider.

Returns:

  • (Float, nil)


187
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 187

optional :top_p, Float

#use_beam_searchBoolean?

Setting this to ‘true` will allow the model to [explore more completion options](huggingface.co/blog/how-to-generate#beam-search). This is not supported by OpenAI.

Returns:

  • (Boolean, nil)


195
# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 195

optional :use_beam_search, Telnyx::Internal::Type::Boolean

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/telnyx/models/ai/openai/chat_create_completion_params.rb', line 331