Class: Foobara::Ai::AnswerBot::GenerateNextMessage
- Defined in:
- foobara-ai-1.0.4/src/foobara/ai/answer_bot/generate_next_message.rb
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary collapse
-
#ai_command ⇒ Object
Returns the value of attribute ai_command.
-
#ai_service ⇒ Object
Returns the value of attribute ai_service.
-
#next_message ⇒ Object
Returns the value of attribute next_message.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #determine_ai_command ⇒ Object
- #determine_ai_service ⇒ Object
- #execute ⇒ Object
- #run_ai_service ⇒ Object
Methods inherited from Command
Methods included from TruncatedInspect
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Instance Attribute Details
#ai_command ⇒ Object
Returns the value of attribute ai_command.
29 30 31 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 29 def ai_command @ai_command end |
#ai_service ⇒ Object
Returns the value of attribute ai_service.
29 30 31 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 29 def ai_service @ai_service end |
#next_message ⇒ Object
Returns the value of attribute next_message.
29 30 31 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 29 def @next_message end |
#response ⇒ Object
Returns the value of attribute response.
29 30 31 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 29 def response @response end |
Instance Method Details
#determine_ai_command ⇒ Object
35 36 37 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 35 def determine_ai_command self.ai_command = Foobara::Ai::AnswerBot::DomainMappers::ServiceToChatCompletionCommand.map!(ai_service) end |
#determine_ai_service ⇒ Object
31 32 33 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 31 def determine_ai_service self.ai_service = service || domain_map!(model, from: :model_enum) end |
#execute ⇒ Object
21 22 23 24 25 26 27 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 21 def execute determine_ai_service determine_ai_command run_ai_service end |
#run_ai_service ⇒ Object
39 40 41 42 43 44 45 |
# File 'src/foobara/ai/answer_bot/generate_next_message.rb', line 39 def run_ai_service inputs = { chat:, temperature:, model: } inputs = domain_map!(inputs, to: ai_command) = run_subcommand!(ai_command, inputs) self. = domain_map!(, to: Types::Message) end |