Class: FuncBot::Bot
- Inherits:
-
Object
- Object
- FuncBot::Bot
- Defined in:
- lib/func_bot.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#history ⇒ Object
readonly
Returns the value of attribute history.
-
#include_functions ⇒ Object
Returns the value of attribute include_functions.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #ask(prompt) ⇒ Object
-
#initialize ⇒ Bot
constructor
A new instance of Bot.
Constructor Details
#initialize ⇒ Bot
Returns a new instance of Bot.
18 19 20 21 22 |
# File 'lib/func_bot.rb', line 18 def initialize @history = Bots::History.new @client = Bots::Client.new(self) @include_functions = true end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
16 17 18 |
# File 'lib/func_bot.rb', line 16 def client @client end |
#history ⇒ Object (readonly)
Returns the value of attribute history.
16 17 18 |
# File 'lib/func_bot.rb', line 16 def history @history end |
#include_functions ⇒ Object
Returns the value of attribute include_functions.
15 16 17 |
# File 'lib/func_bot.rb', line 15 def include_functions @include_functions end |
#response ⇒ Object
Returns the value of attribute response.
15 16 17 |
# File 'lib/func_bot.rb', line 15 def response @response end |
Instance Method Details
#ask(prompt) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/func_bot.rb', line 24 def ask(prompt) history.chronicle("user", prompt) self.response = client.call self.response = Functions::Handler.new(self).handle if available_function? history.chronicle("assistant", content) history..last.content end |