Viney Claude Sonnet 4.6 commited on
Commit
240baf7
Β·
1 Parent(s): 19b58ac

fix: normalize signal_type case-insensitively + fix subtext typo

Browse files

Lowercase before canonical check in _normalize_signal_type so mixed-case
LLM values like 'Accounting_Quality' resolve correctly instead of falling
through to the 'language_drift' fallback. Also fix 'subtexte' β†’ 'subtext'
in SubtextRead docstring and BriefOutput.between_the_lines Field description.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. agent/schemas.py +6 -6
agent/schemas.py CHANGED
@@ -374,14 +374,14 @@ def _normalize_signal_type(v: object) -> object:
374
  """
375
  if not isinstance(v, str):
376
  return v
377
- s = v.strip()
378
  if s in _CANONICAL_SIGNAL_TYPES:
379
  return s
380
- mapped = _SIGNAL_TYPE_ALIASES.get(s.lower())
381
  if mapped:
382
- print(f"[signal-type] coercing '{s}' to '{mapped}'", file=sys.stderr)
383
  return mapped
384
- print(f"[signal-type] unknown signal_type '{s}', falling back to 'language_drift'", file=sys.stderr)
385
  return "language_drift"
386
 
387
 
@@ -662,7 +662,7 @@ class EarningsQualitySignal(BaseModel):
662
 
663
 
664
  class SubtextRead(BaseModel):
665
- """A 'reading between the lines' item: surface observation β†’ expert subtexte β†’ implication."""
666
  model_config = ConfigDict(extra="ignore")
667
 
668
  observation: str = Field(
@@ -717,7 +717,7 @@ class BriefOutput(BaseModel):
717
  between_the_lines: list[SubtextRead] = Field(
718
  default_factory=list,
719
  description=(
720
- "0-3 expert 'between the lines' readings β€” surface observation + subtexte + implication. "
721
  "EMPTY LIST IS VALID β€” never manufacture readings. Only emit items anchored to a "
722
  "precomputed edge signal or a verbatim cross-referenced evidence snippet."
723
  )
 
374
  """
375
  if not isinstance(v, str):
376
  return v
377
+ s = v.strip().lower() # lowercase first β€” canonicals are all lowercase
378
  if s in _CANONICAL_SIGNAL_TYPES:
379
  return s
380
+ mapped = _SIGNAL_TYPE_ALIASES.get(s) # s is already lowercased
381
  if mapped:
382
+ print(f"[signal-type] coercing '{v}' to '{mapped}'", file=sys.stderr)
383
  return mapped
384
+ print(f"[signal-type] unknown signal_type '{v}', falling back to 'language_drift'", file=sys.stderr)
385
  return "language_drift"
386
 
387
 
 
662
 
663
 
664
  class SubtextRead(BaseModel):
665
+ """A 'reading between the lines' item: surface observation β†’ expert subtext β†’ implication."""
666
  model_config = ConfigDict(extra="ignore")
667
 
668
  observation: str = Field(
 
717
  between_the_lines: list[SubtextRead] = Field(
718
  default_factory=list,
719
  description=(
720
+ "0-3 expert 'between the lines' readings β€” surface observation + subtext + implication. "
721
  "EMPTY LIST IS VALID β€” never manufacture readings. Only emit items anchored to a "
722
  "precomputed edge signal or a verbatim cross-referenced evidence snippet."
723
  )