@mastra/observability 1.24.0-alpha.3 → 1.24.0-alpha.4
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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +35 -35
- package/dist/index.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/pricing-data.json +279 -101
- package/dist/model-tracing.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3227,11 +3227,22 @@ var ModelSpanTracker = class {
|
|
|
3227
3227
|
* create MODEL_STEP and MODEL_CHUNK spans for each semantic unit in the stream.
|
|
3228
3228
|
*/
|
|
3229
3229
|
wrapStream(stream, inferenceOnly = false) {
|
|
3230
|
+
let servedModelId;
|
|
3230
3231
|
return stream.pipeThrough(new TransformStream({ transform: (chunk, controller) => {
|
|
3231
3232
|
if (inferenceOnly) {
|
|
3232
3233
|
try {
|
|
3234
|
+
if (chunk.type === "response-metadata" && typeof chunk.payload?.modelId === "string") servedModelId = chunk.payload.modelId;
|
|
3233
3235
|
if (MODEL_RESPONSE_CHUNK_TYPES.has(chunk.type)) this.#captureCompletionStartTime();
|
|
3234
|
-
if (chunk.type === "finish")
|
|
3236
|
+
if (chunk.type === "finish") {
|
|
3237
|
+
const payload = servedModelId && !chunk.payload?.metadata?.modelId ? {
|
|
3238
|
+
...chunk.payload,
|
|
3239
|
+
metadata: {
|
|
3240
|
+
...chunk.payload?.metadata,
|
|
3241
|
+
modelId: servedModelId
|
|
3242
|
+
}
|
|
3243
|
+
} : chunk.payload;
|
|
3244
|
+
this.#endInferenceSpan(payload, false);
|
|
3245
|
+
}
|
|
3235
3246
|
} catch {}
|
|
3236
3247
|
controller.enqueue(chunk);
|
|
3237
3248
|
return;
|