File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
src/openai/types/beta/threads Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1717 "ToolAssistantToolsCode" ,
1818 "ToolAssistantToolsRetrieval" ,
1919 "ToolAssistantToolsFunction" ,
20+ "Usage" ,
2021]
2122
2223
@@ -61,6 +62,17 @@ class ToolAssistantToolsFunction(BaseModel):
6162Tool = Union [ToolAssistantToolsCode , ToolAssistantToolsRetrieval , ToolAssistantToolsFunction ]
6263
6364
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+
6476class Run (BaseModel ):
6577 id : str
6678 """The identifier, which can be referenced in API endpoints."""
@@ -152,3 +164,10 @@ class Run(BaseModel):
152164 [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
153165 this run.
154166 """
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 88from .tool_calls_step_details import ToolCallsStepDetails
99from .message_creation_step_details import MessageCreationStepDetails
1010
11- __all__ = ["RunStep" , "LastError" , "StepDetails" ]
11+ __all__ = ["RunStep" , "LastError" , "StepDetails" , "Usage" ]
1212
1313
1414class LastError (BaseModel ):
@@ -22,6 +22,17 @@ class LastError(BaseModel):
2222StepDetails = Union [MessageCreationStepDetails , ToolCallsStepDetails ]
2323
2424
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+
2536class RunStep (BaseModel ):
2637 id : str
2738 """The identifier of the run step, which can be referenced in API endpoints."""
@@ -91,3 +102,9 @@ class RunStep(BaseModel):
91102
92103 type : Literal ["message_creation" , "tool_calls" ]
93104 """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