Skip to content

fix: honor --top-k in interactive talk mode - #70

Open
dex0shubham wants to merge 2 commits into
yifanfeng97:mainfrom
dex0shubham:fix/talk-interactive-top-k
Open

fix: honor --top-k in interactive talk mode#70
dex0shubham wants to merge 2 commits into
yifanfeng97:mainfrom
dex0shubham:fix/talk-interactive-top-k

Conversation

@dex0shubham

Copy link
Copy Markdown
Contributor

Problem

he talk <ka> -i -n 10 (interactive mode) ignores --top-k/-n. The talk command parses top_k and even prints it (Top K: {top_k}), but the interactive branch calls chat_loop(ka, ka_path) without it, and inside the loop ka.chat(query) runs with no top_k, falling back to the method default (top_k=3). The non-interactive branch correctly passes ka.chat(query, top_k=top_k).

Fix

Thread top_k through chat_loop:

  • def chat_loop(ka, ka_path, top_k=3)
  • ka.chat(query, top_k=top_k) inside the loop
  • chat_loop(ka, ka_path, top_k=top_k) at the call site

Tests

tests/cli/test_talk.py: a stub KA records the top_k forwarded by chat_loop; asserts 10 is used, not the default. Fails on the pre-fix code.

ruff check/ruff format --check on hyperextract clean.

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