Skip to content

Wire --context flag through to query expansion#628

Open
n0vakovic wants to merge 1 commit into
tobi:mainfrom
n0vakovic:milan/wire-context-flag
Open

Wire --context flag through to query expansion#628
n0vakovic wants to merge 1 commit into
tobi:mainfrom
n0vakovic:milan/wire-context-flag

Conversation

@n0vakovic
Copy link
Copy Markdown

The --context flag is parsed by parseCLI() (declared in the parseArgs options block) but never assigned to the opts object passed downstream. As a result, qmd query --context "..." accepts the flag silently and has zero effect on query expansion or the HyDE prompt — expandQueryStructured(query, true, opts.context) always receives undefined.

This patch adds the missing one-line wiring inside the opts literal in parseCLI():

context: values.context as string | undefined,

Verification

Smoke-tested on Bun 1.3.13 against a local collection:

  • Without --context: HyDE expansion is generic ("psychological description of fear and anxiety…").
  • With --context "in the Joe Hudson AoA podcast, fear and anxiety often refer to vulnerability, what wants to be felt, or unprocessed grief": HyDE expansion is corpus-aware ("In the Joe Hudson AoA podcast, fear and anxiety are often discussed in the context of…"), top result shifts, downstream rerank ordering changes meaningfully.

Notes

  • No behavior change when --context is omitted (values.context is undefined, threads through as undefined, no-op in expandQueryStructured).
  • Adjacent recent work on the query path (intent parameter, --no-expand PR feat: add --no-expand flag to qmd query #622) suggested the maintainer is iterating in this area — happy to rebase if needed.

The --context flag was parsed by parseCLI() but never assigned to the
opts object passed downstream, so qmd query --context "..." accepted
the flag silently with zero effect on query expansion or HyDE.

Adds the missing one-line wiring inside the opts literal in parseCLI().
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.

1 participant