fix(migrate): auto-add question param to retrieval tools with filters#46
Open
MicaPerdomo wants to merge 1 commit intocogsol:mainfrom
Open
fix(migrate): auto-add question param to retrieval tools with filters#46MicaPerdomo wants to merge 1 commit intocogsol:mainfrom
MicaPerdomo wants to merge 1 commit intocogsol:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_retrieval_tool_payloadonly added thequestionparameter when the parameters list was empty. If a retrieval tool defined filter parameters (e.g. genre, language),questionwas skipped, causing a 500 error at runtime because the API had no way to receive the search query.if not paramstoif not any(p.get("name") == "question" for p in params)soquestionis always present unless explicitly defined by the user.Note: the original code used
append(position didn't matter on an empty list). The fix usesinsert(0, ...)to placequestionfirst, which makes semantic sense as the primary parameter. If the API doesn't depend on parameter order,appendwould also work — butinsert(0, ...)is a reasonable default for readability and convention.Closes #12
Test plan
test_adds_question_when_params_empty— no regression on the original behaviortest_adds_question_when_only_filter_params— the actual bug scenariotest_does_not_duplicate_question_if_already_present— backward compat with explicit question