Skip to content

Conversation

@vblagoje
Copy link
Member

Our classifiers_api.md contains invalid script sample which fails with:

ValueError                                Traceback (most recent call last)
Cell In[1], line 14
     12 p = Pipeline()
     13 p.add_component(instance=DocumentLanguageClassifier(languages=["en"]), name="language_classifier")
---> 14 p.add_component(instance=MetadataRouter(rules={"en": {"language": {"$eq": "en"}}}), name="router")
     15 p.add_component(instance=DocumentWriter(document_store=document_store), name="writer")
     16 p.connect("language_classifier.documents", "router.documents")

File ~/workspace/haystack/haystack/core/component/component.py:290, in ComponentMeta.__call__(cls, *args, **kwargs)
    288 pre_init_hook = _COMPONENT_PRE_INIT_HOOK.get()
    289 if pre_init_hook is None or pre_init_hook.in_progress:
--> 290     instance = super().__call__(*args, **kwargs)
    291 else:
    292     try:

File ~/workspace/haystack/haystack/components/routers/metadata_router.py:105, in MetadataRouter.__init__(self, rules, output_type)
    103 for rule in self.rules.values():
    104     if "operator" not in rule:
--> 105         raise ValueError(
    106             "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details."
    107         )
    108 component.set_output_types(self, unmatched=self.output_type, **dict.fromkeys(rules, self.output_type))

ValueError: Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details.

This is a fix for it.

@vblagoje vblagoje requested a review from a team as a code owner December 11, 2025 14:27
@vblagoje vblagoje requested review from mpangrazzi and removed request for a team December 11, 2025 14:27
@vblagoje vblagoje added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Dec 11, 2025
@vercel
Copy link

vercel bot commented Dec 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
haystack-docs Ignored Ignored Dec 11, 2025 2:27pm

@github-actions github-actions bot added the type:documentation Improvements on the docs label Dec 11, 2025
@vblagoje
Copy link
Member Author

vblagoje commented Dec 11, 2025

@mpangrazzi this is one of those PRs where we are aiming to eventually have fully correct and executable examples in our docs. One markdown document at the time until we have completely verified all docs and keep them in sync. See https://github.com/deepset-ai/haystack-private/issues/182 for more details

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.

👍

@vblagoje vblagoje merged commit 9c52faf into main Dec 15, 2025
24 checks passed
@vblagoje vblagoje deleted the classifiers_doc branch December 15, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release-notes PRs with this flag won't be included in the release notes. type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants