Class: Agents::InformationRetrievalGptAgent

Inherits:
Agent
  • Object
show all
Defined in:
lib/agents/information_retrieval_gpt_agent.rb

Constant Summary

Constants inherited from Agent

Agent::DEFAULT_SYSTEM_PROMPT

Instance Attribute Summary collapse

Attributes inherited from Agent

#actions, #children, #description, #gpt_client, #name

Instance Method Summary collapse

Methods inherited from Agent

#build_prompt, #delegate_request

Constructor Details

#initialize(**args) ⇒ InformationRetrievalGptAgent



5
6
7
8
9
10
11
# File 'lib/agents/information_retrieval_gpt_agent.rb', line 5

def initialize(**args)
  super(**args)
  @description = "I am an AI Assistant that specializes in fetching information and answering general questions, etc."
  @system_prompt = "    You are a helpful assistant.\n  EOS\nend\n"

Instance Attribute Details

#system_promptObject (readonly)

Returns the value of attribute system_prompt.



4
5
6
# File 'lib/agents/information_retrieval_gpt_agent.rb', line 4

def system_prompt
  @system_prompt
end

Instance Method Details

#handle(request:) ⇒ Object



13
14
15
# File 'lib/agents/information_retrieval_gpt_agent.rb', line 13

def handle(request:)
  gpt_client.chat system_prompt: system_prompt, prompt: request.request_text
end