docs: fix docstring parameter names in three components - #12204
docs: fix docstring parameter names in three components#12204iridescentWen wants to merge 1 commit into
Conversation
Three docstrings did not match their signatures: - `LinkContentFetcher.__init__` accepts `request_headers` (used in `_get_headers()`) but never documented it, while documenting every other init parameter. - `Sum.run` documents `:param value:`; the parameter is `values`. - `Threshold.run` takes `value` and `threshold` but only documented `threshold`. Docstrings only, no behavior change.
|
@iridescentWen is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
|
|
Hi @iridescentWen, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
Related Issues
None — no prior issue. This is a docstring-only correction found while reading the code; happy to open one if you'd prefer that order.
Proposed Changes:
Three docstrings disagreed with their own signatures. I found these by walking every function in
haystack/withastand diffing the:paramnames against the actual parameters.1.
LinkContentFetcher.__init__—request_headerswas undocumented (haystack/components/fetchers/link_content.py)The signature takes
request_headers: dict[str, str] | None = Noneand it is a real, functional parameter —_get_headers()mergesself.request_headersinto the outgoing headers. Every other init parameter is documented, so this one being absent reads as an omission rather than a deliberate choice. Added an entry describing it, including its precedence, which I took from the existing comment in_get_headers:2.
Sum.run— wrong parameter name (haystack/testing/sample_components/sum.py)Documents
:param value:; the parameter isvalues: Variadic[int]. One-character fix.3.
Threshold.run— missing parameter (haystack/testing/sample_components/threshold.py)Takes
valueandthreshold, documented onlythreshold. Addedvalue.3 files, +4/-1. Docstrings only — no executable line changed.
How did you test it?
No new tests: nothing executable changed, so there is no behavior to assert on. I ran the existing suites instead.
I also re-ran the
astwalk after the change: the three functions now have no documented-but-nonexistent params and no undocumented ones.Notes for the reviewer
On the release note: I did not add one. Per CONTRIBUTING, "Pull requests with changes limited to tests, code comments or docstrings ... can be labeled with
ignore-for-release-notesby a maintainer in order to bypass the CI check." This PR is entirely docstrings, so I believe it qualifies — but only a maintainer can apply that label, so the release-note CI check will fail until someone does. Say the word if you'd rather I add arenonote instead and I'll push one.Four near-misses I deliberately left alone. My scan also flagged these, and I checked each against the source and concluded they are correct as written — noting them so you know they were considered, not missed:
ContextRelevanceEvaluator.run/run_asyncandFaithfulnessEvaluator.run/run_asyncdocumentquestions/contexts/predicted_answerswhile the signature is**inputs. Those names come fromself.inputsin__init__, so documenting the real keyword names is more useful to a caller than documenting**inputs.LLM.run/run_asyncdocumentmessages, which lives in**kwargs. The code says why (# messages is intentionally omitted from the signature so the framework can treat it as required or optional depending on init configuration), and the docstring already says "Passed via**kwargs."Three typos I did not touch.
codespellfindstrough→through,Docmentation→Documentation, andalogrithm→algorithminreleasenotes/notes/*.yaml. Those are notes for already-shipped releases, so I left them as historical record rather than rewriting them here. Let me know if you'd like a separate PR.Checklist
docs:).ignore-for-release-notesinstead, see Notes for the reviewer.hatch run fmtclean, no files changed.I used an AI assistant (Claude Code) to help write and verify this change. I have reviewed every line and run the tests above myself.