mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
fix(strategy): Fix template variables, APIBackend import, and JSON extraction
- Fix {{ ic_values }} template variable not being replaced in prompts
- Fix APIBackend abstract class import (use factory from llm_utils)
- Add robust JSON extraction with python code block fallback
- Add response_format json_object to LLM payload
- Add detailed debug logging for LLM responses
- Simplify prompt variable replacement for readability
Files:
rdagent/components/coder/strategy_orchestrator.py
rdagent/components/prompt_loader.py
rdagent/app/cli.py
prompts/strategy_generation_v4.yaml
This commit is contained in:
@@ -39,8 +39,8 @@ def get_local_prompt_path(name: str) -> Optional[Path]:
|
||||
if not LOCAL_PROMPTS_DIR.exists():
|
||||
return None
|
||||
|
||||
# Try versioned files first (v3, v2, v1, etc.)
|
||||
for version in ["v3", "v2", "v1"]:
|
||||
# Try versioned files first (v4, v3, v2, v1, etc.)
|
||||
for version in ["v4", "v3", "v2", "v1"]:
|
||||
for ext in ["yaml", "yml"]:
|
||||
path = LOCAL_PROMPTS_DIR / f"{name}_{version}.{ext}"
|
||||
if path.exists():
|
||||
@@ -101,12 +101,15 @@ def load_prompt(
|
||||
if local_path:
|
||||
print(f"✓ Loading prompt '{name}' from local: {local_path}")
|
||||
data = load_yaml_file(local_path)
|
||||
|
||||
|
||||
if section:
|
||||
return data.get(section, "")
|
||||
|
||||
# If data is dict with 'system' and 'user', return full dict
|
||||
|
||||
# If data is dict, unwrap single-key dicts (e.g., {'strategy_generation': {'system': ...}})
|
||||
if isinstance(data, dict):
|
||||
# If only one key and it matches the name, unwrap it
|
||||
if len(data) == 1 and name in data:
|
||||
return data[name]
|
||||
return data
|
||||
return str(data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user