fix(api): Use list[Any] for strengths to preserve V2 fields

Pydantic was coercing V2 StrengthToProtect dicts to the partial
ReportStrengthResponse type, dropping fields like `percentage` and
`top_quotes`. Changed to list[Any] to pass through raw data.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-01-30 15:33:08 +00:00
parent 2a292e0754
commit 479f1ee94a

View File

@@ -373,7 +373,8 @@ class SynthesisResponse(BaseModel):
# The Strengths (can be v1 or v2 format depending on report_version)
# V1: list[ReportStrengthResponse], V2: list[StrengthToProtect dict]
strengths: list[ReportStrengthResponse] | list[dict] = Field(default_factory=list, description="Key strengths to protect")
# Using list[Any] to prevent Pydantic from coercing/dropping fields
strengths: list[Any] = Field(default_factory=list, description="Key strengths to protect")
# Momentum
momentum: str = Field("stable", description="improving/declining/stable")