Skip to content

Commit

Permalink
added pydantic output class; TODO: linting + unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
alckasoc committed Jul 1, 2024
1 parent 85d2c55 commit cb83560
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions agential/cog/agent/critic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@

from pydantic import BaseModel, Field


class CriticOutput(BaseModel):
"""Critic Pydantic output class.
Attributes:
answer (str): The answer generated by the agent.
critique (str): The critique of the answer generated by the agent.
search_query (str): The query requested by the agent.
search_result (str): The search result requested by the agent.
external_tool_info (Dict[str, Any]): The query requested by the agent.
"""

answer: str = Field(..., description="The answer generated by the agent.")
critique: str = Field(
..., description="The critique of the answer generated by the agent."
..., description="The answer's critique."
)
search_query: str = Field(..., description="The query requested by the agent. ")
search_result: str = Field(
..., description="The search result requested by the agent."
external_tool_info: Dict[str, Any] = Field(
..., description="The external tool outputs."
)


Expand Down Expand Up @@ -119,7 +118,9 @@ def generate(
)

out.append(
self.strategy.create_output_dict(answer, critique, external_tool_info)
CriticOutput(
**self.strategy.create_output_dict(answer, critique, external_tool_info)
)
)

if self.strategy.halting_condition():
Expand Down

0 comments on commit cb83560

Please sign in to comment.