File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,10 +76,6 @@ def social_media_analyst_node(state):
7676 render_sentiment_report ,
7777 "Social Media Analyst" ,
7878 )
79- # invoke_structured_or_freetext falls back to plain llm.invoke when
80- # structured output fails; in that case it returns an AIMessage, not a str.
81- if hasattr (report , "content" ):
82- report = report .content
8379
8480 return {
8581 "messages" : [result ],
Original file line number Diff line number Diff line change @@ -265,8 +265,10 @@ class SentimentReport(BaseModel):
265265 overall_band : SentimentBand = Field (
266266 description = (
267267 "Categorical sentiment label. Pick the band that best matches the "
268- "overall_score: Bullish (7-10), Mildly Bullish (5.5-7), Neutral/Mixed "
269- "(4.5-5.5), Mildly Bearish (3-4.5), Bearish (0-3)."
268+ "overall_score: Bullish (7.1-10), Mildly Bullish (5.6-7.0), Neutral "
269+ "(4.5-5.5, flat outlook with no strong signal), Mixed "
270+ "(4.5-5.5, high-volume but conflicting signals), "
271+ "Mildly Bearish (3.0-4.4), Bearish (0-2.9)."
270272 ),
271273 )
272274 confidence : Literal ["low" , "medium" , "high" ] = Field (
@@ -296,5 +298,6 @@ def render_sentiment_report(report: SentimentReport) -> str:
296298 f"**Overall Sentiment:** **{ report .overall_band .value } ** "
297299 f"(Score: { report .overall_score :.1f} /10, Confidence: { report .confidence } )" ,
298300 "" ,
301+ "" ,
299302 ])
300303 return header + report .narrative
You can’t perform that action at this time.
0 commit comments