forked from phoenix-oss/llama-stack-mirror
Regenerate openapi
This commit is contained in:
parent
e951852848
commit
d7dc69c8a9
4 changed files with 933 additions and 90 deletions
|
@ -155,16 +155,23 @@ class SpanWithChildren(Span):
|
|||
status: Optional[SpanStatus] = None
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class QueryConditionOp(Enum):
|
||||
EQ = "eq"
|
||||
NE = "ne"
|
||||
GT = "gt"
|
||||
LT = "lt"
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class QueryCondition(BaseModel):
|
||||
key: str
|
||||
op: Literal["eq", "ne", "gt", "lt"]
|
||||
op: QueryConditionOp
|
||||
value: Any
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class Telemetry(Protocol):
|
||||
|
||||
@webmethod(route="/telemetry/log-event")
|
||||
async def log_event(
|
||||
self, event: Event, ttl_seconds: int = DEFAULT_TTL_DAYS * 86400
|
||||
|
|
|
@ -14,7 +14,6 @@ from llama_stack.apis.telemetry import QueryCondition, SpanWithChildren, Trace
|
|||
|
||||
|
||||
class TraceStore(Protocol):
|
||||
|
||||
async def query_traces(
|
||||
self,
|
||||
attribute_filters: Optional[List[QueryCondition]] = None,
|
||||
|
@ -42,7 +41,6 @@ class SQLiteTraceStore(TraceStore):
|
|||
offset: Optional[int] = 0,
|
||||
order_by: Optional[List[str]] = None,
|
||||
) -> List[Trace]:
|
||||
|
||||
def build_where_clause() -> tuple[str, list]:
|
||||
if not attribute_filters:
|
||||
return "", []
|
||||
|
@ -50,7 +48,7 @@ class SQLiteTraceStore(TraceStore):
|
|||
ops_map = {"eq": "=", "ne": "!=", "gt": ">", "lt": "<"}
|
||||
|
||||
conditions = [
|
||||
f"json_extract(s.attributes, '$.{condition.key}') {ops_map[condition.op]} ?"
|
||||
f"json_extract(s.attributes, '$.{condition.key}') {ops_map[condition.op.value]} ?"
|
||||
for condition in attribute_filters
|
||||
]
|
||||
params = [condition.value for condition in attribute_filters]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue