feat(024): define AgentInput and AgentOutput schemas
This commit is contained in:
parent
fa4d01c23a
commit
a53784344d
|
|
@ -1,6 +1,7 @@
|
|||
from .utils.agent_utils import create_msg_delete
|
||||
from .utils.agent_states import AgentState, InvestDebateState, RiskDebateState
|
||||
from .utils.memory import FinancialSituationMemory
|
||||
from .utils.schemas import AgentInput, AgentOutput, PriceTargets
|
||||
|
||||
from .analysts.fundamentals_analyst import create_fundamentals_analyst
|
||||
from .analysts.market_analyst import create_market_analyst
|
||||
|
|
@ -22,6 +23,9 @@ from .trader.trader import create_trader
|
|||
__all__ = [
|
||||
"FinancialSituationMemory",
|
||||
"AgentState",
|
||||
"AgentInput",
|
||||
"AgentOutput",
|
||||
"PriceTargets",
|
||||
"create_msg_delete",
|
||||
"InvestDebateState",
|
||||
"RiskDebateState",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
"""Standardized input/output schemas for the generic agent interface."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class AgentInput(BaseModel):
|
||||
"""Standardized input contract for any trading agent."""
|
||||
|
||||
ticker: str
|
||||
date: str
|
||||
context: dict[str, str] = Field(
|
||||
default_factory=dict,
|
||||
description="Optional context keyed by: market_data, news, fundamentals, sentiment, technical_indicators",
|
||||
)
|
||||
|
||||
|
||||
class PriceTargets(BaseModel):
|
||||
"""Entry, target, and stop-loss price levels."""
|
||||
|
||||
entry: float
|
||||
target: float
|
||||
stop_loss: float
|
||||
|
||||
|
||||
class AgentOutput(BaseModel):
|
||||
"""Standardized output contract for any trading agent."""
|
||||
|
||||
rating: Literal["BUY", "OVERWEIGHT", "HOLD", "UNDERWEIGHT", "SELL"]
|
||||
confidence: float = Field(ge=0.0, le=1.0)
|
||||
price_targets: PriceTargets | None = None
|
||||
thesis: str
|
||||
risk_factors: list[str] = Field(default_factory=list)
|
||||
Loading…
Reference in New Issue