Class: Hyrum::Generators::OpenaiGenerator
- Inherits:
-
Object
- Object
- Hyrum::Generators::OpenaiGenerator
- Defined in:
- lib/hyrum/generators/openai_generator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(options) ⇒ OpenaiGenerator
constructor
A new instance of OpenaiGenerator.
Constructor Details
#initialize(options) ⇒ OpenaiGenerator
12 13 14 |
# File 'lib/hyrum/generators/openai_generator.rb', line 12 def initialize() = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/hyrum/generators/openai_generator.rb', line 10 def end |
Instance Method Details
#generate ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/hyrum/generators/openai_generator.rb', line 16 def generate configure response = chat_response puts "OpenAI response: #{JSON.pretty_generate(response)}" if [:verbose] content = response.dig('choices', 0, 'message', 'content') JSON.parse(content) end |