Class: AmstradGpt::ChatGpt
- Inherits:
-
Object
- Object
- AmstradGpt::ChatGpt
- Defined in:
- lib/amstrad_gpt/chat_gpt.rb
Instance Method Summary collapse
-
#initialize(api_key:, prompt:) ⇒ ChatGpt
constructor
A new instance of ChatGpt.
- #messages ⇒ Object
- #send_message(content) ⇒ Object
Constructor Details
#initialize(api_key:, prompt:) ⇒ ChatGpt
Returns a new instance of ChatGpt.
6 7 8 9 |
# File 'lib/amstrad_gpt/chat_gpt.rb', line 6 def initialize(api_key:, prompt:) @api_key = api_key @prompt = prompt end |
Instance Method Details
#messages ⇒ Object
18 19 20 |
# File 'lib/amstrad_gpt/chat_gpt.rb', line 18 def ||= [] end |
#send_message(content) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/amstrad_gpt/chat_gpt.rb', line 11 def (content) append({ role: 'user', content: }) response = post parse_response(response.body) end |