-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Description
The migration runner adds a default question parameter to retrieval tools only when the parameters list is empty:
params = list(_get("parameters") or [])
if not params:
params.append({"name": "question", ...})When a retrieval tool defines filter parameters (e.g. genre, language, decade), the question parameter is not added. The Cognitive API then has no way to receive the search query, causing a 500 Internal Server Error at runtime when the model calls the tool.
Steps to reproduce
- Define a
BaseRetrievalToolwith filter parameters but no explicitquestionparameter:
class MovieSearch(BaseRetrievalTool):
description = "Search movies."
retrieval = MovieRetrieval
parameters = [
{"name": "genre", "description": "Filter by genre", "type": "string", "required": False},
]- Run
manage.py migrate agents - Chat with the agent and trigger the retrieval tool → 500 error
Current workaround
Explicitly include a question parameter in the parameters list:
parameters = [
{"name": "question", "description": "Search query", "type": "string", "required": True},
{"name": "genre", "description": "Filter by genre", "type": "string", "required": False},
]Proposed fix
Always ensure a question parameter exists, not just when the list is empty:
params = list(_get("parameters") or [])
if not any(p.get("name") == "question" for p in params):
params.insert(0, {"name": "question", "description": "Search query", "type": "string", "required": True})This is backward-compatible — existing tools that already include question are unaffected.
File
cogsol/management/commands/migrate.py, _retrieval_tool_payload (around line 750)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels