Class: RubyBots::OpenAIChatTool

Inherits:
OpenAITool show all
Includes:
Chattable
Defined in:
lib/ruby_bots/tools/openai_chat_tool.rb

Direct Known Subclasses

OpenAIStreamingTool

Constant Summary collapse

DEFAULT_DESCRIPTION =
'This tool will use OpenAI to set up a chat interface with the user. It will chat responses to the user to clarify their request.'.freeze

Instance Attribute Summary

Attributes inherited from Tool

#description, #errors, #name

Instance Method Summary collapse

Methods included from Chattable

#response

Methods inherited from OpenAITool

#client, #default_params

Methods inherited from Tool

#response, validate_input, validate_output

Constructor Details

#initialize(name: 'OpenAI chat tool', description: DEFAULT_DESCRIPTION) ⇒ OpenAIChatTool

Returns a new instance of OpenAIChatTool.



7
8
9
# File 'lib/ruby_bots/tools/openai_chat_tool.rb', line 7

def initialize(name: 'OpenAI chat tool', description: DEFAULT_DESCRIPTION)
  super(name:, description:)
end

Instance Method Details

#system_instructionsObject



11
12
13
14
15
16
# File 'lib/ruby_bots/tools/openai_chat_tool.rb', line 11

def system_instructions
  <<~PROMPT
    You are a helpful assistant that is chatting with a user. You can ask the user to provide more information
    if it helps you determine the correct response.
  PROMPT
end