Skip to content

Commit

Permalink
Update code.py
Browse files Browse the repository at this point in the history
  • Loading branch information
emmalin-7 authored Jun 30, 2024
1 parent 9558357 commit bb86e03
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions agential/cog/strategies/critic/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class CriticPydanticOutput(BaseModel):
improved_code: str = Field(..., description = "The improved code generated by the agent.")



class CriticCodeStrategy(CriticBaseStrategy):
"""A strategy class for Code benchmarks using the CRITIC agent.
Attributes:
Expand All @@ -35,6 +34,7 @@ def __init__(self, llm: BaseChatModel) -> None:
"""Initialization."""
super().__init__(llm)
self._halt = False

def generate(
self,
question: str,
Expand Down Expand Up @@ -67,7 +67,11 @@ def generate(


def generate_pydantic_output(
self, code: str, critique: str, execution_status: str, improved_code: str
self,
code: str,
critique: str,
execution_status: str,
improved_code: str
) -> CriticPydanticOutput:
"""Creates a pydantic model of the output.
Args:
Expand Down Expand Up @@ -159,7 +163,10 @@ def generate_critique(
return new_critique, external_tool_info

def create_output_dict(
self, answer: str, critique: str, external_tool_info: Dict[str, Any]
self,
answer: str,
critique: str,
external_tool_info: Dict[str, Any]
) -> Dict[str, Any]:
"""Creates an output dictionary containing the answer, critique, and external tool information.
Expand All @@ -171,6 +178,7 @@ def create_output_dict(
Returns:
Dict[str, Any]: The output dictionary with the answer, critique, and external tool info.
"""

output_dict = {
"answer": answer,
"critique": critique,
Expand All @@ -187,7 +195,7 @@ def update_answer_based_on_critique(
critique: str,
prompt: str,
additional_keys: Dict[str, str],
external_tool_info: Dict[str, str],
external_tool_info: Dict[str, Any],
**kwargs: Any,
) -> str:
"""Updates the answer based on the given critique.
Expand Down

0 comments on commit bb86e03

Please sign in to comment.