Module: ComposableAgents::Mixins::UserInteraction
- Defined in:
- lib/composable_agents/mixins/user_interaction.rb
Overview
Mixin that adds user interaction capabilities to PromptDrivenAgent agents. This defines the following methods:
#ask(question) -> answerCalls the#answer_tomethod to get the answer to a question and logs the conversation. An agent using this Mixin should define the private method `#answer_to`` to handle the question. Default handling is asking the question on the terminal.
Public API collapse
-
#ask(question) ⇒ String
Answer an agent's question.
Instance Method Details
#ask(question) ⇒ String
Answer an agent's question
15 16 17 18 19 20 |
# File 'lib/composable_agents/mixins/user_interaction.rb', line 15 def ask(question) (message: question, author: "Agent #{full_name}", question: true) answer = answer_to(question) (message: answer, author: 'User') answer end |