-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix additional evaluation display failures for non-dict objects #1820
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbczumar
commented
Nov 18, 2024
Comment on lines
+133
to
+138
| ( | ||
| lambda text: Predict("text: str -> entities: List[Dict[str, str]]")(text=text).entities, | ||
| dspy.Example(text="United States", entities=[{"name": "United States", "type": "location"}]).with_inputs( | ||
| "text" | ||
| ), | ||
| ), |
Collaborator
Author
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.
This fails on main with:
def merge_dicts(d1, d2) -> dict:
merged = {}
for k, v in d1.items():
if k in d2:
merged[f"example_{k}"] = v
else:
merged[k] = v
> for k, v in d2.items():
E AttributeError: 'list' object has no attribute 'items'
../../dspy/evaluate/evaluate.py:204: AttributeError
============================================================= warnings summary =============================================================
../../../miniconda3/envs/default/lib/python3.10/site-packages/pydantic/_internal/_config.py:291
/Users/corey.zumar/miniconda3/envs/default/lib/python3.10/site-packages/pydantic/_internal/_config.py:291: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.9/migration/
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
../../../miniconda3/envs/default/lib/python3.10/site-packages/wandb/env.py:16
/Users/corey.zumar/miniconda3/envs/default/lib/python3.10/site-packages/wandb/env.py:16: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.util import strtobool
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================= short test summary info ==========================================================
FAILED test_evaluate.py::test_evaluate_display_table[False-True-program_with_example0] - AttributeError: 'list' object has no attribute 'items'
def merge_dicts(d1, d2) -> dict:
merged = {}
for k, v in d1.items():
if k in d2:
merged[f"example_{k}"] = v
else:
merged[k] = v
> for k, v in d2.items():
E AttributeError: 'list' object has no attribute 'items'
../../dspy/evaluate/evaluate.py:204: AttributeError
============================================================= warnings summary =============================================================
../../../miniconda3/envs/default/lib/python3.10/site-packages/pydantic/_internal/_config.py:291
/Users/corey.zumar/miniconda3/envs/default/lib/python3.10/site-packages/pydantic/_internal/_config.py:291: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.9/migration/
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
../../../miniconda3/envs/default/lib/python3.10/site-packages/wandb/env.py:16
/Users/corey.zumar/miniconda3/envs/default/lib/python3.10/site-packages/wandb/env.py:16: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.util import strtobool
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================= short test summary info ==========================================================
FAILED test_evaluate.py::test_evaluate_display_table[False-True-program_with_example0] - AttributeError: 'list' object has no attribute 'items'
dbczumar
commented
Nov 18, 2024
Comment on lines
+139
to
+142
| ( | ||
| lambda text: Predict("text: str -> first_word: Tuple[str, int]")(text=text).words, | ||
| dspy.Example(text="United States", first_word=("United", 6)).with_inputs("text"), | ||
| ), |
Collaborator
Author
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.
Providing some additional coverage for non-list and non-dict outputs
isaacbmiller
pushed a commit
that referenced
this pull request
Dec 11, 2024
* Fix Signed-off-by: dbczumar <corey.zumar@databricks.com> * Handle lists of dicts Signed-off-by: dbczumar <corey.zumar@databricks.com> * fix Signed-off-by: dbczumar <corey.zumar@databricks.com> * fix Signed-off-by: dbczumar <corey.zumar@databricks.com> --------- Signed-off-by: dbczumar <corey.zumar@databricks.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix additional evaluation display failures for non-dict objects