HKUDS/DeepTutor · error · ValueError
CodeGeneratorAgent prompts are not configured.
Error message
CodeGeneratorAgent prompts are not configured.
What it means
Raised in CodeGeneratorAgent.process when the required prompt templates (shared base, general rules, or the format-specific rule block) are not configured/loadable. Code generation cannot proceed without its prompt assembly inputs; points at a broken prompt resource load rather than bad user input.
Solutions
- Ensure the code-generator prompt resources ship with the package and load at agent init
- Validate that per-render-type rule block keys exist for svg/chartjs/mermaid/html
- Reinstall or repair the prompts directory if missing
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at deeptutor/agents/visualize/agents/code_generator_agent.py:52 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/31c40d2ca1753bc9.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/agents/visualize/agents/code_generator_agent.py:52
user_input: str,
history_context: str,
analysis: VisualizationAnalysis,
) -> str:
# Structured prompt assembly: every render type loads the shared
# base + general rules, plus exactly one format-specific rule block.
# This keeps the per-call prompt dense with the rules that matter for
# *this* format without ever paying for the union of all four.
# render_type here is always one of svg/chartjs/mermaid/html — manim
# is dispatched away in the capability layer before code generation.
system_parts = (
self.get_prompt("system_base"),
self.get_prompt("rules_general"),
self.get_prompt(f"rules_{analysis.render_type}"),
)
system_prompt = "\n\n".join(part.strip() for part in system_parts if part and part.strip())
user_template = self.get_prompt("user_template")
if not system_prompt or not user_template:
raise ValueError("CodeGeneratorAgent prompts are not configured.")
user_prompt = user_template.format(
user_input=user_input.strip(),
history_context=history_context.strip() or "(none)",
render_type=analysis.render_type,
analysis_json=json.dumps(analysis.model_dump(), ensure_ascii=False, indent=2),
)
# Blocking rather than streamed: the fenced block is only usable whole.
response = await self.call_llm(
user_prompt=user_prompt,
system_prompt=system_prompt,
stage="generating",
trace_meta=build_trace_metadata(
call_id=new_call_id("viz-codegen"),
phase="generating",
label="Code generation",
call_kind="viz_code_generation",View on GitHub (pinned to 3e82f13042)