Class: Asimov::ApiV1::Chat
Overview
Class interface for API methods in the “/chat” URI subspace.
Constant Summary collapse
- RESOURCE =
"chat".freeze
Instance Method Summary collapse
-
#create_completions(model:, messages:, parameters: {}) ⇒ Object
Creates a completion request with the specified parameters.
Methods inherited from Base
#initialize, #rest_create_w_json_params, #rest_create_w_multipart_params, #rest_delete, #rest_get, #rest_get_streamed_download, #rest_index
Constructor Details
This class inherits a constructor from Asimov::ApiV1::Base
Instance Method Details
#create_completions(model:, messages:, parameters: {}) ⇒ Object
Creates a completion request with the specified parameters.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/asimov/api_v1/chat.rb', line 17 def create_completions(model:, messages:, parameters: {}) raise MissingRequiredParameterError.new(:model) unless model raise MissingRequiredParameterError.new(:messages) unless raise StreamingResponseNotSupportedError if parameters[:stream] = Utils::ChatMessagesValidator.validate_and_normalize() rest_create_w_json_params(resource: [RESOURCE, "completions"], parameters: parameters.merge({ model: model, messages: })) end |