-
Notifications
You must be signed in to change notification settings - Fork 1.9k
deprecate: Dataset without name parameter #4862
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
Changes from 1 commit
4a7c58d
13c41b2
97c839a
03856a0
cb4684a
944d9df
c63ebda
7c59c60
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 |
|---|---|---|
|
|
@@ -196,6 +196,7 @@ def evaluate(self, ctx: EvaluatorContext) -> bool: | |
| return ctx.output == ctx.expected_output | ||
|
|
||
| dataset = Dataset( | ||
| name='uppercase_tests', | ||
| cases=[ | ||
| Case(name='test1', inputs={'text': 'Hello'}, expected_output='HELLO'), | ||
| Case(name='test2', inputs={'text': 'World'}, expected_output='WORLD'), | ||
|
|
@@ -226,7 +227,7 @@ async def main(): | |
| """ | ||
|
|
||
| name: str | None = None | ||
| """Optional name of the dataset.""" | ||
| """Name of the dataset. Required in future versions.""" | ||
| cases: list[Case[InputsT, OutputT, MetadataT]] | ||
| """List of test cases in the dataset.""" | ||
| evaluators: list[Evaluator[InputsT, OutputT, MetadataT]] = [] | ||
|
|
@@ -245,11 +246,19 @@ def __init__( | |
| """Initialize a new dataset with test cases and optional evaluators. | ||
|
|
||
| Args: | ||
| name: Optional name for the dataset. | ||
| name: Name for the dataset. Omitting this is deprecated and will raise an error in a future version. | ||
| cases: Sequence of test cases to include in the dataset. | ||
| evaluators: Optional sequence of evaluators to apply to all cases in the dataset. | ||
| report_evaluators: Optional sequence of report evaluators that run on the full evaluation report. | ||
| """ | ||
| if name is None: | ||
| warnings.warn( | ||
| 'Omitting the `name` parameter is deprecated. ' | ||
| 'Please provide a name for your Dataset.', | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
|
Comment on lines
+255
to
+260
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.
Useful? React with 👍 / 👎.
Comment on lines
+255
to
+260
Contributor
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. 🚩 Incomplete deprecation migration across docs The PR updates Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| case_names = set[str]() | ||
| for case in cases: | ||
| if case.name is None: | ||
|
|
@@ -727,9 +736,9 @@ def _from_dataset_model( | |
| cases.append(row) | ||
| if errors: | ||
| raise ExceptionGroup(f'{len(errors)} error(s) loading evaluators from registry', errors[:3]) | ||
| result = cls(name=dataset_model.name, cases=cases, report_evaluators=report_evaluators) | ||
| if result.name is None: | ||
| result.name = default_name | ||
| # Use default_name if no name was provided in the serialized data | ||
| name = dataset_model.name if dataset_model.name is not None else default_name | ||
| result = cls(name=name, cases=cases, report_evaluators=report_evaluators) | ||
|
Contributor
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 change is correct — it avoids the deprecation warning when loading from file (where
Comment on lines
+739
to
+741
Contributor
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. 🟡 Deprecation warning When Was this helpful? React with 👍 or 👎 to provide feedback.
Collaborator
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. Claude: |
||
| result.evaluators = dataset_evaluators | ||
| return result | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.