You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: detectors/common/scheme.py
+26-1Lines changed: 26 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
fromenumimportEnum
2
-
fromtypingimportDict, List, Optional
2
+
fromtypingimportAny, Dict, List, Optional
3
3
4
4
frompydanticimportBaseModel, Field, RootModel
5
5
@@ -134,6 +134,7 @@ class ContentAnalysisResponse(BaseModel):
134
134
description="Optional field providing evidences for the provided detection",
135
135
default=None,
136
136
)
137
+
metadata: Optional[Dict[str, Any]] =Field(default_factory=dict, description="Additional metadata from evaluation")
137
138
138
139
139
140
classContentsAnalysisResponse(RootModel):
@@ -145,3 +146,27 @@ class ContentsAnalysisResponse(RootModel):
145
146
classError(BaseModel):
146
147
code: int
147
148
message: str
149
+
150
+
classMetricsListResponse(BaseModel):
151
+
"""Response for listing available metrics."""
152
+
metrics: List[str] =Field(description="List of available metric names")
153
+
total: int=Field(description="Total number of available metrics")
154
+
155
+
classGenerationAnalysisHttpRequest(BaseModel):
156
+
prompt: str=Field(description="Prompt is the user input to the LLM", example="What do you think about the future of AI?")
157
+
generated_text: str=Field(description="Generated response from the LLM", example="The future of AI is bright but we need to be careful about the risks.")
158
+
detector_params: Optional[Dict[str, Any]] =Field(
159
+
default_factory=dict,
160
+
description="Detector parameters for evaluation (e.g., metric, criteria, etc.)",
161
+
example={"metric": "safety"}
162
+
)
163
+
164
+
classGenerationAnalysisResponse(BaseModel):
165
+
detection: str=Field(example="safe")
166
+
detection_type: str=Field(example="llm_judge")
167
+
score: float=Field(example=0.8)
168
+
evidences: Optional[List[EvidenceObj]] =Field(
169
+
description="Optional field providing evidences for the provided detection",
170
+
default=[],
171
+
)
172
+
metadata: Optional[Dict[str, Any]] =Field(default_factory=dict, description="Additional metadata from evaluation")
0 commit comments