cryptoagentbench-api / agents /researcher.py
Mehdi
feat: backend
68025ee
Raw
History Blame Contribute Delete
1.05 kB
from agents.base import Agent
from llm.prompts import RESEARCHER_SYSTEM, build_researcher_prompt
class Researcher(Agent):
def __init__(self, llm_client):
super().__init__("Researcher", RESEARCHER_SYSTEM, llm_client)
def build_prompt(self, context: dict) -> str:
return build_researcher_prompt(
context.get("tech_analysis", {}),
context.get("news_analysis", {}),
context.get("sentiment_analysis", {}),
context.get("asset", "BTC/USDT"),
)
def parse(self, raw: str) -> dict:
result = super().parse(raw)
verdict = result.get("verdict", "NEUTRAL").upper()
if verdict not in ("BULLISH", "BEARISH", "NEUTRAL"):
verdict = "NEUTRAL"
return {
"verdict": verdict,
"conviction": float(result.get("conviction", 0.5)),
"bull_points": result.get("bull_points", []),
"bear_points": result.get("bear_points", []),
"synthesis": str(result.get("synthesis", "")),
}