File tree 2 files changed +37
-1
lines changed
src/openai/types/beta/threads
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 17
17
"ToolAssistantToolsCode" ,
18
18
"ToolAssistantToolsRetrieval" ,
19
19
"ToolAssistantToolsFunction" ,
20
+ "Usage" ,
20
21
]
21
22
22
23
@@ -61,6 +62,17 @@ class ToolAssistantToolsFunction(BaseModel):
61
62
Tool = Union [ToolAssistantToolsCode , ToolAssistantToolsRetrieval , ToolAssistantToolsFunction ]
62
63
63
64
65
+ class Usage (BaseModel ):
66
+ completion_tokens : int
67
+ """Number of completion tokens used over the course of the run."""
68
+
69
+ prompt_tokens : int
70
+ """Number of prompt tokens used over the course of the run."""
71
+
72
+ total_tokens : int
73
+ """Total number of tokens used (prompt + completion)."""
74
+
75
+
64
76
class Run (BaseModel ):
65
77
id : str
66
78
"""The identifier, which can be referenced in API endpoints."""
@@ -152,3 +164,10 @@ class Run(BaseModel):
152
164
[assistant](https://platform.openai.com/docs/api-reference/assistants) used for
153
165
this run.
154
166
"""
167
+
168
+ usage : Optional [Usage ] = None
169
+ """Usage statistics related to the run.
170
+
171
+ This value will be `null` if the run is not in a terminal state (i.e.
172
+ `in_progress`, `queued`, etc.).
173
+ """
Original file line number Diff line number Diff line change 8
8
from .tool_calls_step_details import ToolCallsStepDetails
9
9
from .message_creation_step_details import MessageCreationStepDetails
10
10
11
- __all__ = ["RunStep" , "LastError" , "StepDetails" ]
11
+ __all__ = ["RunStep" , "LastError" , "StepDetails" , "Usage" ]
12
12
13
13
14
14
class LastError (BaseModel ):
@@ -22,6 +22,17 @@ class LastError(BaseModel):
22
22
StepDetails = Union [MessageCreationStepDetails , ToolCallsStepDetails ]
23
23
24
24
25
+ class Usage (BaseModel ):
26
+ completion_tokens : int
27
+ """Number of completion tokens used over the course of the run step."""
28
+
29
+ prompt_tokens : int
30
+ """Number of prompt tokens used over the course of the run step."""
31
+
32
+ total_tokens : int
33
+ """Total number of tokens used (prompt + completion)."""
34
+
35
+
25
36
class RunStep (BaseModel ):
26
37
id : str
27
38
"""The identifier of the run step, which can be referenced in API endpoints."""
@@ -91,3 +102,9 @@ class RunStep(BaseModel):
91
102
92
103
type : Literal ["message_creation" , "tool_calls" ]
93
104
"""The type of run step, which can be either `message_creation` or `tool_calls`."""
105
+
106
+ usage : Optional [Usage ] = None
107
+ """Usage statistics related to the run step.
108
+
109
+ This value will be `null` while the run step's status is `in_progress`.
110
+ """
You can’t perform that action at this time.
0 commit comments