Class: FuncBot::Functions::BaseFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/func_bot/functions/base_function.rb

Direct Known Subclasses

WeatherFunction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bot) ⇒ BaseFunction

Returns a new instance of BaseFunction.



8
9
10
# File 'lib/func_bot/functions/base_function.rb', line 8

def initialize(bot)
  @bot = bot
end

Instance Attribute Details

#botObject (readonly)

Returns the value of attribute bot.



6
7
8
# File 'lib/func_bot/functions/base_function.rb', line 6

def bot
  @bot
end

Instance Method Details

#parsed_responseObject



12
13
14
15
16
# File 'lib/func_bot/functions/base_function.rb', line 12

def parsed_response
  JSON.parse(
    bot.response.dig("choices", 0, "message", "function_call", "arguments")
  )
end