Skip to content

Add backward compatibility for search_docs_tool tool#219

Open
eltonjohnfanboy wants to merge 2 commits into
Qiskit:mainfrom
eltonjohnfanboy:at-search-docs-tool-bw-compatibility
Open

Add backward compatibility for search_docs_tool tool#219
eltonjohnfanboy wants to merge 2 commits into
Qiskit:mainfrom
eltonjohnfanboy:at-search-docs-tool-bw-compatibility

Conversation

@eltonjohnfanboy

Copy link
Copy Markdown
Contributor

Description

In this PR we add the parameters details = full in the search_docs_tool tool, so it can return all the searches and full text if needed. By default it will still use the detail = snippet mode.

Linked Issue(s)

Fixes #218

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@cbjuan

cbjuan commented Jul 3, 2026

Copy link
Copy Markdown
Member

Review: detail="full" doesn't fully close #218 (result count still capped)

Thanks for this — the field-passthrough restoration in detail="full" mode is clean and correct (shallow copy only reassigns immutable top-level keys, so cached upstream items aren't mutated; HTML stripping matches the pre-snippet v0.2.0 behavior). One gap worth addressing before merge:

Issue #218 asks for an option that "would return all the 50 results and all the text." This PR restores all the text/fields, but not all the results. In search_qiskit_docs, results are still sliced unconditionally:

selected = results[:effective_top_k]

and effective_top_k is clamped to MAX_SEARCH_TOP_K (default 10). So even with detail="full", a caller gets at most 10 results (5 by default) — there's no way to reach the original 50.

Scenario: upstream returns 50 matches; a user upgrading from 0.2.0 sets detail="full" expecting the old full result set → receives only 5 (or at most 10 with top_k=10). The PR description's "return all the searches" isn't achievable through the tool as written.

Suggested fix (either works):

  • Let full mode bypass the top_k clamp (or raise its ceiling in that mode) so it can return the complete result set, or
  • Keep the cap and adjust the PR/issue scope + docstrings to state that full restores fields/text but the result count stays capped.

The snippet-by-default behavior is correct — #218 explicitly wants the original-behavior option disabled by default, so no change needed there.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEATURE: Add backward compatibility for search_docs_tool

2 participants