@ancplua/qyl-api-schema 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +89 -0
- package/VERSIONING.md +74 -0
- package/api/routes.tsp +1052 -0
- package/api/streaming.tsp +335 -0
- package/common/errors.tsp +206 -0
- package/common/pagination.tsp +254 -0
- package/common/types.tsp +345 -0
- package/generated/README.md +26 -0
- package/generated/otel-keys.gen.tsp +1648 -0
- package/index.tsp +55 -0
- package/intelligence/causal-rules.tsp +34 -0
- package/intelligence/diagnostic-patterns.tsp +54 -0
- package/intelligence/investigation-strategies.tsp +37 -0
- package/intelligence/main.tsp +19 -0
- package/intelligence/seed/patterns.tsp +172 -0
- package/intelligence/seed/rules.tsp +44 -0
- package/intelligence/seed/strategies.tsp +56 -0
- package/intelligence/signals.tsp +60 -0
- package/models/agent/agent-run.tsp +154 -0
- package/models/agent/tool-call.tsp +122 -0
- package/models/agent/workflow-checkpoint.tsp +50 -0
- package/models/agent/workflow-execution.tsp +136 -0
- package/models/alerting.tsp +436 -0
- package/models/configurator.tsp +433 -0
- package/models/control-graph.tsp +197 -0
- package/models/db.tsp +810 -0
- package/models/deployment.tsp +365 -0
- package/models/error.tsp +433 -0
- package/models/genai.tsp +1368 -0
- package/models/http.tsp +600 -0
- package/models/identity.tsp +213 -0
- package/models/issues.tsp +484 -0
- package/models/log.tsp +140 -0
- package/models/messaging.tsp +304 -0
- package/models/otel-config.tsp +455 -0
- package/models/retention.tsp +240 -0
- package/models/rpc.tsp +309 -0
- package/models/search.tsp +243 -0
- package/models/session.tsp +274 -0
- package/models/system.tsp +400 -0
- package/models/test.tsp +346 -0
- package/models/triage.tsp +113 -0
- package/models/workflow.tsp +396 -0
- package/models/workspace.tsp +435 -0
- package/otel/enums.tsp +392 -0
- package/otel/logs.tsp +135 -0
- package/otel/metrics.tsp +358 -0
- package/otel/otel-conventions.tsp +14 -0
- package/otel/profiles.tsp +335 -0
- package/otel/resource.tsp +257 -0
- package/otel/span.tsp +307 -0
- package/package.json +88 -0
- package/tspconfig.yaml +49 -0
package/models/genai.tsp
ADDED
|
@@ -0,0 +1,1368 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// ANcpLua v2.0 - GenAI Semantic Conventions (OTel v1.40)
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Comprehensive AI/LLM telemetry following OpenTelemetry GenAI specifications.
|
|
5
|
+
// https://opentelemetry.io/docs/specs/semconv/gen-ai/
|
|
6
|
+
// =============================================================================
|
|
7
|
+
|
|
8
|
+
import "@typespec/versioning";
|
|
9
|
+
import "../common/types.tsp";
|
|
10
|
+
import "../otel/span.tsp";
|
|
11
|
+
import "../otel/metrics.tsp";
|
|
12
|
+
|
|
13
|
+
using TypeSpec.Versioning;
|
|
14
|
+
using Qyl.Api.Contracts.Common;
|
|
15
|
+
using Qyl.Api.Contracts.OTel.Traces;
|
|
16
|
+
using Qyl.Api.Contracts.OTel.Metrics;
|
|
17
|
+
|
|
18
|
+
@versioned(GenAiVersions)
|
|
19
|
+
namespace Qyl.Api.Contracts.Domains.AI.GenAi;
|
|
20
|
+
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// Version History
|
|
23
|
+
// =============================================================================
|
|
24
|
+
|
|
25
|
+
@doc("GenAI semantic convention versions")
|
|
26
|
+
enum GenAiVersions {
|
|
27
|
+
@doc("Initial GenAI semconv (OTel 1.27)")
|
|
28
|
+
v1_27: "1.27.0",
|
|
29
|
+
|
|
30
|
+
@doc("Added agent support (OTel 1.28)")
|
|
31
|
+
v1_28: "1.28.0",
|
|
32
|
+
|
|
33
|
+
@doc("Token type refinements (OTel 1.29)")
|
|
34
|
+
v1_29: "1.29.0",
|
|
35
|
+
|
|
36
|
+
@doc("Deprecated gen_ai.system (OTel 1.37)")
|
|
37
|
+
v1_37: "1.37.0",
|
|
38
|
+
|
|
39
|
+
@doc("GenAI.Agent support (OTel 1.38)")
|
|
40
|
+
v1_38: "1.38.0",
|
|
41
|
+
|
|
42
|
+
@doc("RPC metadata consolidation (OTel 1.39)")
|
|
43
|
+
v1_39: "1.39.0",
|
|
44
|
+
|
|
45
|
+
@doc("Current version (OTel 1.40)")
|
|
46
|
+
v1_40: "1.40.0",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// GenAI Span Attributes (Complete OTel v1.40)
|
|
51
|
+
// =============================================================================
|
|
52
|
+
|
|
53
|
+
@doc("GenAI span attributes following OTel Semantic Conventions v1.40")
|
|
54
|
+
model GenAiSpanAttributes {
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// Provider & System (REQUIRED)
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
@doc("The name of the GenAI provider (e.g., 'openai', 'anthropic', 'google', 'azure')")
|
|
60
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ProviderName)
|
|
61
|
+
providerName: GenAiProvider;
|
|
62
|
+
|
|
63
|
+
@doc("The name of the GenAI system/product (e.g., 'ChatGPT', 'Claude', 'Gemini')")
|
|
64
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.System)
|
|
65
|
+
@removed(GenAiVersions.v1_37)
|
|
66
|
+
system?: string;
|
|
67
|
+
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Operation Details
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
@doc("The type of GenAI operation being performed")
|
|
73
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OperationName)
|
|
74
|
+
operationName: GenAiOperationType;
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Request Attributes (Model & Parameters)
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
@doc("The model ID requested by the client (e.g., 'gpt-4o', 'claude-3-opus-20240229')")
|
|
81
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestModel)
|
|
82
|
+
requestModel: string;
|
|
83
|
+
|
|
84
|
+
@doc("The temperature parameter for randomness control")
|
|
85
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestTemperature)
|
|
86
|
+
@minValue(0.0)
|
|
87
|
+
@maxValue(2.0)
|
|
88
|
+
requestTemperature?: float64;
|
|
89
|
+
|
|
90
|
+
@doc("The top_p (nucleus sampling) parameter")
|
|
91
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestTopP)
|
|
92
|
+
@minValue(0.0)
|
|
93
|
+
@maxValue(1.0)
|
|
94
|
+
requestTopP?: float64;
|
|
95
|
+
|
|
96
|
+
@doc("Number of highest probability tokens to consider for sampling")
|
|
97
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestTopK)
|
|
98
|
+
requestTopK?: float64;
|
|
99
|
+
|
|
100
|
+
@doc("Maximum tokens to generate in the response")
|
|
101
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestMaxTokens)
|
|
102
|
+
@minValue(1)
|
|
103
|
+
requestMaxTokens?: int64;
|
|
104
|
+
|
|
105
|
+
@doc("Stop sequences that will halt generation")
|
|
106
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestStopSequences)
|
|
107
|
+
requestStopSequences?: string[];
|
|
108
|
+
|
|
109
|
+
@doc("Frequency penalty to reduce repetition (-2.0 to 2.0)")
|
|
110
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestFrequencyPenalty)
|
|
111
|
+
@minValue(-2.0)
|
|
112
|
+
@maxValue(2.0)
|
|
113
|
+
requestFrequencyPenalty?: float64;
|
|
114
|
+
|
|
115
|
+
@doc("Presence penalty for new topics (-2.0 to 2.0)")
|
|
116
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestPresencePenalty)
|
|
117
|
+
@minValue(-2.0)
|
|
118
|
+
@maxValue(2.0)
|
|
119
|
+
requestPresencePenalty?: float64;
|
|
120
|
+
|
|
121
|
+
@doc("Seed for deterministic sampling")
|
|
122
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestSeed)
|
|
123
|
+
requestSeed?: int64;
|
|
124
|
+
|
|
125
|
+
@doc("Encoding format for embeddings")
|
|
126
|
+
@encodedName("application/json", "gen_ai.request.encoding_format")
|
|
127
|
+
requestEncodingFormat?: EmbeddingEncodingFormat;
|
|
128
|
+
|
|
129
|
+
@doc("Number of dimensions for embeddings")
|
|
130
|
+
@encodedName("application/json", "gen_ai.request.embedding_dimensions")
|
|
131
|
+
@minValue(1)
|
|
132
|
+
requestEmbeddingDimensions?: int32;
|
|
133
|
+
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
// Response Attributes
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
@doc("The actual model used (may differ from request)")
|
|
139
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ResponseModel)
|
|
140
|
+
responseModel?: string;
|
|
141
|
+
|
|
142
|
+
@doc("Response ID from the provider")
|
|
143
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ResponseId)
|
|
144
|
+
responseId?: string;
|
|
145
|
+
|
|
146
|
+
@doc("Reasons why generation stopped")
|
|
147
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ResponseFinishReasons)
|
|
148
|
+
responseFinishReasons?: GenAiFinishReason[];
|
|
149
|
+
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// Token Usage (RECOMMENDED)
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
|
|
154
|
+
@doc("Number of input/prompt tokens consumed")
|
|
155
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageInputTokens)
|
|
156
|
+
usageInputTokens?: TokenCount;
|
|
157
|
+
|
|
158
|
+
@doc("Number of output/completion tokens generated")
|
|
159
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageOutputTokens)
|
|
160
|
+
usageOutputTokens?: TokenCount;
|
|
161
|
+
|
|
162
|
+
@doc("Total tokens (deprecated - use input + output)")
|
|
163
|
+
@encodedName("application/json", "gen_ai.usage.total_tokens")
|
|
164
|
+
@removed(GenAiVersions.v1_38)
|
|
165
|
+
usageTotalTokens?: TokenCount;
|
|
166
|
+
|
|
167
|
+
@doc("Number of cached input tokens (prompt caching)")
|
|
168
|
+
@encodedName("application/json", "gen_ai.usage.input_tokens.cached")
|
|
169
|
+
@added(GenAiVersions.v1_38)
|
|
170
|
+
usageInputTokensCached?: TokenCount;
|
|
171
|
+
|
|
172
|
+
@doc("Number of reasoning tokens (for o1-like models)")
|
|
173
|
+
@encodedName("application/json", "gen_ai.usage.output_tokens.reasoning")
|
|
174
|
+
@added(GenAiVersions.v1_38)
|
|
175
|
+
usageOutputTokensReasoning?: TokenCount;
|
|
176
|
+
|
|
177
|
+
@doc("Number of cache read input tokens (prompt caching)")
|
|
178
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageCacheReadInputTokens)
|
|
179
|
+
@added(GenAiVersions.v1_40)
|
|
180
|
+
usageCacheReadInputTokens?: TokenCount;
|
|
181
|
+
|
|
182
|
+
@doc("Number of cache creation input tokens")
|
|
183
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageCacheCreationInputTokens)
|
|
184
|
+
@added(GenAiVersions.v1_40)
|
|
185
|
+
usageCacheCreationInputTokens?: TokenCount;
|
|
186
|
+
|
|
187
|
+
// ---------------------------------------------------------------------------
|
|
188
|
+
// Deprecated Attributes (for migration)
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
|
|
191
|
+
@doc("Prompt tokens (deprecated - use gen_ai.usage.input_tokens)")
|
|
192
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsagePromptTokens)
|
|
193
|
+
@removed(GenAiVersions.v1_28)
|
|
194
|
+
usagePromptTokens?: TokenCount;
|
|
195
|
+
|
|
196
|
+
@doc("Completion tokens (deprecated - use gen_ai.usage.output_tokens)")
|
|
197
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageCompletionTokens)
|
|
198
|
+
@removed(GenAiVersions.v1_28)
|
|
199
|
+
usageCompletionTokens?: TokenCount;
|
|
200
|
+
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// Agent Attributes (v1.38+)
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
@doc("Unique identifier for the AI agent")
|
|
206
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.AgentId)
|
|
207
|
+
@added(GenAiVersions.v1_38)
|
|
208
|
+
agentId?: string;
|
|
209
|
+
|
|
210
|
+
@doc("Human-readable name of the AI agent")
|
|
211
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.AgentName)
|
|
212
|
+
@added(GenAiVersions.v1_38)
|
|
213
|
+
agentName?: string;
|
|
214
|
+
|
|
215
|
+
@doc("Description of the agent's purpose")
|
|
216
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.AgentDescription)
|
|
217
|
+
@added(GenAiVersions.v1_38)
|
|
218
|
+
agentDescription?: string;
|
|
219
|
+
|
|
220
|
+
@doc("Version of the AI agent")
|
|
221
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.AgentVersion)
|
|
222
|
+
@added(GenAiVersions.v1_40)
|
|
223
|
+
agentVersion?: string;
|
|
224
|
+
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// Conversation & Tool Calling
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
|
|
229
|
+
@doc("Conversation identifier for multi-turn interactions")
|
|
230
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ConversationId)
|
|
231
|
+
conversationId?: string;
|
|
232
|
+
|
|
233
|
+
@doc("Names of tools available to the model")
|
|
234
|
+
@encodedName("application/json", "gen_ai.request.tool_names")
|
|
235
|
+
requestToolNames?: string[];
|
|
236
|
+
|
|
237
|
+
@doc("Tool choice mode")
|
|
238
|
+
@encodedName("application/json", "gen_ai.request.tool_choice")
|
|
239
|
+
requestToolChoice?: GenAiToolChoice;
|
|
240
|
+
|
|
241
|
+
@doc("The name of the tool utilized")
|
|
242
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolName)
|
|
243
|
+
toolName?: string;
|
|
244
|
+
|
|
245
|
+
@doc("The tool call identifier")
|
|
246
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolCallId)
|
|
247
|
+
toolCallId?: string;
|
|
248
|
+
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
// Error Information
|
|
251
|
+
// ---------------------------------------------------------------------------
|
|
252
|
+
|
|
253
|
+
@doc("Error type if the request failed")
|
|
254
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Error.Type)
|
|
255
|
+
errorType?: GenAiErrorType;
|
|
256
|
+
|
|
257
|
+
// ---------------------------------------------------------------------------
|
|
258
|
+
// Data Source & Evaluation Attributes (OTel 1.40)
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
|
|
261
|
+
@doc("Identifier for the data source being used")
|
|
262
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.DataSourceId)
|
|
263
|
+
dataSourceId?: string;
|
|
264
|
+
|
|
265
|
+
@doc("Explanation from an evaluation")
|
|
266
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.EvaluationExplanation)
|
|
267
|
+
evaluationExplanation?: string;
|
|
268
|
+
|
|
269
|
+
@doc("Name of the evaluation being performed")
|
|
270
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.EvaluationName)
|
|
271
|
+
evaluationName?: string;
|
|
272
|
+
|
|
273
|
+
@doc("Label for the evaluation score")
|
|
274
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.EvaluationScoreLabel)
|
|
275
|
+
evaluationScoreLabel?: string;
|
|
276
|
+
|
|
277
|
+
@doc("Numeric value of the evaluation score")
|
|
278
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.EvaluationScoreValue)
|
|
279
|
+
evaluationScoreValue?: float64;
|
|
280
|
+
|
|
281
|
+
// ---------------------------------------------------------------------------
|
|
282
|
+
// Input/Output Messages & Prompt Attributes
|
|
283
|
+
// ---------------------------------------------------------------------------
|
|
284
|
+
|
|
285
|
+
@doc("Input messages content (may be redacted)")
|
|
286
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.InputMessages)
|
|
287
|
+
inputMessages?: string;
|
|
288
|
+
|
|
289
|
+
@doc("Output messages content (may be redacted)")
|
|
290
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OutputMessages)
|
|
291
|
+
outputMessages?: string;
|
|
292
|
+
|
|
293
|
+
@doc("Output type (text, json, image, etc.)")
|
|
294
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OutputType)
|
|
295
|
+
outputType?: GenAiOutputType;
|
|
296
|
+
|
|
297
|
+
@doc("Prompt content (may be redacted)")
|
|
298
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.Prompt)
|
|
299
|
+
prompt?: string;
|
|
300
|
+
|
|
301
|
+
@doc("Name of the prompt template being used")
|
|
302
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.PromptName)
|
|
303
|
+
promptName?: string;
|
|
304
|
+
|
|
305
|
+
@doc("System instructions provided to the model")
|
|
306
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.SystemInstructions)
|
|
307
|
+
systemInstructions?: string;
|
|
308
|
+
|
|
309
|
+
@doc("Completion content (may be redacted)")
|
|
310
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.Completion)
|
|
311
|
+
completion?: string;
|
|
312
|
+
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// Extended Request Attributes
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
|
|
317
|
+
@doc("Number of choices/completions requested")
|
|
318
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestChoiceCount)
|
|
319
|
+
@minValue(1)
|
|
320
|
+
requestChoiceCount?: int32;
|
|
321
|
+
|
|
322
|
+
@doc("Encoding formats requested for embeddings")
|
|
323
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestEncodingFormats)
|
|
324
|
+
requestEncodingFormats?: string[];
|
|
325
|
+
|
|
326
|
+
// ---------------------------------------------------------------------------
|
|
327
|
+
// Extended Tool Attributes
|
|
328
|
+
// ---------------------------------------------------------------------------
|
|
329
|
+
|
|
330
|
+
@doc("Arguments passed to the tool call (JSON)")
|
|
331
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolCallArguments)
|
|
332
|
+
toolCallArguments?: string;
|
|
333
|
+
|
|
334
|
+
@doc("Result returned from the tool call")
|
|
335
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolCallResult)
|
|
336
|
+
toolCallResult?: string;
|
|
337
|
+
|
|
338
|
+
@doc("Tool definitions provided to the model (JSON)")
|
|
339
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolDefinitions)
|
|
340
|
+
toolDefinitions?: string;
|
|
341
|
+
|
|
342
|
+
@doc("Description of the tool")
|
|
343
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolDescription)
|
|
344
|
+
toolDescription?: string;
|
|
345
|
+
|
|
346
|
+
@doc("Type of the tool (function, retrieval, etc.)")
|
|
347
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolType)
|
|
348
|
+
toolType?: GenAiToolType;
|
|
349
|
+
|
|
350
|
+
@doc("Token type for usage tracking")
|
|
351
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.TokenType)
|
|
352
|
+
tokenType?: GenAiTokenType;
|
|
353
|
+
|
|
354
|
+
// ---------------------------------------------------------------------------
|
|
355
|
+
// Embeddings Attributes
|
|
356
|
+
// ---------------------------------------------------------------------------
|
|
357
|
+
|
|
358
|
+
@doc("Number of dimensions in the embedding")
|
|
359
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.EmbeddingsDimensionCount)
|
|
360
|
+
@minValue(1)
|
|
361
|
+
embeddingsDimensionCount?: int32;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// =============================================================================
|
|
365
|
+
// GenAI Exported Attribute Models (OTel 1.40 compliant)
|
|
366
|
+
// =============================================================================
|
|
367
|
+
|
|
368
|
+
@doc("GenAI request-specific attributes")
|
|
369
|
+
model GenAiRequestAttributes {
|
|
370
|
+
@doc("The model ID for the request")
|
|
371
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestModel)
|
|
372
|
+
requestModel: string;
|
|
373
|
+
|
|
374
|
+
@doc("Temperature parameter for randomness control")
|
|
375
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestTemperature)
|
|
376
|
+
@minValue(0.0)
|
|
377
|
+
@maxValue(2.0)
|
|
378
|
+
temperature?: float64;
|
|
379
|
+
|
|
380
|
+
@doc("Maximum tokens to generate")
|
|
381
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestMaxTokens)
|
|
382
|
+
@minValue(1)
|
|
383
|
+
maxTokens?: int64;
|
|
384
|
+
|
|
385
|
+
@doc("Top-p (nucleus sampling) parameter")
|
|
386
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestTopP)
|
|
387
|
+
@minValue(0.0)
|
|
388
|
+
@maxValue(1.0)
|
|
389
|
+
topP?: float64;
|
|
390
|
+
|
|
391
|
+
@doc("Number of highest probability tokens to consider for sampling")
|
|
392
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestTopK)
|
|
393
|
+
topK?: float64;
|
|
394
|
+
|
|
395
|
+
@doc("Stop sequences that will halt generation")
|
|
396
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestStopSequences)
|
|
397
|
+
stopSequences?: string[];
|
|
398
|
+
|
|
399
|
+
@doc("Frequency penalty parameter")
|
|
400
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestFrequencyPenalty)
|
|
401
|
+
@minValue(-2.0)
|
|
402
|
+
@maxValue(2.0)
|
|
403
|
+
frequencyPenalty?: float64;
|
|
404
|
+
|
|
405
|
+
@doc("Presence penalty parameter")
|
|
406
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestPresencePenalty)
|
|
407
|
+
@minValue(-2.0)
|
|
408
|
+
@maxValue(2.0)
|
|
409
|
+
presencePenalty?: float64;
|
|
410
|
+
|
|
411
|
+
@doc("Random seed for deterministic generation")
|
|
412
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestSeed)
|
|
413
|
+
seed?: int64;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@doc("GenAI response-specific attributes")
|
|
417
|
+
model GenAiResponseAttributes {
|
|
418
|
+
@doc("The model ID returned by the provider")
|
|
419
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ResponseModel)
|
|
420
|
+
responseModel?: string;
|
|
421
|
+
|
|
422
|
+
@doc("Unique identifier for this completion")
|
|
423
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ResponseId)
|
|
424
|
+
id?: string;
|
|
425
|
+
|
|
426
|
+
@doc("Finish reasons for each choice")
|
|
427
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ResponseFinishReasons)
|
|
428
|
+
finishReasons?: GenAiFinishReason[];
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
@doc("GenAI usage/token attributes")
|
|
432
|
+
model GenAiUsageAttributes {
|
|
433
|
+
@doc("Number of input/prompt tokens")
|
|
434
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageInputTokens)
|
|
435
|
+
inputTokens: TokenCount;
|
|
436
|
+
|
|
437
|
+
@doc("Number of output/completion tokens")
|
|
438
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageOutputTokens)
|
|
439
|
+
outputTokens: TokenCount;
|
|
440
|
+
|
|
441
|
+
@doc("Total tokens (computed: inputTokens + outputTokens)")
|
|
442
|
+
@encodedName("application/json", "gen_ai.usage.total_tokens")
|
|
443
|
+
totalTokens: TokenCount;
|
|
444
|
+
|
|
445
|
+
@doc("Number of cached input tokens (prompt caching)")
|
|
446
|
+
@encodedName("application/json", "gen_ai.usage.input_tokens.cached")
|
|
447
|
+
@added(GenAiVersions.v1_38)
|
|
448
|
+
cachedInputTokens?: TokenCount;
|
|
449
|
+
|
|
450
|
+
@doc("Number of reasoning tokens (for o1-like models)")
|
|
451
|
+
@encodedName("application/json", "gen_ai.usage.output_tokens.reasoning")
|
|
452
|
+
@added(GenAiVersions.v1_38)
|
|
453
|
+
reasoningTokens?: TokenCount;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
@doc("GenAI message in conversation")
|
|
457
|
+
model GenAiMessage {
|
|
458
|
+
@doc("Role of the message sender")
|
|
459
|
+
@encodedName("application/json", "msg_role")
|
|
460
|
+
msgRole: GenAiMessageRole;
|
|
461
|
+
|
|
462
|
+
@doc("Message content (text)")
|
|
463
|
+
@encodedName("application/json", "msg_content")
|
|
464
|
+
msgContent?: string;
|
|
465
|
+
|
|
466
|
+
@doc("Content type")
|
|
467
|
+
@encodedName("application/json", "content_type")
|
|
468
|
+
contentType?: GenAiContentType;
|
|
469
|
+
|
|
470
|
+
@doc("Optional name for the sender")
|
|
471
|
+
@encodedName("application/json", "msg_name")
|
|
472
|
+
msgName?: string;
|
|
473
|
+
|
|
474
|
+
@doc("Tool calls made by assistant")
|
|
475
|
+
@encodedName("application/json", "tool_calls")
|
|
476
|
+
toolCalls?: GenAiToolCallEvent[];
|
|
477
|
+
|
|
478
|
+
@doc("Tool call ID for tool results")
|
|
479
|
+
@encodedName("application/json", "tool_call_id")
|
|
480
|
+
toolCallId?: string;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
@doc("Cost estimation for GenAI operations")
|
|
484
|
+
model GenAiCostEstimate {
|
|
485
|
+
@doc("Estimated cost for input tokens (USD)")
|
|
486
|
+
@encodedName("application/json", "input_cost_usd")
|
|
487
|
+
@minValue(0.0)
|
|
488
|
+
inputCostUsd: float64;
|
|
489
|
+
|
|
490
|
+
@doc("Estimated cost for output tokens (USD)")
|
|
491
|
+
@encodedName("application/json", "output_cost_usd")
|
|
492
|
+
@minValue(0.0)
|
|
493
|
+
outputCostUsd: float64;
|
|
494
|
+
|
|
495
|
+
@doc("Total estimated cost (USD)")
|
|
496
|
+
@encodedName("application/json", "total_cost_usd")
|
|
497
|
+
@minValue(0.0)
|
|
498
|
+
totalCostUsd: float64;
|
|
499
|
+
|
|
500
|
+
@doc("Cost model/pricing source")
|
|
501
|
+
@encodedName("application/json", "cost_model")
|
|
502
|
+
costModel?: string;
|
|
503
|
+
|
|
504
|
+
@doc("Pricing tier applied")
|
|
505
|
+
@encodedName("application/json", "pricing_tier")
|
|
506
|
+
pricingTier?: string;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// =============================================================================
|
|
510
|
+
// GenAI Enumerations (18+ enums as promised)
|
|
511
|
+
// =============================================================================
|
|
512
|
+
|
|
513
|
+
// =============================================================================
|
|
514
|
+
// GenAI Provider Names (OTel semconv 1.40 compliant)
|
|
515
|
+
// =============================================================================
|
|
516
|
+
|
|
517
|
+
@doc("GenAI provider names - OTel semconv 1.40 official values")
|
|
518
|
+
enum GenAiProvider {
|
|
519
|
+
// ---------------------------------------------------------------------------
|
|
520
|
+
// OFFICIAL OTel semconv 1.40 values
|
|
521
|
+
// ---------------------------------------------------------------------------
|
|
522
|
+
|
|
523
|
+
@doc("Anthropic / Claude")
|
|
524
|
+
anthropic: "anthropic",
|
|
525
|
+
|
|
526
|
+
@doc("Amazon Bedrock")
|
|
527
|
+
awsBedrock: "aws.bedrock",
|
|
528
|
+
|
|
529
|
+
@doc("Azure AI Inference")
|
|
530
|
+
azureAiInference: "azure.ai.inference",
|
|
531
|
+
|
|
532
|
+
@doc("Azure AI OpenAI")
|
|
533
|
+
azureAiOpenai: "azure.ai.openai",
|
|
534
|
+
|
|
535
|
+
@doc("Cohere")
|
|
536
|
+
cohere: "cohere",
|
|
537
|
+
|
|
538
|
+
@doc("DeepSeek")
|
|
539
|
+
deepseek: "deepseek",
|
|
540
|
+
|
|
541
|
+
@doc("Google Gemini")
|
|
542
|
+
gcpGemini: "gcp.gemini",
|
|
543
|
+
|
|
544
|
+
@doc("Google GenAI")
|
|
545
|
+
gcpGenAi: "gcp.gen_ai",
|
|
546
|
+
|
|
547
|
+
@doc("Google Vertex AI")
|
|
548
|
+
gcpVertexAi: "gcp.vertex_ai",
|
|
549
|
+
|
|
550
|
+
@doc("Groq")
|
|
551
|
+
groq: "groq",
|
|
552
|
+
|
|
553
|
+
@doc("IBM watsonx.ai")
|
|
554
|
+
ibmWatsonxAi: "ibm.watsonx.ai",
|
|
555
|
+
|
|
556
|
+
@doc("Mistral AI")
|
|
557
|
+
mistralAi: "mistral_ai",
|
|
558
|
+
|
|
559
|
+
@doc("OpenAI / ChatGPT")
|
|
560
|
+
openai: "openai",
|
|
561
|
+
|
|
562
|
+
@doc("Perplexity")
|
|
563
|
+
perplexity: "perplexity",
|
|
564
|
+
|
|
565
|
+
@doc("xAI / Grok")
|
|
566
|
+
xAi: "x_ai",
|
|
567
|
+
|
|
568
|
+
// ---------------------------------------------------------------------------
|
|
569
|
+
// ANcpLua Extensions (not in OTel spec - use ancplua.* for custom attributes)
|
|
570
|
+
// ---------------------------------------------------------------------------
|
|
571
|
+
|
|
572
|
+
@doc("Meta / Llama (ANcpLua extension)")
|
|
573
|
+
meta: "meta",
|
|
574
|
+
|
|
575
|
+
@doc("Hugging Face (ANcpLua extension)")
|
|
576
|
+
huggingface: "huggingface",
|
|
577
|
+
|
|
578
|
+
@doc("Replicate (ANcpLua extension)")
|
|
579
|
+
replicate: "replicate",
|
|
580
|
+
|
|
581
|
+
@doc("Together AI (ANcpLua extension)")
|
|
582
|
+
togetherai: "together_ai",
|
|
583
|
+
|
|
584
|
+
@doc("Fireworks AI (ANcpLua extension)")
|
|
585
|
+
fireworks: "fireworks",
|
|
586
|
+
|
|
587
|
+
@doc("Anyscale (ANcpLua extension)")
|
|
588
|
+
anyscale: "anyscale",
|
|
589
|
+
|
|
590
|
+
@doc("Local/self-hosted model (ANcpLua extension)")
|
|
591
|
+
local: "local",
|
|
592
|
+
|
|
593
|
+
@doc("Custom/other provider (ANcpLua extension)")
|
|
594
|
+
custom: "custom",
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// =============================================================================
|
|
598
|
+
// GenAI Operation Types (OTel semconv 1.40 compliant)
|
|
599
|
+
// =============================================================================
|
|
600
|
+
|
|
601
|
+
@doc("GenAI operation types - OTel semconv 1.40 official values")
|
|
602
|
+
enum GenAiOperationType {
|
|
603
|
+
// ---------------------------------------------------------------------------
|
|
604
|
+
// OFFICIAL OTel semconv 1.40 values
|
|
605
|
+
// ---------------------------------------------------------------------------
|
|
606
|
+
|
|
607
|
+
@doc("Chat/conversation completion")
|
|
608
|
+
chat: "chat",
|
|
609
|
+
|
|
610
|
+
@doc("Text embedding generation")
|
|
611
|
+
embeddings: "embeddings",
|
|
612
|
+
|
|
613
|
+
@doc("Text completion (legacy)")
|
|
614
|
+
textCompletion: "text_completion",
|
|
615
|
+
|
|
616
|
+
@doc("Create an AI agent")
|
|
617
|
+
createAgent: "create_agent",
|
|
618
|
+
|
|
619
|
+
@doc("Execute a tool/function")
|
|
620
|
+
executeTool: "execute_tool",
|
|
621
|
+
|
|
622
|
+
@doc("Generate content (generic)")
|
|
623
|
+
generateContent: "generate_content",
|
|
624
|
+
|
|
625
|
+
@doc("Invoke an AI agent")
|
|
626
|
+
invokeAgent: "invoke_agent",
|
|
627
|
+
|
|
628
|
+
// ---------------------------------------------------------------------------
|
|
629
|
+
// ANcpLua Extensions (not in OTel spec)
|
|
630
|
+
// ---------------------------------------------------------------------------
|
|
631
|
+
|
|
632
|
+
@doc("Image generation (ANcpLua extension)")
|
|
633
|
+
imageGeneration: "image_generation",
|
|
634
|
+
|
|
635
|
+
@doc("Audio transcription (ANcpLua extension)")
|
|
636
|
+
audioTranscription: "audio_transcription",
|
|
637
|
+
|
|
638
|
+
@doc("Text-to-speech synthesis (ANcpLua extension)")
|
|
639
|
+
textToSpeech: "text_to_speech",
|
|
640
|
+
|
|
641
|
+
@doc("Model reranking (ANcpLua extension)")
|
|
642
|
+
rerank: "rerank",
|
|
643
|
+
|
|
644
|
+
@doc("Content moderation (ANcpLua extension)")
|
|
645
|
+
moderation: "moderation",
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
@doc("Reasons for generation completion")
|
|
649
|
+
enum GenAiFinishReason {
|
|
650
|
+
@doc("Model reached natural stopping point")
|
|
651
|
+
stop: "stop",
|
|
652
|
+
|
|
653
|
+
@doc("Hit maximum token limit")
|
|
654
|
+
maxTokens: "max_tokens",
|
|
655
|
+
|
|
656
|
+
@doc("Hit length limit")
|
|
657
|
+
length: "length",
|
|
658
|
+
|
|
659
|
+
@doc("Content was filtered by safety systems")
|
|
660
|
+
contentFilter: "content_filter",
|
|
661
|
+
|
|
662
|
+
@doc("Model requested tool/function call")
|
|
663
|
+
toolCalls: "tool_calls",
|
|
664
|
+
|
|
665
|
+
@doc("Model requested function call (deprecated)")
|
|
666
|
+
functionCall: "function_call",
|
|
667
|
+
|
|
668
|
+
@doc("Generation was cancelled")
|
|
669
|
+
cancelled: "cancelled",
|
|
670
|
+
|
|
671
|
+
@doc("Error occurred during generation")
|
|
672
|
+
error: "error",
|
|
673
|
+
|
|
674
|
+
@doc("Recitation detected and blocked")
|
|
675
|
+
recitation: "recitation",
|
|
676
|
+
|
|
677
|
+
@doc("Safety stop triggered")
|
|
678
|
+
safety: "safety",
|
|
679
|
+
|
|
680
|
+
@doc("Unknown/other reason")
|
|
681
|
+
other: "other",
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
@doc("Tool choice mode for function calling")
|
|
685
|
+
enum GenAiToolChoice {
|
|
686
|
+
@doc("Model decides whether to call tools")
|
|
687
|
+
auto: "auto",
|
|
688
|
+
|
|
689
|
+
@doc("Model must call at least one tool")
|
|
690
|
+
required: "required",
|
|
691
|
+
|
|
692
|
+
@doc("Model must not call any tools")
|
|
693
|
+
none: "none",
|
|
694
|
+
|
|
695
|
+
@doc("Model must call a specific tool")
|
|
696
|
+
specific: "specific",
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
@doc("Message roles in chat conversations")
|
|
700
|
+
enum GenAiMessageRole {
|
|
701
|
+
@doc("System prompt/instructions")
|
|
702
|
+
system: "system",
|
|
703
|
+
|
|
704
|
+
@doc("User message")
|
|
705
|
+
user: "user",
|
|
706
|
+
|
|
707
|
+
@doc("Assistant/model response")
|
|
708
|
+
assistant: "assistant",
|
|
709
|
+
|
|
710
|
+
@doc("Tool/function result")
|
|
711
|
+
tool: "tool",
|
|
712
|
+
|
|
713
|
+
@doc("Function result (deprecated)")
|
|
714
|
+
function: "function",
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
@doc("Content types in messages")
|
|
718
|
+
enum GenAiContentType {
|
|
719
|
+
@doc("Plain text content")
|
|
720
|
+
text: "text",
|
|
721
|
+
|
|
722
|
+
@doc("Image content")
|
|
723
|
+
image: "image",
|
|
724
|
+
|
|
725
|
+
@doc("Audio content")
|
|
726
|
+
audio: "audio",
|
|
727
|
+
|
|
728
|
+
@doc("Video content")
|
|
729
|
+
video: "video",
|
|
730
|
+
|
|
731
|
+
@doc("File/document content")
|
|
732
|
+
file: "file",
|
|
733
|
+
|
|
734
|
+
@doc("Tool call request")
|
|
735
|
+
toolCall: "tool_call",
|
|
736
|
+
|
|
737
|
+
@doc("Tool call result")
|
|
738
|
+
toolResult: "tool_result",
|
|
739
|
+
|
|
740
|
+
@doc("Thinking/reasoning content")
|
|
741
|
+
thinking: "thinking",
|
|
742
|
+
|
|
743
|
+
@doc("Refusal message")
|
|
744
|
+
refusal: "refusal",
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
@doc("Embedding encoding formats")
|
|
748
|
+
enum EmbeddingEncodingFormat {
|
|
749
|
+
@doc("Array of floats")
|
|
750
|
+
float: "float",
|
|
751
|
+
|
|
752
|
+
@doc("Base64-encoded bytes")
|
|
753
|
+
base64: "base64",
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
@doc("GenAI-specific error types")
|
|
757
|
+
enum GenAiErrorType {
|
|
758
|
+
@doc("Authentication failed")
|
|
759
|
+
authenticationError: "authentication_error",
|
|
760
|
+
|
|
761
|
+
@doc("Insufficient quota/credits")
|
|
762
|
+
insufficientQuota: "insufficient_quota",
|
|
763
|
+
|
|
764
|
+
@doc("Rate limit exceeded")
|
|
765
|
+
rateLimitExceeded: "rate_limit_exceeded",
|
|
766
|
+
|
|
767
|
+
@doc("Invalid request parameters")
|
|
768
|
+
invalidRequest: "invalid_request",
|
|
769
|
+
|
|
770
|
+
@doc("Context length exceeded")
|
|
771
|
+
contextLengthExceeded: "context_length_exceeded",
|
|
772
|
+
|
|
773
|
+
@doc("Content policy violation")
|
|
774
|
+
contentPolicyViolation: "content_policy_violation",
|
|
775
|
+
|
|
776
|
+
@doc("Model not found")
|
|
777
|
+
modelNotFound: "model_not_found",
|
|
778
|
+
|
|
779
|
+
@doc("Model overloaded")
|
|
780
|
+
modelOverloaded: "model_overloaded",
|
|
781
|
+
|
|
782
|
+
@doc("Server error")
|
|
783
|
+
serverError: "server_error",
|
|
784
|
+
|
|
785
|
+
@doc("Service unavailable")
|
|
786
|
+
serviceUnavailable: "service_unavailable",
|
|
787
|
+
|
|
788
|
+
@doc("Timeout")
|
|
789
|
+
timeout: "timeout",
|
|
790
|
+
|
|
791
|
+
@doc("Connection error")
|
|
792
|
+
connectionError: "connection_error",
|
|
793
|
+
|
|
794
|
+
@doc("Unknown error")
|
|
795
|
+
`unknown`: "unknown",
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// =============================================================================
|
|
799
|
+
// GenAI Token Types (OTel semconv 1.40 compliant)
|
|
800
|
+
// =============================================================================
|
|
801
|
+
|
|
802
|
+
@doc("Token types for usage tracking - OTel semconv 1.40 official values")
|
|
803
|
+
enum GenAiTokenType {
|
|
804
|
+
// ---------------------------------------------------------------------------
|
|
805
|
+
// OFFICIAL OTel semconv 1.40 values
|
|
806
|
+
// ---------------------------------------------------------------------------
|
|
807
|
+
|
|
808
|
+
@doc("Input/prompt tokens")
|
|
809
|
+
input: "input",
|
|
810
|
+
|
|
811
|
+
@doc("Output/completion tokens")
|
|
812
|
+
output: "output",
|
|
813
|
+
|
|
814
|
+
// ---------------------------------------------------------------------------
|
|
815
|
+
// ANcpLua Extensions (not in OTel spec)
|
|
816
|
+
// ---------------------------------------------------------------------------
|
|
817
|
+
|
|
818
|
+
@doc("Cached input tokens (ANcpLua extension)")
|
|
819
|
+
cached: "cached",
|
|
820
|
+
|
|
821
|
+
@doc("Reasoning tokens for CoT models (ANcpLua extension)")
|
|
822
|
+
reasoning: "reasoning",
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// =============================================================================
|
|
826
|
+
// GenAI Tool Types (OTel semconv 1.40 compliant)
|
|
827
|
+
// =============================================================================
|
|
828
|
+
|
|
829
|
+
@doc("Tool types for GenAI function calling - OTel semconv 1.40 official values")
|
|
830
|
+
enum GenAiToolType {
|
|
831
|
+
// ---------------------------------------------------------------------------
|
|
832
|
+
// OFFICIAL OTel semconv 1.40 values
|
|
833
|
+
// ---------------------------------------------------------------------------
|
|
834
|
+
|
|
835
|
+
@doc("Function/method call")
|
|
836
|
+
function: "function",
|
|
837
|
+
|
|
838
|
+
@doc("Extension tool")
|
|
839
|
+
extension: "extension",
|
|
840
|
+
|
|
841
|
+
@doc("Datastore access")
|
|
842
|
+
datastore: "datastore",
|
|
843
|
+
|
|
844
|
+
// ---------------------------------------------------------------------------
|
|
845
|
+
// ANcpLua Extensions (not in OTel spec)
|
|
846
|
+
// ---------------------------------------------------------------------------
|
|
847
|
+
|
|
848
|
+
@doc("Code interpreter/execution (ANcpLua extension)")
|
|
849
|
+
codeInterpreter: "code_interpreter",
|
|
850
|
+
|
|
851
|
+
@doc("MCP (Model Context Protocol) tool (ANcpLua extension)")
|
|
852
|
+
mcp: "mcp",
|
|
853
|
+
|
|
854
|
+
@doc("Web search (ANcpLua extension)")
|
|
855
|
+
webSearch: "web_search",
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
@doc("GenAI output types")
|
|
859
|
+
enum GenAiOutputType {
|
|
860
|
+
@doc("Text output")
|
|
861
|
+
text: "text",
|
|
862
|
+
|
|
863
|
+
@doc("JSON output")
|
|
864
|
+
json: "json",
|
|
865
|
+
|
|
866
|
+
@doc("Image output")
|
|
867
|
+
image: "image",
|
|
868
|
+
|
|
869
|
+
@doc("Speech/audio output")
|
|
870
|
+
speech: "speech",
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
@doc("Image quality settings")
|
|
874
|
+
enum GenAiImageQuality {
|
|
875
|
+
@doc("Standard quality")
|
|
876
|
+
standard: "standard",
|
|
877
|
+
|
|
878
|
+
@doc("High quality")
|
|
879
|
+
hd: "hd",
|
|
880
|
+
|
|
881
|
+
@doc("Ultra high quality")
|
|
882
|
+
ultra: "ultra",
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
@doc("Image sizes")
|
|
886
|
+
enum GenAiImageSize {
|
|
887
|
+
@doc("256x256 pixels")
|
|
888
|
+
size256: "256x256",
|
|
889
|
+
|
|
890
|
+
@doc("512x512 pixels")
|
|
891
|
+
size512: "512x512",
|
|
892
|
+
|
|
893
|
+
@doc("1024x1024 pixels")
|
|
894
|
+
size1024: "1024x1024",
|
|
895
|
+
|
|
896
|
+
@doc("1792x1024 pixels (wide)")
|
|
897
|
+
size1792x1024: "1792x1024",
|
|
898
|
+
|
|
899
|
+
@doc("1024x1792 pixels (tall)")
|
|
900
|
+
size1024x1792: "1024x1792",
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
@doc("Audio voice options")
|
|
904
|
+
enum GenAiVoice {
|
|
905
|
+
@doc("Alloy voice")
|
|
906
|
+
alloy: "alloy",
|
|
907
|
+
|
|
908
|
+
@doc("Echo voice")
|
|
909
|
+
echo: "echo",
|
|
910
|
+
|
|
911
|
+
@doc("Fable voice")
|
|
912
|
+
fable: "fable",
|
|
913
|
+
|
|
914
|
+
@doc("Onyx voice")
|
|
915
|
+
onyx: "onyx",
|
|
916
|
+
|
|
917
|
+
@doc("Nova voice")
|
|
918
|
+
nova: "nova",
|
|
919
|
+
|
|
920
|
+
@doc("Shimmer voice")
|
|
921
|
+
shimmer: "shimmer",
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
@doc("Audio response formats")
|
|
925
|
+
enum GenAiAudioFormat {
|
|
926
|
+
@doc("MP3 format")
|
|
927
|
+
mp3: "mp3",
|
|
928
|
+
|
|
929
|
+
@doc("Opus format")
|
|
930
|
+
opus: "opus",
|
|
931
|
+
|
|
932
|
+
@doc("AAC format")
|
|
933
|
+
aac: "aac",
|
|
934
|
+
|
|
935
|
+
@doc("FLAC format")
|
|
936
|
+
flac: "flac",
|
|
937
|
+
|
|
938
|
+
@doc("WAV format")
|
|
939
|
+
wav: "wav",
|
|
940
|
+
|
|
941
|
+
@doc("PCM format")
|
|
942
|
+
pcm: "pcm",
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
@doc("Moderation categories")
|
|
946
|
+
enum GenAiModerationCategory {
|
|
947
|
+
@doc("Hate speech")
|
|
948
|
+
hate: "hate",
|
|
949
|
+
|
|
950
|
+
@doc("Hate speech with threats")
|
|
951
|
+
hateThreatening: "hate/threatening",
|
|
952
|
+
|
|
953
|
+
@doc("Harassment")
|
|
954
|
+
harassment: "harassment",
|
|
955
|
+
|
|
956
|
+
@doc("Harassment with threats")
|
|
957
|
+
harassmentThreatening: "harassment/threatening",
|
|
958
|
+
|
|
959
|
+
@doc("Self-harm content")
|
|
960
|
+
selfHarm: "self-harm",
|
|
961
|
+
|
|
962
|
+
@doc("Self-harm instructions")
|
|
963
|
+
selfHarmInstructions: "self-harm/instructions",
|
|
964
|
+
|
|
965
|
+
@doc("Self-harm intent")
|
|
966
|
+
selfHarmIntent: "self-harm/intent",
|
|
967
|
+
|
|
968
|
+
@doc("Sexual content")
|
|
969
|
+
sexual: "sexual",
|
|
970
|
+
|
|
971
|
+
@doc("Sexual content involving minors")
|
|
972
|
+
sexualMinors: "sexual/minors",
|
|
973
|
+
|
|
974
|
+
@doc("Violence")
|
|
975
|
+
violence: "violence",
|
|
976
|
+
|
|
977
|
+
@doc("Graphic violence")
|
|
978
|
+
violenceGraphic: "violence/graphic",
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
@doc("Content filter severity levels")
|
|
982
|
+
enum GenAiFilterSeverity {
|
|
983
|
+
@doc("Safe content")
|
|
984
|
+
safe: "safe",
|
|
985
|
+
|
|
986
|
+
@doc("Low severity")
|
|
987
|
+
low: "low",
|
|
988
|
+
|
|
989
|
+
@doc("Medium severity")
|
|
990
|
+
medium: "medium",
|
|
991
|
+
|
|
992
|
+
@doc("High severity")
|
|
993
|
+
high: "high",
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
@doc("Response format types")
|
|
997
|
+
enum GenAiResponseFormat {
|
|
998
|
+
@doc("Plain text response")
|
|
999
|
+
text: "text",
|
|
1000
|
+
|
|
1001
|
+
@doc("JSON object response")
|
|
1002
|
+
jsonObject: "json_object",
|
|
1003
|
+
|
|
1004
|
+
@doc("JSON schema-constrained response")
|
|
1005
|
+
jsonSchema: "json_schema",
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// =============================================================================
|
|
1009
|
+
// GenAI Event Models
|
|
1010
|
+
// =============================================================================
|
|
1011
|
+
|
|
1012
|
+
@doc("Event for prompt/message content")
|
|
1013
|
+
model GenAiPromptEvent {
|
|
1014
|
+
@doc("Event name")
|
|
1015
|
+
@encodedName("application/json", "event.name")
|
|
1016
|
+
eventName: "gen_ai.content.prompt";
|
|
1017
|
+
|
|
1018
|
+
@doc("Message index in conversation")
|
|
1019
|
+
@encodedName("application/json", "gen_ai.prompt.index")
|
|
1020
|
+
promptIndex: int32;
|
|
1021
|
+
|
|
1022
|
+
@doc("Role of the message sender")
|
|
1023
|
+
@encodedName("application/json", "gen_ai.prompt.role")
|
|
1024
|
+
promptRole: GenAiMessageRole;
|
|
1025
|
+
|
|
1026
|
+
@doc("Content type")
|
|
1027
|
+
@encodedName("application/json", "gen_ai.prompt.content_type")
|
|
1028
|
+
contentType?: GenAiContentType;
|
|
1029
|
+
|
|
1030
|
+
@doc("Content (may be redacted for privacy)")
|
|
1031
|
+
@encodedName("application/json", "gen_ai.prompt.content")
|
|
1032
|
+
content?: string;
|
|
1033
|
+
|
|
1034
|
+
@doc("Token count for this message")
|
|
1035
|
+
@encodedName("application/json", "gen_ai.prompt.tokens")
|
|
1036
|
+
tokens?: TokenCount;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
@doc("Event for completion/response content")
|
|
1040
|
+
model GenAiCompletionEvent {
|
|
1041
|
+
@doc("Event name")
|
|
1042
|
+
@encodedName("application/json", "event.name")
|
|
1043
|
+
eventName: "gen_ai.content.completion";
|
|
1044
|
+
|
|
1045
|
+
@doc("Choice index for multi-choice responses")
|
|
1046
|
+
@encodedName("application/json", "gen_ai.completion.index")
|
|
1047
|
+
completionIndex: int32;
|
|
1048
|
+
|
|
1049
|
+
@doc("Role (always assistant)")
|
|
1050
|
+
@encodedName("application/json", "gen_ai.completion.role")
|
|
1051
|
+
completionRole: "assistant";
|
|
1052
|
+
|
|
1053
|
+
@doc("Finish reason for this choice")
|
|
1054
|
+
@encodedName("application/json", "gen_ai.completion.finish_reason")
|
|
1055
|
+
finishReason?: GenAiFinishReason;
|
|
1056
|
+
|
|
1057
|
+
@doc("Content (may be redacted for privacy)")
|
|
1058
|
+
@encodedName("application/json", "gen_ai.completion.content")
|
|
1059
|
+
content?: string;
|
|
1060
|
+
|
|
1061
|
+
@doc("Token count for this completion")
|
|
1062
|
+
@encodedName("application/json", "gen_ai.completion.tokens")
|
|
1063
|
+
tokens?: TokenCount;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
@doc("Event for tool/function calls")
|
|
1067
|
+
model GenAiToolCallEvent {
|
|
1068
|
+
@doc("Event name")
|
|
1069
|
+
@encodedName("application/json", "event.name")
|
|
1070
|
+
eventName: "gen_ai.tool.call";
|
|
1071
|
+
|
|
1072
|
+
@doc("Tool call ID")
|
|
1073
|
+
@encodedName("application/json", "gen_ai.tool.id")
|
|
1074
|
+
toolId: string;
|
|
1075
|
+
|
|
1076
|
+
@doc("Tool/function name")
|
|
1077
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ToolName)
|
|
1078
|
+
toolName: string;
|
|
1079
|
+
|
|
1080
|
+
@doc("Tool arguments (JSON string)")
|
|
1081
|
+
@encodedName("application/json", "gen_ai.tool.arguments")
|
|
1082
|
+
toolArguments?: string;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
@doc("Event for tool/function results")
|
|
1086
|
+
model GenAiToolResultEvent {
|
|
1087
|
+
@doc("Event name")
|
|
1088
|
+
@encodedName("application/json", "event.name")
|
|
1089
|
+
eventName: "gen_ai.tool.result";
|
|
1090
|
+
|
|
1091
|
+
@doc("Tool call ID")
|
|
1092
|
+
@encodedName("application/json", "gen_ai.tool.id")
|
|
1093
|
+
toolId: string;
|
|
1094
|
+
|
|
1095
|
+
@doc("Tool result (may be truncated)")
|
|
1096
|
+
@encodedName("application/json", "gen_ai.tool.result")
|
|
1097
|
+
toolResult?: string;
|
|
1098
|
+
|
|
1099
|
+
@doc("Whether the tool execution succeeded")
|
|
1100
|
+
@encodedName("application/json", "gen_ai.tool.success")
|
|
1101
|
+
toolSuccess: boolean;
|
|
1102
|
+
|
|
1103
|
+
@doc("Error message if failed")
|
|
1104
|
+
@encodedName("application/json", "gen_ai.tool.error")
|
|
1105
|
+
toolError?: string;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// =============================================================================
|
|
1109
|
+
// GenAI Metrics
|
|
1110
|
+
// =============================================================================
|
|
1111
|
+
|
|
1112
|
+
@doc("GenAI token usage metric (counter)")
|
|
1113
|
+
model GenAiTokenUsageMetric {
|
|
1114
|
+
@doc("Metric name")
|
|
1115
|
+
name: "gen_ai.client.token.usage";
|
|
1116
|
+
|
|
1117
|
+
@doc("Metric unit")
|
|
1118
|
+
unit: "{token}";
|
|
1119
|
+
|
|
1120
|
+
@doc("Token type (input or output)")
|
|
1121
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.TokenType)
|
|
1122
|
+
tokenType: GenAiTokenType;
|
|
1123
|
+
|
|
1124
|
+
@doc("Provider name")
|
|
1125
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ProviderName)
|
|
1126
|
+
providerName: GenAiProvider;
|
|
1127
|
+
|
|
1128
|
+
@doc("Model name")
|
|
1129
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestModel)
|
|
1130
|
+
requestModel: string;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
@doc("GenAI operation duration metric (histogram)")
|
|
1134
|
+
model GenAiOperationDurationMetric {
|
|
1135
|
+
@doc("Metric name")
|
|
1136
|
+
name: "gen_ai.client.operation.duration";
|
|
1137
|
+
|
|
1138
|
+
@doc("Metric unit (seconds)")
|
|
1139
|
+
unit: "s";
|
|
1140
|
+
|
|
1141
|
+
@doc("Operation type")
|
|
1142
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OperationName)
|
|
1143
|
+
operationName: GenAiOperationType;
|
|
1144
|
+
|
|
1145
|
+
@doc("Provider name")
|
|
1146
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ProviderName)
|
|
1147
|
+
providerName: GenAiProvider;
|
|
1148
|
+
|
|
1149
|
+
@doc("Model name")
|
|
1150
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestModel)
|
|
1151
|
+
requestModel: string;
|
|
1152
|
+
|
|
1153
|
+
@doc("Error type if failed")
|
|
1154
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Error.Type)
|
|
1155
|
+
errorType?: GenAiErrorType;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
@doc("Time to first token metric (histogram)")
|
|
1159
|
+
model GenAiTimeToFirstTokenMetric {
|
|
1160
|
+
@doc("Metric name")
|
|
1161
|
+
name: "gen_ai.client.time_to_first_token";
|
|
1162
|
+
|
|
1163
|
+
@doc("Metric unit (seconds)")
|
|
1164
|
+
unit: "s";
|
|
1165
|
+
|
|
1166
|
+
@doc("Provider name")
|
|
1167
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ProviderName)
|
|
1168
|
+
providerName: GenAiProvider;
|
|
1169
|
+
|
|
1170
|
+
@doc("Model name")
|
|
1171
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.RequestModel)
|
|
1172
|
+
requestModel: string;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
// =============================================================================
|
|
1176
|
+
// GenAI Aggregated Statistics
|
|
1177
|
+
// =============================================================================
|
|
1178
|
+
|
|
1179
|
+
@doc("Aggregated GenAI usage statistics")
|
|
1180
|
+
model GenAiStats {
|
|
1181
|
+
@doc("Total number of GenAI operations")
|
|
1182
|
+
@encodedName("application/json", "total_operations")
|
|
1183
|
+
totalOperations: Count;
|
|
1184
|
+
|
|
1185
|
+
@doc("Total input tokens consumed")
|
|
1186
|
+
@encodedName("application/json", "total_input_tokens")
|
|
1187
|
+
totalInputTokens: TokenCount;
|
|
1188
|
+
|
|
1189
|
+
@doc("Total output tokens generated")
|
|
1190
|
+
@encodedName("application/json", "total_output_tokens")
|
|
1191
|
+
totalOutputTokens: TokenCount;
|
|
1192
|
+
|
|
1193
|
+
@doc("Total cached input tokens")
|
|
1194
|
+
@encodedName("application/json", "total_cached_tokens")
|
|
1195
|
+
totalCachedTokens?: TokenCount;
|
|
1196
|
+
|
|
1197
|
+
@doc("Token usage by model")
|
|
1198
|
+
@encodedName("application/json", "usage_by_model")
|
|
1199
|
+
usageByModel: GenAiModelUsage[];
|
|
1200
|
+
|
|
1201
|
+
@doc("Token usage by provider")
|
|
1202
|
+
@encodedName("application/json", "usage_by_provider")
|
|
1203
|
+
usageByProvider: GenAiProviderUsage[];
|
|
1204
|
+
|
|
1205
|
+
@doc("Usage by operation type")
|
|
1206
|
+
@encodedName("application/json", "usage_by_operation")
|
|
1207
|
+
usageByOperation: GenAiOperationUsage[];
|
|
1208
|
+
|
|
1209
|
+
@doc("Error statistics")
|
|
1210
|
+
@encodedName("application/json", "error_stats")
|
|
1211
|
+
errorStats: GenAiErrorStats;
|
|
1212
|
+
|
|
1213
|
+
@doc("Latency percentiles (in milliseconds)")
|
|
1214
|
+
@encodedName("application/json", "latency_percentiles")
|
|
1215
|
+
latencyPercentiles: LatencyPercentiles;
|
|
1216
|
+
|
|
1217
|
+
@doc("Estimated cost in USD (if available)")
|
|
1218
|
+
@encodedName("application/json", "estimated_cost_usd")
|
|
1219
|
+
estimatedCostUsd?: float64;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
@doc("Model-level usage statistics")
|
|
1223
|
+
model GenAiModelUsage {
|
|
1224
|
+
@doc("Model identifier")
|
|
1225
|
+
@encodedName("application/json", "model_name")
|
|
1226
|
+
modelName: string;
|
|
1227
|
+
|
|
1228
|
+
@doc("Provider name")
|
|
1229
|
+
provider: GenAiProvider;
|
|
1230
|
+
|
|
1231
|
+
@doc("Operation count")
|
|
1232
|
+
@encodedName("application/json", "operation_count")
|
|
1233
|
+
operationCount: Count;
|
|
1234
|
+
|
|
1235
|
+
@doc("Input tokens")
|
|
1236
|
+
@encodedName("application/json", "input_tokens")
|
|
1237
|
+
inputTokens: TokenCount;
|
|
1238
|
+
|
|
1239
|
+
@doc("Output tokens")
|
|
1240
|
+
@encodedName("application/json", "output_tokens")
|
|
1241
|
+
outputTokens: TokenCount;
|
|
1242
|
+
|
|
1243
|
+
@doc("Error count")
|
|
1244
|
+
@encodedName("application/json", "error_count")
|
|
1245
|
+
errorCount: Count;
|
|
1246
|
+
|
|
1247
|
+
@doc("Average latency in milliseconds")
|
|
1248
|
+
@encodedName("application/json", "avg_latency_ms")
|
|
1249
|
+
avgLatencyMs: float64;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
@doc("Provider-level usage statistics")
|
|
1253
|
+
model GenAiProviderUsage {
|
|
1254
|
+
@doc("Provider name")
|
|
1255
|
+
provider: GenAiProvider;
|
|
1256
|
+
|
|
1257
|
+
@doc("Operation count")
|
|
1258
|
+
@encodedName("application/json", "operation_count")
|
|
1259
|
+
operationCount: Count;
|
|
1260
|
+
|
|
1261
|
+
@doc("Total tokens (input + output)")
|
|
1262
|
+
@encodedName("application/json", "total_tokens")
|
|
1263
|
+
totalTokens: TokenCount;
|
|
1264
|
+
|
|
1265
|
+
@doc("Error rate")
|
|
1266
|
+
@encodedName("application/json", "error_rate")
|
|
1267
|
+
errorRate: Ratio;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
@doc("Operation-level usage statistics")
|
|
1271
|
+
model GenAiOperationUsage {
|
|
1272
|
+
@doc("Operation type")
|
|
1273
|
+
@encodedName("application/json", "operation_type")
|
|
1274
|
+
operationType: GenAiOperationType;
|
|
1275
|
+
|
|
1276
|
+
@doc("Operation count")
|
|
1277
|
+
@encodedName("application/json", "operation_count")
|
|
1278
|
+
operationCount: Count;
|
|
1279
|
+
|
|
1280
|
+
@doc("Average tokens per operation")
|
|
1281
|
+
@encodedName("application/json", "avg_tokens")
|
|
1282
|
+
avgTokens: float64;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
@doc("Error statistics")
|
|
1286
|
+
model GenAiErrorStats {
|
|
1287
|
+
@doc("Total error count")
|
|
1288
|
+
@encodedName("application/json", "total_errors")
|
|
1289
|
+
totalErrors: Count;
|
|
1290
|
+
|
|
1291
|
+
@doc("Error rate")
|
|
1292
|
+
@encodedName("application/json", "error_rate")
|
|
1293
|
+
errorRate: Ratio;
|
|
1294
|
+
|
|
1295
|
+
@doc("Errors by type")
|
|
1296
|
+
@encodedName("application/json", "by_type")
|
|
1297
|
+
byType: GenAiErrorCount[];
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
@doc("Error count by type")
|
|
1301
|
+
model GenAiErrorCount {
|
|
1302
|
+
@doc("Error type")
|
|
1303
|
+
@encodedName("application/json", "error_type")
|
|
1304
|
+
errorType: GenAiErrorType;
|
|
1305
|
+
|
|
1306
|
+
@doc("Count")
|
|
1307
|
+
count: Count;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
@doc("Latency percentiles")
|
|
1311
|
+
model LatencyPercentiles {
|
|
1312
|
+
@doc("P50 (median) in milliseconds")
|
|
1313
|
+
p50: float64;
|
|
1314
|
+
|
|
1315
|
+
@doc("P75 in milliseconds")
|
|
1316
|
+
p75: float64;
|
|
1317
|
+
|
|
1318
|
+
@doc("P90 in milliseconds")
|
|
1319
|
+
p90: float64;
|
|
1320
|
+
|
|
1321
|
+
@doc("P95 in milliseconds")
|
|
1322
|
+
p95: float64;
|
|
1323
|
+
|
|
1324
|
+
@doc("P99 in milliseconds")
|
|
1325
|
+
p99: float64;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// =============================================================================
|
|
1329
|
+
// Vendor-Specific Extensions (OTel 1.40)
|
|
1330
|
+
// =============================================================================
|
|
1331
|
+
|
|
1332
|
+
@doc("OpenAI-specific request attributes")
|
|
1333
|
+
model OpenAiRequestAttributes {
|
|
1334
|
+
@doc("Response format requested (text, json_object, json_schema)")
|
|
1335
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiRequestResponseFormat)
|
|
1336
|
+
responseFormat?: OpenAiResponseFormat;
|
|
1337
|
+
|
|
1338
|
+
@doc("Random seed for deterministic generation")
|
|
1339
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiRequestSeed)
|
|
1340
|
+
seed?: int64;
|
|
1341
|
+
|
|
1342
|
+
@doc("Service tier for the request (auto, default, etc.)")
|
|
1343
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiRequestServiceTier)
|
|
1344
|
+
serviceTier?: string;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
@doc("OpenAI-specific response attributes")
|
|
1348
|
+
model OpenAiResponseAttributes {
|
|
1349
|
+
@doc("Service tier used for the response")
|
|
1350
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiResponseServiceTier)
|
|
1351
|
+
serviceTier?: string;
|
|
1352
|
+
|
|
1353
|
+
@doc("System fingerprint for reproducibility")
|
|
1354
|
+
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiResponseSystemFingerprint)
|
|
1355
|
+
systemFingerprint?: string;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
@doc("OpenAI response format types")
|
|
1359
|
+
enum OpenAiResponseFormat {
|
|
1360
|
+
@doc("Plain text response")
|
|
1361
|
+
text: "text",
|
|
1362
|
+
|
|
1363
|
+
@doc("JSON object response")
|
|
1364
|
+
jsonObject: "json_object",
|
|
1365
|
+
|
|
1366
|
+
@doc("JSON schema-constrained response")
|
|
1367
|
+
jsonSchema: "json_schema",
|
|
1368
|
+
}
|