Skip to content

Sidecar: align /predict response with Rust guidance contract (add score, avoid silent defaults) #4

Description

@sheawinkler

Problem

  • Rust SidecarGuidance parser expects keys like score/confidence/expected_return/(optional multipliers).
  • The sidecar currently returns prediction (class 0-4), confidence, expected_return, and probabilities, but not score. Missing keys can cause Rust to fall back to defaults (e.g. score=0.5) without operators noticing.

Goal

  • Prevent ‘defaults forever’ behavior by making the contract explicit and stable.

Proposed changes

  • Extend /predict response to include a guidance-friendly scalar score in [0,1] derived from ensemble probabilities (e.g. score = P(buy)+P(strong_buy)).
  • Keep existing fields (prediction class, probabilities) for transparency.
  • Include metadata fields that make it obvious what mapping was used (e.g. metadata.score_definition, metadata.class_prediction).
  • Decide whether to also emit size_multiplier/risk_multiplier/kelly_fraction from sidecar (likely keep sizing in Rust; emit only score + confidence + expected_return unless compatibility demands more).

Acceptance criteria

  • /predict includes score (0..1) + confidence + expected_return explicitly, and documentation explains mapping.
  • Sidecar smoke test extended to validate the presence of score and schema metadata.

Files

  • project/src/api/fastapi_server.py
  • docs/SIDECAR.md (or similar)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions