@struct-ai/sdk 0.4.2 → 0.4.3
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/README.md +22 -0
- package/dist/commonjs/version.d.ts +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,28 @@ Emits attributes per the OTel GenAI semantic conventions:
|
|
|
293
293
|
- `gen_ai.tool.{name, call.id, call.arguments, call.result}`
|
|
294
294
|
- `error.type` + `StatusCode.ERROR` on failures
|
|
295
295
|
|
|
296
|
+
### `error.type` values emitted
|
|
297
|
+
|
|
298
|
+
The OTel conventions ask instrumentations to document the error values they
|
|
299
|
+
report ("Instrumentations SHOULD document the list of errors they report").
|
|
300
|
+
This SDK emits exactly two kinds of value, both alongside span
|
|
301
|
+
`StatusCode.ERROR`:
|
|
302
|
+
|
|
303
|
+
| Value | When | Meaning |
|
|
304
|
+
| --- | --- | --- |
|
|
305
|
+
| exception class name (e.g. `TypeError`, `APIConnectionError`) | the instrumented call threw | We failed to execute the request. Also records an OTel exception event. |
|
|
306
|
+
| `tool_error` | an `execute_tool` span whose result signalled failure **in band** — Anthropic `tool_result` blocks with `is_error: true`, MCP `CallToolResult.isError`, or a LangChain `ToolMessage` with `status: "error"` | The tool ran and reported a failure back to the model (bad arguments, a domain "no"), so the model can self-correct. No exception object exists, so no class name is available. |
|
|
307
|
+
|
|
308
|
+
`tool_error` is a deliberate low-cardinality sentinel, which the `error.type`
|
|
309
|
+
convention explicitly permits ("another low-cardinality error identifier"; a
|
|
310
|
+
custom value MAY be used where no well-known one applies). The same split is
|
|
311
|
+
used by OpenTelemetry's MCP instrumentation in OpenLLMetry, which likewise
|
|
312
|
+
reports `error.type="tool_error"` for the `isError` path and the exception
|
|
313
|
+
class name otherwise. Matches the Python SDK.
|
|
314
|
+
|
|
315
|
+
The distinction is what lets a monitor page on genuine execution failures
|
|
316
|
+
while excluding failures the model already saw and can recover from.
|
|
317
|
+
|
|
296
318
|
Note: `gen_ai.usage.input_tokens` for Anthropic is the TRUE total — we add back
|
|
297
319
|
`cache_read_input_tokens + cache_creation_input_tokens` (which Anthropic's raw
|
|
298
320
|
response excludes). Matches the Python SDK.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/commonjs/version.js
CHANGED
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/esm/version.js
CHANGED
package/package.json
CHANGED