Skip to content

Commit

Permalink
add responses as an attribute of agents
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-ashkinaze committed Jul 9, 2024
1 parent 2a864d2 commit 42b7096
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plurals/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Agent:
current_task_description (str): Dynamically updated task description that may include prior responses.
history (list): Chronological record of prompts, responses, and models used during the agent's operation.
info (dict): Comprehensive attributes of the agent's current configuration and state.
responses (list): List of responses generated by the agent (the same information can be accessed by history)
"""

def __init__(self,
Expand Down Expand Up @@ -381,6 +382,14 @@ def info(self):
"persona_template": self.persona_template,
"kwargs": self.kwargs}

@property
def responses(self):
history = self.history
if not history:
warnings.warn("No history found. Please process a task first!")
return None
return [history[i]['response'] for i in range(len(history))]

def __repr__(self):
return str(self.info)

Expand Down

0 comments on commit 42b7096

Please sign in to comment.