|
1 | 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2 | 2 |
|
3 |
| -from typing import List, Optional |
4 |
| -from typing_extensions import Literal |
| 3 | +from typing import List, Union, Optional |
| 4 | +from typing_extensions import Literal, TypeAlias |
5 | 5 |
|
6 | 6 | from ...._models import BaseModel
|
7 | 7 |
|
8 |
| -__all__ = ["ConversationItemInputAudioTranscriptionCompletedEvent", "Logprob"] |
| 8 | +__all__ = [ |
| 9 | + "ConversationItemInputAudioTranscriptionCompletedEvent", |
| 10 | + "Usage", |
| 11 | + "UsageTranscriptTextUsageTokens", |
| 12 | + "UsageTranscriptTextUsageTokensInputTokenDetails", |
| 13 | + "UsageTranscriptTextUsageDuration", |
| 14 | + "Logprob", |
| 15 | +] |
| 16 | + |
| 17 | + |
| 18 | +class UsageTranscriptTextUsageTokensInputTokenDetails(BaseModel): |
| 19 | + audio_tokens: Optional[int] = None |
| 20 | + """Number of audio tokens billed for this request.""" |
| 21 | + |
| 22 | + text_tokens: Optional[int] = None |
| 23 | + """Number of text tokens billed for this request.""" |
| 24 | + |
| 25 | + |
| 26 | +class UsageTranscriptTextUsageTokens(BaseModel): |
| 27 | + input_tokens: int |
| 28 | + """Number of input tokens billed for this request.""" |
| 29 | + |
| 30 | + output_tokens: int |
| 31 | + """Number of output tokens generated.""" |
| 32 | + |
| 33 | + total_tokens: int |
| 34 | + """Total number of tokens used (input + output).""" |
| 35 | + |
| 36 | + type: Literal["tokens"] |
| 37 | + """The type of the usage object. Always `tokens` for this variant.""" |
| 38 | + |
| 39 | + input_token_details: Optional[UsageTranscriptTextUsageTokensInputTokenDetails] = None |
| 40 | + """Details about the input tokens billed for this request.""" |
| 41 | + |
| 42 | + |
| 43 | +class UsageTranscriptTextUsageDuration(BaseModel): |
| 44 | + seconds: float |
| 45 | + """Duration of the input audio in seconds.""" |
| 46 | + |
| 47 | + type: Literal["duration"] |
| 48 | + """The type of the usage object. Always `duration` for this variant.""" |
| 49 | + |
| 50 | + |
| 51 | +Usage: TypeAlias = Union[UsageTranscriptTextUsageTokens, UsageTranscriptTextUsageDuration] |
9 | 52 |
|
10 | 53 |
|
11 | 54 | class Logprob(BaseModel):
|
@@ -37,5 +80,8 @@ class ConversationItemInputAudioTranscriptionCompletedEvent(BaseModel):
|
37 | 80 | The event type, must be `conversation.item.input_audio_transcription.completed`.
|
38 | 81 | """
|
39 | 82 |
|
| 83 | + usage: Usage |
| 84 | + """Usage statistics for the transcription.""" |
| 85 | + |
40 | 86 | logprobs: Optional[List[Logprob]] = None
|
41 | 87 | """The log probabilities of the transcription."""
|
0 commit comments