Repository navigation
Expand file tree
/
Copy paththread.py
More file actions
203 lines (163 loc) · 6.35 KB
/
Copy paththread.py
File metadata and controls
203 lines (163 loc) · 6.35 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Dict, List, Optional
from datetime import datetime
from .._models import BaseModel
__all__ = ["Thread", "FeedbackStats"]
class FeedbackStats(BaseModel):
avg: Optional[float] = None
"""
`avg` is the arithmetic mean of numeric feedback scores for this key on the run,
or `null` when no numeric score has been recorded (for example purely
categorical feedback).
"""
comments: Optional[List[str]] = None
"""
`comments` is a sample of human-readable comments attached to feedback points
for this key, in no particular order. May be empty; is not exhaustive when many
comments exist.
"""
contains_thread_feedback: Optional[bool] = None
"""
`contains_thread_feedback` is true when at least one feedback point for this key
was submitted at the thread level (rather than at an individual run). Always
false on responses that already describe a single run in isolation.
"""
errors: Optional[int] = None
"""
`errors` is the number of feedback points recorded as errors rather than
successful scores (for example an automated evaluator that raised an exception).
Defaults to 0 when no errors occurred.
"""
max: Optional[float] = None
"""
`max` is the largest numeric feedback score recorded for this key on the run, or
`null` when no numeric score has been recorded.
"""
min: Optional[float] = None
"""
`min` is the smallest numeric feedback score recorded for this key on the run,
or `null` when no numeric score has been recorded.
"""
n: Optional[int] = None
"""`n` is the number of feedback points recorded for this key on the run.
For numeric feedback this is the sample size behind `avg`, `min`, `max`, and
`stdev`; for categorical feedback it is the sum of the `values` counts.
"""
sources: Optional[List[object]] = None
"""`sources` is a sample of feedback sources for this key.
Each entry is either a plain string identifier (for example `"api"`, `"app"`,
`"model"`) or a JSON object describing a synthetic source (for example
`{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
tolerate both shapes.
"""
stdev: Optional[float] = None
"""
`stdev` is the sample standard deviation of numeric feedback scores for this key
on the run, or `null` when it cannot be computed (for example fewer than two
numeric scores, or purely categorical feedback).
"""
values: Optional[Dict[str, int]] = None
"""
`values` is the distribution of categorical feedback labels for this key,
mapping each label to its occurrence count. Empty (`{}`) for purely numeric
feedback.
"""
class Thread(BaseModel):
count: Optional[int] = None
"""
`count` is how many root traces (conversation turns) fall in this thread for the
query time range.
"""
feedback_stats: Optional[Dict[str, FeedbackStats]] = None
"""
`feedback_stats` is the aggregated feedback across traces in the thread, keyed
by feedback key; shape matches `feedback_stats` on a single run.
"""
first_inputs: Optional[str] = None
"""
`first_inputs` is a truncated preview of inputs from the earliest trace in the
thread for the query window.
"""
first_trace_id: Optional[str] = None
"""
`first_trace_id` is the root trace UUID for the chronologically first trace in
the query time window.
"""
last_error: Optional[str] = None
"""
`last_error` is a short error summary from the most recent failing trace in the
thread. Absent when there is no error in the window.
"""
last_outputs: Optional[str] = None
"""
`last_outputs` is a truncated preview of outputs from the latest trace in the
thread for the query window.
"""
last_trace_id: Optional[str] = None
"""
`last_trace_id` is the root trace UUID for the chronologically last trace in the
query time window.
"""
latency_p50: Optional[float] = None
"""
`latency_p50` is the approximate median end-to-end latency of traces in the
thread, in seconds.
"""
latency_p99: Optional[float] = None
"""
`latency_p99` is the approximate 99th percentile end-to-end latency of traces in
the thread, in seconds.
"""
max_start_time: Optional[datetime] = None
"""
`max_start_time` is the latest trace start time in the thread (RFC3339
date-time).
"""
min_start_time: Optional[datetime] = None
"""
`min_start_time` is the earliest trace start time in the thread (RFC3339
date-time).
"""
num_errored_turns: Optional[int] = None
"""
`num_errored_turns` is the count of root traces in the thread (within the query
window) whose status was an error.
"""
query_metadata: Optional[object] = None
"""
`query_metadata` describes why this thread matched the query, including
`sem_filter_score` when a semantic filter is used. Returned automatically, or
null when unavailable.
"""
start_time: Optional[datetime] = None
"""
`start_time` is a reference start time for this row (RFC3339 date-time), such as
for sorting.
"""
thread_id: Optional[str] = None
"""
`thread_id` identifies this conversation thread within the project from the
request body `project_id`.
"""
total_cost: Optional[float] = None
"""`total_cost` is the sum of estimated USD cost across those traces."""
total_cost_details: Optional[Dict[str, float]] = None
"""
`total_cost_details` sums per-category estimated USD cost across traces in the
thread. Keys mirror `total_token_details`.
Example: `{"cache_read": 0.012, "reasoning": 0.008}`.
"""
total_token_details: Optional[Dict[str, int]] = None
"""`total_token_details` sums per-category token counts across traces in the
thread.
Keys are model-specific category names (for example `cache_read`, `cache_write`,
`reasoning`, `audio`).
Example: `{"cache_read": 400, "reasoning": 120}`.
"""
total_tokens: Optional[int] = None
"""`total_tokens` is the sum of token usage across those traces."""
trace_id: Optional[str] = None
"""
`trace_id` is a representative root trace UUID when the summary includes one,
for example for deep links.
"""