Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed Aug 18, 2024
1 parent ff03d38 commit 5124014
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion agency_swarm/agents/Devid/tools/util/format_file_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def append_dependencies(self):
"content": f"Extract the dependencies from the file '{file}'."
}
],
model="gpt-3.5-turbo",
model="gpt-4o-mini",
temperature=0,
response_format=Dependencies
)
Expand Down
20 changes: 8 additions & 12 deletions agency_swarm/util/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,9 @@ class Validator(BaseModel):
Validate if an attribute is correct and if not,
return a new value with an error message
"""
reason: str = Field(
default=None,
description="Step-by-step reasoning why the attribute could be valid or not with a conclussion at the end.",
)
is_valid: bool = Field(
default=True,
description="Whether the attribute is valid based on the requirements.",
)
fixed_value: str = Field(
default=None,
description="If the attribute is not valid, suggest a new value for the attribute",
)
reason: str = Field(..., description="Step-by-step reasoning why the attribute could be valid or not with a conclussion at the end.")
is_valid: bool = Field(..., description="Whether the attribute is valid based on the requirements.")
fixed_value: str = Field(..., description="If the attribute is not valid, suggest a new value for the attribute. Otherwise, leave it empty.")

def llm_validator(
statement: str,
Expand Down Expand Up @@ -81,6 +72,11 @@ def llm(v: str) -> str:
temperature=temperature,
)

if resp.choices[0].message.refusal:
raise ValueError(resp.choices[0].message.refusal)

resp = resp.choices[0].message.parsed

# If the response is not valid, return the reason, this could be used in
# the future to generate a better response, via reasking mechanism.
assert resp.is_valid, resp.reason
Expand Down

0 comments on commit 5124014

Please sign in to comment.