centralize prompt #548
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors api/websocket_wiki.py by externalizing the large, hardcoded system prompts into a separate module api/prompts.py and formatting them dynamically. Feedback on these changes highlights two issues: first, passing research_iteration to DEEP_RESEARCH_FINAL_ITERATION_PROMPT is redundant as the template lacks this placeholder; second, DEEP_RESEARCH_INTERMEDIATE_ITERATION_PROMPT in api/prompts.py uses double curly braces for research_iteration, which escapes the formatting and prevents the actual iteration number from being rendered.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| system_prompt = DEEP_RESEARCH_FINAL_ITERATION_PROMPT.format( | ||
| repo_type=repo_type, | ||
| repo_url=repo_url, | ||
| repo_name=repo_name, | ||
| research_iteration=research_iteration, | ||
| language_name=language_name | ||
| ) |
There was a problem hiding this comment.
The DEEP_RESEARCH_FINAL_ITERATION_PROMPT template in api/prompts.py does not contain a {research_iteration} placeholder. Passing research_iteration to .format() here is redundant and can be removed to keep the code clean.
system_prompt = DEEP_RESEARCH_FINAL_ITERATION_PROMPT.format(
repo_type=repo_type,
repo_url=repo_url,
repo_name=repo_name,
language_name=language_name
)| system_prompt = DEEP_RESEARCH_INTERMEDIATE_ITERATION_PROMPT.format( | ||
| repo_type=repo_type, | ||
| repo_url=repo_url, | ||
| repo_name=repo_name, | ||
| research_iteration=research_iteration, | ||
| language_name=language_name | ||
| ) |
There was a problem hiding this comment.
There is an issue with how DEEP_RESEARCH_INTERMEDIATE_ITERATION_PROMPT is defined in api/prompts.py. On line 134 of api/prompts.py, it uses double curly braces: ## Research Update {{research_iteration}}. Because of the double curly braces, calling .format(research_iteration=research_iteration) here will escape them and output the literal string ## Research Update {research_iteration} to the LLM instead of the actual iteration number. Please update api/prompts.py to use single curly braces {research_iteration} on line 134.
Summary
Reuse the centralized prompt variable in
prompt.py. (related to #306)