-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathmodels.py
More file actions
39 lines (27 loc) · 865 Bytes
/
models.py
File metadata and controls
39 lines (27 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from __future__ import annotations
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field
class HookType(str, Enum):
ON_PROMPT = "on_prompt"
ON_CONTEXT = "on_context"
ON_TOOL_CALL = "on_tool_call"
ON_MEMORY = "on_memory"
class ValidateRequest(BaseModel):
hook: HookType
payload: str | dict = Field(
description=(
"String for on_prompt and on_memory. "
"Dict for on_tool_call and on_context."
)
)
session_id: Optional[str] = None
class ValidateResponse(BaseModel):
decision: str
sanitised_payload: Optional[str] = None
signals: list[str] = []
score: float = 0.0
rule_based: bool = False
class HealthResponse(BaseModel):
status: str
sidecar: str