Class: Telnyx::Resources::AI::Chat
- Inherits:
-
Object
- Object
- Telnyx::Resources::AI::Chat
- Defined in:
- lib/telnyx/resources/ai/chat.rb
Overview
Generate text with LLMs
Instance Method Summary collapse
-
#create_completion(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, response_format: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil, request_options: {}) ⇒ Hash{Symbol=>Object}
Some parameter documentations has been truncated, see Models::AI::ChatCreateCompletionParams for more details.
-
#initialize(client:) ⇒ Chat
constructor
private
A new instance of Chat.
Constructor Details
#initialize(client:) ⇒ Chat
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 Chat.
84 85 86 |
# File 'lib/telnyx/resources/ai/chat.rb', line 84 def initialize(client:) @client = client end |
Instance Method Details
#create_completion(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, response_format: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil, request_options: {}) ⇒ Hash{Symbol=>Object}
Some parameter documentations has been truncated, see Models::AI::ChatCreateCompletionParams for more details.
Chat with a language model. This endpoint is consistent with the [OpenAI Chat Completions API](platform.openai.com/docs/api-reference/chat) and may be used with the OpenAI JS or Python SDK.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/telnyx/resources/ai/chat.rb', line 70 def create_completion(params) parsed, = Telnyx::AI::ChatCreateCompletionParams.dump_request(params) @client.request( method: :post, path: "ai/chat/completions", body: parsed, model: Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown], options: ) end |