Class: Agents::TodoGptAgent

Inherits:
GptAgent show all
Defined in:
lib/agents/gpt_agents/todo_gpt_agent.rb

Instance Attribute Summary

Attributes inherited from GptAgent

#description, #gpt_client

Attributes inherited from Agent

#actions

Instance Method Summary collapse

Methods inherited from GptAgent

#handle, #prompt_prefix

Methods inherited from Agent

#handle, #register, #unregister

Constructor Details

#initialize(**args) ⇒ TodoGptAgent

Returns a new instance of TodoGptAgent.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/agents/gpt_agents/todo_gpt_agent.rb', line 4

def initialize(**args)
  super(**args)
  @description = "I am an AI Assistant that specializes in Todo List and Reminders Management."
  @system_prompt = "    You are a helpful assistant specializing in Todo List and Reminders Management. Please do your best to complete\n    any requests you are given. For each request, please respond ONLY with a JSON object. The JSON object should have\n    two top-level keys: `response` and `actions`. The `response` key should be a short string that summarizes the actions\n    to be taken. The `actions` key should be an array of JSON objects, each of which has a `name` key and an `args` key.\n    If you aren't sure what actions should be taken, or you don't think there's anything relevant, then respond with\n    an empty array for the `actions` key.\n    \n    \n  EOS\nend\n"

Instance Method Details

#system_promptObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/agents/gpt_agents/todo_gpt_agent.rb', line 19

def system_prompt
  prompt = @system_prompt

  unless self.actions.empty?
    prompt << "The following actions are supported: \n"
    prompt << self.actions.collect(&:for_prompt).join("\n\n")
  end

  prompt << "\n\n"
end