Class: Chorus::Agent
- Inherits:
-
Object
- Object
- Chorus::Agent
- Defined in:
- lib/chorus/agent.rb
Overview
Base class for every Chorus agent. A concrete agent only needs to define
its name and system_prompt — the call to the LLM is factored out here.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Symbol
readonly
The agent's identifier, e.g.
-
#system_prompt ⇒ String
readonly
The system prompt describing this agent's role and limits.
Instance Method Summary collapse
-
#call(context_slice) ⇒ String
Sends a context slice to the LLM and returns its text response.
-
#initialize(client:) ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize(client:) ⇒ Agent
Returns a new instance of Agent.
14 15 16 |
# File 'lib/chorus/agent.rb', line 14 def initialize(client:) @client = client end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
Returns the agent's identifier, e.g. :coder.
8 9 10 |
# File 'lib/chorus/agent.rb', line 8 def name @name end |
#system_prompt ⇒ String (readonly)
Returns the system prompt describing this agent's role and limits.
11 12 13 |
# File 'lib/chorus/agent.rb', line 11 def system_prompt @system_prompt end |
Instance Method Details
#call(context_slice) ⇒ String
Sends a context slice to the LLM and returns its text response.
23 24 25 |
# File 'lib/chorus/agent.rb', line 23 def call(context_slice) @client.chat(system_prompt: system_prompt, messages: context_slice) end |