plexus.dashboard.api.models.score_result module
- class plexus.dashboard.api.models.score_result.ScoreResult(id: str, value: float, itemId: str, accountId: str, scorecardId: str, confidence: float | None = None, metadata: Dict | None = None, scoringJobId: str | None = None, evaluationId: str | None = None, correct: bool | None = None, client: _BaseAPIClient | None = None)
Bases:
BaseModel
Represents a single classification or scoring result in the Plexus dashboard.
ScoreResult is the core data structure for tracking individual scoring operations, used both for real-time scoring and evaluation. It integrates with the GraphQL API to provide:
Score value tracking with confidence
Metadata storage for debugging and analysis
Links to related entities (items, accounts, scorecards)
Evaluation result tracking
Batch processing support
Common usage patterns: 1. Creating a single score result:
- result = ScoreResult.create(
client=client, value=0.95, itemId=”item-123”, accountId=”acc-456”, scorecardId=”card-789”, metadata={“source”: “phone_call”}
)
- Batch creation for efficiency:
- results = ScoreResult.batch_create(client, [
- {
“value”: 0.95, “itemId”: “item-123”, “accountId”: “acc-456”, “scorecardId”: “card-789”
}, {
“value”: 0.82, “itemId”: “item-124”, “accountId”: “acc-456”, “scorecardId”: “card-789”
}
])
- Updating with evaluation results:
- result.update(
correct=True, evaluationId=”eval-123”, metadata={“human_label”: “Yes”}
)
ScoreResult is commonly used with: - Evaluation for accuracy testing - ScoringJob for batch processing - LangGraphScore for LLM-based classification
- __init__(id: str, value: float, itemId: str, accountId: str, scorecardId: str, confidence: float | None = None, metadata: Dict | None = None, scoringJobId: str | None = None, evaluationId: str | None = None, correct: bool | None = None, client: _BaseAPIClient | None = None)
- accountId: str
- classmethod batch_create(client: _BaseAPIClient, items: List[Dict]) List[ScoreResult]
Create multiple score results in a single API request.
- confidence: float | None = None
- correct: bool | None = None
- classmethod create(client: _BaseAPIClient, value: float, itemId: str, accountId: str, scorecardId: str, scoringJobId: str | None = None, evaluationId: str | None = None, **kwargs) ScoreResult
Create a new score result.
- Args:
client: The API client instance value: Score value (required) itemId: ID of scored item (required) accountId: Account context (required) scorecardId: ID of scorecard used (required) scoringJobId: ID of scoring job (optional) evaluationId: ID of evaluation (optional) **kwargs: Optional fields:
confidence: float
metadata: dict (will be JSON serialized)
correct: bool
- Note:
Either scoringJobId or evaluationId should be provided, but not required
- evaluationId: str | None = None
- classmethod fields() str
Return the GraphQL fields to query for this model
- classmethod from_dict(data: Dict[str, Any], client: _BaseAPIClient) ScoreResult
Create a ScoreResult instance from API response data.
- itemId: str
- metadata: Dict | None = None
- scorecardId: str
- scoringJobId: str | None = None
- update(**kwargs) ScoreResult
Update this score result with new values.
- value: float