Skip to content
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

fix: error on invalid type #8711

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

tstadel
Copy link
Member

@tstadel tstadel commented Jan 13, 2025

Related Issues

  • fixes getting cryptic Value error if type '' is passed:
    ValueError: not enough values to unpack (expected 2, got 1)

Proposed Changes:

  • raise PipelineError

How did you test it?

  • added test

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@tstadel tstadel requested a review from a team as a code owner January 13, 2025 09:43
@tstadel tstadel requested review from anakin87 and removed request for a team January 13, 2025 09:43
@tstadel tstadel requested a review from a team as a code owner January 13, 2025 09:49
@tstadel tstadel requested review from dfokina and removed request for a team January 13, 2025 09:49
@coveralls
Copy link
Collaborator

coveralls commented Jan 13, 2025

Pull Request Test Coverage Report for Build 12744599424

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 31 unchanged lines in 1 file lost coverage.
  • Overall coverage remained the same at 91.303%

Files with Coverage Reduction New Missed Lines %
core/pipeline/base.py 31 88.64%
Totals Coverage Status
Change from base Build 12735326068: 0.0%
Covered Lines: 8850
Relevant Lines: 9693

💛 - Coveralls

Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR...

Do you know when this problem happens? When are we serializing empty types?

Also, what do you think about catching empty strings earlier in the process? It might be helpful to raise a clearer error message. Maybe extend the check here, for instance:
Extend the check here, for example

                if "type" not in component_data:
                    raise PipelineError(f"Missing 'type' in component '{name}'")

@tstadel
Copy link
Member Author

tstadel commented Jan 22, 2025

Thanks for the PR...

Do you know when this problem happens? When are we serializing empty types?

Also, what do you think about catching empty strings earlier in the process? It might be helpful to raise a clearer error message. Maybe extend the check here, for instance: Extend the check here, for example

                if "type" not in component_data:
                    raise PipelineError(f"Missing 'type' in component '{name}'")

I think this type of error is a bit exotic, dc's pipeline builder falls back to empty string if a component type is not known. But this can be fixed otherwise. For haystack, there should be just a reasonable error message in that case.

Do you think it's worth the granularity? An empty string is one case where it breaks, a string without "." is another. The proposed solution solves both in very simple way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants