Spaces:
Sleeping
Sleeping
File size: 1,046 Bytes
68025ee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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", "")),
}
|