Repository navigation
Expand file tree
/
Copy pathdecision.py
More file actions
141 lines (90 loc) · 3.08 KB
/
Copy pathdecision.py
File metadata and controls
141 lines (90 loc) · 3.08 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
# File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
from typing import List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias
from pydantic import StrictStr, StrictBool
from .._utils import PropertyInfo
from .._models import BaseModel
__all__ = [
"Decision",
"Answer",
"AnswerAnswerResourcePredicate",
"AnswerAnswerResourceChoice",
"AnswerAnswerResourceChoiceProbability",
"AnswerAnswerResourceScore",
"AnswerAnswerResourceScoreProbability",
"AnswerAnswerResourceRefusal",
"Usage",
"UsageInputTokensDetails",
"UsageOutputTokensDetails",
]
class AnswerAnswerResourcePredicate(BaseModel):
name: Optional[str] = None
probability: float
type: Literal["predicate"]
"""The type of the object. Always `predicate`."""
class AnswerAnswerResourceChoiceProbability(BaseModel):
probability: float
value: Union[StrictStr, StrictBool]
"""
Choice values are typed: a string and a boolean with the same text are distinct.
"""
class AnswerAnswerResourceChoice(BaseModel):
choice: Union[StrictStr, StrictBool]
"""
Choice values are typed: a string and a boolean with the same text are distinct.
"""
confidence: float
name: Optional[str] = None
probabilities: List[AnswerAnswerResourceChoiceProbability]
type: Literal["choice"]
"""The type of the object. Always `choice`."""
class AnswerAnswerResourceScoreProbability(BaseModel):
label: str
probability: float
value: int
class AnswerAnswerResourceScore(BaseModel):
confidence: float
name: Optional[str] = None
probabilities: List[AnswerAnswerResourceScoreProbability]
score: float
type: Literal["score"]
"""The type of the object. Always `score`."""
class AnswerAnswerResourceRefusal(BaseModel):
"""The model declined to answer this question.
Other questions in the same request can still receive answers.
"""
name: Optional[str] = None
type: Literal["refusal"]
"""The type of the object. Always `refusal`."""
Answer: TypeAlias = Annotated[
Union[
AnswerAnswerResourcePredicate,
AnswerAnswerResourceChoice,
AnswerAnswerResourceScore,
AnswerAnswerResourceRefusal,
],
PropertyInfo(discriminator="type"),
]
class UsageInputTokensDetails(BaseModel):
cache_write_tokens: int
cached_tokens: int
class UsageOutputTokensDetails(BaseModel):
reasoning_tokens: int
class Usage(BaseModel):
"""Token usage for the request."""
input_tokens: int
input_tokens_details: UsageInputTokensDetails
output_tokens: int
output_tokens_details: UsageOutputTokensDetails
total_tokens: int
class Decision(BaseModel):
answers: List[Answer]
"""Answers in question order.
Any question can return a refusal instead of an answer; other questions can
still receive answers. A refusal has `type: "refusal"` and the question's
`name`, or `null` if it was unnamed.
"""
model: str
"""The model used."""
usage: Usage
"""Token usage for the request."""