Repository navigation
Expand file tree
/
Copy pathvocab.go
More file actions
282 lines (244 loc) · 10.4 KB
/
Copy pathvocab.go
File metadata and controls
282 lines (244 loc) · 10.4 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
package lm15
// Closed string vocabularies (lm15-contract/spec/vocabularies.md).
//
// Every value listed here exists; a value not listed does not. Constructors
// and Validate reject unknown values; adapters map unknown provider tokens to
// the closest canonical value and never invent a new one.
// Role of a Message.
const (
RoleUser = "user"
RoleAssistant = "assistant"
RoleTool = "tool"
RoleDeveloper = "developer"
)
// Roles is the Role vocabulary in declaration order.
var Roles = []string{RoleUser, RoleAssistant, RoleTool, RoleDeveloper}
// Part type discriminators.
const (
PartTypeText = "text"
PartTypeImage = "image"
PartTypeAudio = "audio"
PartTypeVideo = "video"
PartTypeDocument = "document"
PartTypeBinary = "binary"
PartTypeToolCall = "tool_call"
PartTypeToolResult = "tool_result"
PartTypeThinking = "thinking"
PartTypeRefusal = "refusal"
PartTypeCitation = "citation"
PartTypeData = "data"
)
// PartTypes is the PartType vocabulary in declaration order.
var PartTypes = []string{
PartTypeText, PartTypeImage, PartTypeAudio, PartTypeVideo, PartTypeDocument, PartTypeBinary,
PartTypeToolCall, PartTypeToolResult, PartTypeThinking, PartTypeRefusal, PartTypeCitation, PartTypeData,
}
// StreamablePartTypes / NonStreamablePartTypes partition PartTypes (INV-035).
var (
StreamablePartTypes = []string{PartTypeText, PartTypeThinking, PartTypeImage, PartTypeAudio, PartTypeToolCall, PartTypeCitation}
NonStreamablePartTypes = []string{PartTypeVideo, PartTypeDocument, PartTypeBinary, PartTypeToolResult, PartTypeRefusal, PartTypeData}
)
// Delta type discriminators.
const (
DeltaTypeText = "text"
DeltaTypeThinking = "thinking"
DeltaTypeAudio = "audio"
DeltaTypeImage = "image"
DeltaTypeToolCall = "tool_call"
DeltaTypeCitation = "citation"
DeltaTypeContinuation = "continuation"
)
// DeltaTypes is the DeltaType vocabulary in declaration order.
var DeltaTypes = []string{DeltaTypeText, DeltaTypeThinking, DeltaTypeAudio, DeltaTypeImage, DeltaTypeToolCall, DeltaTypeCitation, DeltaTypeContinuation}
// FinishReason values.
const (
FinishStop = "stop"
FinishLength = "length"
FinishToolCall = "tool_call"
FinishContentFilter = "content_filter"
FinishError = "error"
)
// FinishReasons is the FinishReason vocabulary.
var FinishReasons = []string{FinishStop, FinishLength, FinishToolCall, FinishContentFilter, FinishError}
// ReasoningEffort values (MAP-7).
const (
EffortOff = "off"
EffortMinimal = "minimal"
EffortLow = "low"
EffortMedium = "medium"
EffortHigh = "high"
EffortXHigh = "xhigh"
EffortMax = "max"
)
// ReasoningEfforts is the ReasoningEffort vocabulary.
var ReasoningEfforts = []string{EffortOff, EffortMinimal, EffortLow, EffortMedium, EffortHigh, EffortXHigh, EffortMax}
// ReasoningSummaries is the ReasoningSummary vocabulary.
var ReasoningSummaries = []string{"auto", "concise", "detailed"}
// ErrorCode values (bidirectional with the error class hierarchy).
const (
CodeAuth = "auth"
CodeBilling = "billing"
CodeRateLimit = "rate_limit"
CodeInvalidRequest = "invalid_request"
CodeContextLength = "context_length"
CodeTimeout = "timeout"
CodeServer = "server"
CodeUnsupportedModel = "unsupported_model"
CodeUnsupportedFeature = "unsupported_feature"
CodeNotConfigured = "not_configured"
CodeUnknownModel = "unknown_model"
CodeAmbiguousModel = "ambiguous_model"
CodeTransport = "transport"
CodeLockTimeout = "lock_timeout"
CodeStreamAssembly = "stream_assembly"
CodeCollectionLimit = "collection_limit"
CodeProvider = "provider"
CodeAuthOperation = "auth_operation"
)
// ErrorCodes is the ErrorCode vocabulary in declaration order.
var ErrorCodes = []string{
CodeAuth, CodeBilling, CodeRateLimit, CodeInvalidRequest, CodeContextLength, CodeTimeout, CodeServer,
CodeUnsupportedModel, CodeUnsupportedFeature, CodeNotConfigured, CodeUnknownModel, CodeAmbiguousModel,
CodeTransport, CodeLockTimeout, CodeStreamAssembly, CodeCollectionLimit, CodeProvider, CodeAuthOperation,
}
// StreamEventTypes is the StreamEventType vocabulary.
var StreamEventTypes = []string{"start", "delta", "end", "erro
D73B
r"}
// Batch statuses.
const (
BatchQueued = "queued"
BatchRunning = "running"
BatchCancelling = "cancelling"
BatchCompleted = "completed"
BatchFailed = "failed"
BatchCancelled = "cancelled"
BatchExpired = "expired"
)
// BatchStatuses is the BatchStatus vocabulary; BatchTerminalStatuses its terminal subset.
var (
BatchStatuses = []string{BatchQueued, BatchRunning, BatchCancelling, BatchCompleted, BatchFailed, BatchCancelled, BatchExpired}
BatchTerminalStatuses = []string{BatchCompleted, BatchFailed, BatchCancelled, BatchExpired}
)
// BatchOutcomes is the BatchOutcome vocabulary.
var BatchOutcomes = []string{"succeeded", "errored", "cancelled", "expired"}
// VideoStatuses is the VideoStatus vocabulary; VideoTerminalStatuses its terminal subset.
var (
VideoStatuses = []string{"queued", "running", "completed", "failed", "cancelled"}
VideoTerminalStatuses = []string{"completed", "failed", "cancelled"}
)
// FileReadinessValues is the FileReadiness vocabulary.
var FileReadinessValues = []string{"pending", "ready", "failed"}
// AudioEncodings is the AudioEncoding vocabulary.
var AudioEncodings = []string{"pcm16", "opus", "mp3", "aac"}
// ToolChoiceModes is the ToolChoiceMode vocabulary.
var ToolChoiceModes = []string{"auto", "required", "none"}
// Cache vocabularies (MAP-6).
var (
CacheModes = []string{"auto", "off"}
CacheRetentions = []string{"short", "long"}
CachePrefixes = []string{"stable", "history"}
)
// AdaptationAction values (MAP-13, 2026-09-14): what the wire got that
// differs from what was asked.
const (
AdaptDropped = "dropped"
AdaptClamped = "clamped"
AdaptSubstituted = "substituted"
AdaptClientSide = "client_side"
AdaptSatisfied = "satisfied"
AdaptDefaulted = "defaulted"
)
// AdaptationActions is the AdaptationAction vocabulary.
var AdaptationActions = []string{AdaptDropped, AdaptClamped, AdaptSubstituted, AdaptClientSide, AdaptSatisfied, AdaptDefaulted}
// AdaptationPolicy values: the value of WithAdaptations / RouterConfig.Adaptations.
const (
AdaptationsNote = "note"
AdaptationsSilent = "silent"
AdaptationsRefuse = "refuse"
)
// AdaptationPolicies is the AdaptationPolicy vocabulary.
var AdaptationPolicies = []string{AdaptationsNote, AdaptationsSilent, AdaptationsRefuse}
// ProbabilityPolicy values (Config.Probabilities; MAP-14, 2026-09-17).
const (
ProbabilitiesOff = "off"
ProbabilitiesIfAvailable = "if_available"
ProbabilitiesRequired = "required"
)
// ProbabilityPolicies is the ProbabilityPolicy vocabulary.
var ProbabilityPolicies = []string{ProbabilitiesOff, ProbabilitiesIfAvailable, ProbabilitiesRequired}
// JudgmentMethod values: how a DataPart's distribution was measured.
const (
MethodProviderClassification = "provider_classification"
MethodCandidateSequenceLikelihood = "candidate_sequence_likelihood"
)
// JudgmentMethods is the JudgmentMethod vocabulary.
var JudgmentMethods = []string{MethodProviderClassification, MethodCandidateSequenceLikelihood}
// NamedCredential values (AUTH-1, 2026-09-19): one identity on a cloud
// door instead of its chain; the same four words on every cloud.
const (
CredentialPlatform = "platform"
CredentialWorkload = "workload"
CredentialEnvironment = "environment"
CredentialCLI = "cli"
)
// NamedCredentials is the NamedCredential vocabulary.
var NamedCredentials = []string{CredentialPlatform, CredentialWorkload, CredentialEnvironment, CredentialCLI}
// Live event vocabularies.
var (
LiveClientEventTypes = []string{"turn", "audio", "image", "text", "tool_result", "interrupt", "end_audio"}
LiveServerEventTypes = []string{"audio", "text", "tool_call", "tool_call_delta", "interrupted", "turn_end", "usage", "error"}
)
// Auth vocabularies (spec/auth.md, spec/vocabularies.md, 2026-09-03).
var (
AuthSchemes = []string{"bearer", "x-api-key", "api-key", "query-key", "sigv4"}
CredentialKinds = []string{"api_key", "bearer_token", "aws"}
CredentialPolicies = []string{"key", "oauth", "oauth-unless-explicit", "aws-chain", "azure-chain", "gcp-chain"}
RungKinds = []string{"env", "ini-profile", "json-file", "subprocess", "http-metadata", "http-token-exchange", "sigv4-sts", "unsigned-sts", "jwt-rs256", "file-cache"}
AuthStepStates = []string{"selected", "shadowed", "absent", "unprobed"}
StreamFramings = []string{"sse", "aws-event-stream"}
ModelPlacements = []string{"body", "path"}
)
// Vocabularies maps every vocabulary name to its values (the runtime mirror
// surface_dump reflects). Names follow spec/vocabularies.md.
var Vocabularies = map[string][]string{
"Role": Roles,
"PartType": PartTypes,
"DeltaType": DeltaTypes,
"FinishReason": FinishReasons,
"ReasoningEffort": ReasoningEfforts,
"ReasoningSummary": ReasoningSummaries,
"ErrorCode": ErrorCodes,
"StreamEventType": StreamEventTypes,
"BatchStatus": BatchStatuses,
"BATCH_TERMINAL_STATUSES": BatchTerminalStatuses,
"BatchOutcome": BatchOutcomes,
"VideoStatus": VideoStatuses,
"VIDEO_TERMINAL_STATUSES": VideoTerminalStatuses,
"FileReadiness": FileReadinessValues,
"AudioEncoding": AudioEncodings,
"ToolChoiceMode": ToolChoiceModes,
"CacheMode": CacheModes,
"CacheRetention": CacheRetentions,
"CachePrefix": CachePrefixes,
"LiveClientEventType": LiveClientEventTypes,
"LiveServerEventType": LiveServerEventTypes,
"AuthScheme": AuthSchemes,
"CredentialKind": CredentialKinds,
"CredentialPolicy": CredentialPolicies,
"RungKind": RungKinds,
"AuthStepState": AuthStepStates,
"StreamFraming": StreamFramings,
"ModelPlacement": ModelPlacements,
"AdaptationAction": AdaptationActions,
"AdaptationPolicy": AdaptationPolicies,
"ProbabilityPolicy": ProbabilityPolicies,
"JudgmentMethod": JudgmentMethods,
"NamedCredential": NamedCredentials,
}
func inVocab(value string, vocab []string) bool {
for _, v := range vocab {
if v == value {
return true
}
}
return false
}