Class: Agents::CategorizingGptAgent
- Defined in:
- lib/agents/categorizing_gpt_agent.rb
Constant Summary
Constants inherited from Agent
Instance Attribute Summary collapse
-
#system_prompt ⇒ Object
readonly
Returns the value of attribute system_prompt.
Attributes inherited from Agent
#actions, #children, #description, #gpt_client, #name
Instance Method Summary collapse
-
#handle(request:) ⇒ GPTResponse
Response.
-
#initialize(**args) ⇒ CategorizingGptAgent
constructor
A new instance of CategorizingGptAgent.
Methods inherited from Agent
#build_prompt, #delegate_request
Constructor Details
#initialize(**args) ⇒ CategorizingGptAgent
Returns a new instance of CategorizingGptAgent.
5 6 7 8 9 10 11 12 |
# File 'lib/agents/categorizing_gpt_agent.rb', line 5 def initialize(**args) super(**args) @system_prompt = " You are a helpful assistant specializing in categorization. For each request to follow,\n please respond with a JSON object with a single key, 'category'. Each request will include\n the valid values for the category key.\n EOS\nend\n" |
Instance Attribute Details
#system_prompt ⇒ Object (readonly)
Returns the value of attribute system_prompt.
4 5 6 |
# File 'lib/agents/categorizing_gpt_agent.rb', line 4 def system_prompt @system_prompt end |
Instance Method Details
#handle(request:) ⇒ GPTResponse
Returns response.
15 16 17 |
# File 'lib/agents/categorizing_gpt_agent.rb', line 15 def handle(request:) gpt_client.chat system_prompt: system_prompt, prompt: request.request_text end |