Spaces:
Runtime error
Runtime error
Create ai_event.py
Browse files- ai_event.py +17 -0
ai_event.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
from typing import Optional, List, Dict, Any
|
| 3 |
+
from pydantic import Field
|
| 4 |
+
from agentic_reliability_framework.core.models.event import ReliabilityEvent
|
| 5 |
+
|
| 6 |
+
class AIEvent(ReliabilityEvent):
|
| 7 |
+
"""Extended event for AI system monitoring."""
|
| 8 |
+
model_name: str = Field(..., description="Identifier of the AI model used")
|
| 9 |
+
model_version: str = Field(..., description="Version/tag of the model")
|
| 10 |
+
prompt: str = Field(..., description="Input prompt/query")
|
| 11 |
+
response: str = Field(..., description="Generated response")
|
| 12 |
+
response_length: int = Field(ge=0, description="Number of tokens/characters")
|
| 13 |
+
confidence: float = Field(ge=0, le=1, description="Model's confidence score (if available)")
|
| 14 |
+
perplexity: Optional[float] = Field(None, ge=0, description="Perplexity/entropy measure")
|
| 15 |
+
retrieval_scores: Optional[List[float]] = Field(None, description="Similarity scores of retrieved documents")
|
| 16 |
+
user_feedback: Optional[bool] = Field(None, description="User thumbs up/down")
|
| 17 |
+
latency_ms: float = Field(ge=0, description="Response generation time in milliseconds")
|