Class: Rubygpt::Requester::ChatRequester
- Inherits:
-
BaseRequester
- Object
- BaseRequester
- Rubygpt::Requester::ChatRequester
- Defined in:
- lib/rubygpt/requester/chat_requester.rb
Overview
Performs CRUD operations for OpenAI Chat Completion Objects platform.openai.com/docs/api-reference/chat
Instance Attribute Summary
Attributes inherited from BaseRequester
Instance Method Summary collapse
-
#create(args = {}) ⇒ Response::ChatCompletion
Performs a POST request to the API endpoint platform.openai.com/docs/api-reference/chat/create.
-
#initialize(client) ⇒ ChatRequester
constructor
Initializes the ChatRequester.
Constructor Details
#initialize(client) ⇒ ChatRequester
Initializes the ChatRequester
11 12 13 14 |
# File 'lib/rubygpt/requester/chat_requester.rb', line 11 def initialize(client) @api_endpoint = "chat/completions" super(client) end |
Instance Method Details
#create(args = {}) ⇒ Response::ChatCompletion
Performs a POST request to the API endpoint platform.openai.com/docs/api-reference/chat/create
25 26 27 28 |
# File 'lib/rubygpt/requester/chat_requester.rb', line 25 def create(args = {}) # TODO: handle args[:stream] for streaming completions Response::ChatCompletion.new client.post(api_endpoint, create_request_body(args)) end |