-
Notifications
You must be signed in to change notification settings - Fork 83
Pydantic Typing #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pydantic Typing #268
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,19 @@ | ||||||||||||||||||||||
from pydantic import BaseModel, field_validator | ||||||||||||||||||||||
from typing import Dict, Any, Optional | ||||||||||||||||||||||
import warnings | ||||||||||||||||||||||
|
||||||||||||||||||||||
class Tool(BaseModel): | ||||||||||||||||||||||
tool_name: str | ||||||||||||||||||||||
parameters: Optional[Dict[str, Any]] = None | ||||||||||||||||||||||
|
||||||||||||||||||||||
@field_validator('tool_name') | ||||||||||||||||||||||
def validate_tool_name(cls, v): | ||||||||||||||||||||||
if not v: | ||||||||||||||||||||||
warnings.warn("Tool name is empty or None", UserWarning) | ||||||||||||||||||||||
return v | ||||||||||||||||||||||
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Is an empty or missing What are your thoughts on making this validation stricter?
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
@field_validator('parameters') | ||||||||||||||||||||||
def validate_parameters(cls, v): | ||||||||||||||||||||||
if v is not None and not isinstance(v, dict): | ||||||||||||||||||||||
warnings.warn(f"Parameters should be a dictionary, got {type(v)}", UserWarning) | ||||||||||||||||||||||
return v | ||||||||||||||||||||||
Comment on lines
+15
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This validator checks if Since Pydantic field validators default to If a non-dictionary value (that Pydantic cannot coerce to a dict) is provided for Therefore, the condition Could you clarify the intended behavior here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the
threshold
parameter was removed from theToolOrderScorer
instantiation. TheToolOrderScorer
class (defined insrc/judgeval/scorers/judgeval_scorers/api_scorers/tool_order.py
) has a defaultthreshold
of1.0
. Previously, it was explicitly set to0.5
here.This change means the scorer will now be stricter (requiring a perfect score of 1.0 by default, instead of 0.5).
Could you clarify if this change in scoring behavior for the test is intentional? If this test was designed to pass or measure behavior at a 0.5 threshold, changing it to 1.0 might alter the test's purpose or outcome.