@llmops/sdk 0.6.0 → 0.6.1-beta.2
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/{agents-exporter-DIoxRgjd.d.mts → agents-exporter-B-ADoC7t.d.cts} +4 -0
- package/dist/{agents-exporter-DvECkYQd.d.cts → agents-exporter-BZjfVkaH.d.mts} +4 -0
- package/dist/{agents-exporter-Ct3l12qS.cjs → agents-exporter-C0mNajZs.cjs} +18 -2
- package/dist/{agents-exporter-BorGCb93.mjs → agents-exporter-vcQaaBwp.mjs} +18 -2
- package/dist/agents.cjs +1 -1
- package/dist/agents.d.cts +1 -1
- package/dist/agents.d.mts +1 -1
- package/dist/agents.mjs +1 -1
- package/dist/express.d.cts +3 -3
- package/dist/express.d.mts +3 -3
- package/dist/hono.d.cts +2 -2
- package/dist/hono.d.mts +2 -2
- package/dist/{index-CelQx4B3.d.mts → index-C1cyvMt2.d.mts} +1 -1
- package/dist/{index-CmC2x4dU.d.mts → index-CRUhyzzA.d.mts} +1 -1
- package/dist/{index-DVTO0Hbl.d.cts → index-Chr-puA7.d.cts} +1 -1
- package/dist/{index-D49MVTAo.d.cts → index-Dtp5Lgj8.d.cts} +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +10 -10
- package/dist/nextjs.d.cts +2 -2
- package/dist/nextjs.d.mts +2 -2
- package/package.json +3 -3
|
@@ -83,6 +83,10 @@ type GenerationSpanData = {
|
|
|
83
83
|
type ResponseSpanData = {
|
|
84
84
|
type: 'response';
|
|
85
85
|
response_id?: string;
|
|
86
|
+
/** Input messages — provided by @openai/agents for non-OpenAI tracing providers */
|
|
87
|
+
_input?: unknown;
|
|
88
|
+
/** Full API response object (includes usage, model, output) */
|
|
89
|
+
_response?: Record<string, unknown>;
|
|
86
90
|
[key: string]: unknown;
|
|
87
91
|
};
|
|
88
92
|
type HandoffSpanData = {
|
|
@@ -83,6 +83,10 @@ type GenerationSpanData = {
|
|
|
83
83
|
type ResponseSpanData = {
|
|
84
84
|
type: 'response';
|
|
85
85
|
response_id?: string;
|
|
86
|
+
/** Input messages — provided by @openai/agents for non-OpenAI tracing providers */
|
|
87
|
+
_input?: unknown;
|
|
88
|
+
/** Full API response object (includes usage, model, output) */
|
|
89
|
+
_response?: Record<string, unknown>;
|
|
86
90
|
[key: string]: unknown;
|
|
87
91
|
};
|
|
88
92
|
type HandoffSpanData = {
|
|
@@ -38,7 +38,10 @@ function deriveSpanName(data) {
|
|
|
38
38
|
case "agent": return `Agent: ${data.name}`;
|
|
39
39
|
case "function": return `Tool: ${data.name}`;
|
|
40
40
|
case "generation": return data.model ? `Generation: ${data.model}` : "Generation";
|
|
41
|
-
case "response":
|
|
41
|
+
case "response": {
|
|
42
|
+
const model = data._response?.model;
|
|
43
|
+
return typeof model === "string" ? `Response: ${model}` : "Response";
|
|
44
|
+
}
|
|
42
45
|
case "handoff": return `Handoff: ${data.from_agent ?? "?"} → ${data.to_agent ?? "?"}`;
|
|
43
46
|
case "guardrail": return `Guardrail: ${data.name}`;
|
|
44
47
|
case "custom": return `Custom: ${data.name}`;
|
|
@@ -87,10 +90,23 @@ function convertSpanDataToAttributes(data, error) {
|
|
|
87
90
|
attrs.push(kv("llmops.guardrail.action", data.triggered ? "triggered" : "passed"));
|
|
88
91
|
attrs.push(kv("openai.agents.guardrail.name", data.name));
|
|
89
92
|
break;
|
|
90
|
-
case "response":
|
|
93
|
+
case "response": {
|
|
91
94
|
attrs.push(kv("gen_ai.operation.name", "chat"));
|
|
92
95
|
if (data.response_id) attrs.push(kv("openai.agents.response.id", data.response_id));
|
|
96
|
+
const resp = data._response;
|
|
97
|
+
if (resp) {
|
|
98
|
+
if (typeof resp.model === "string") {
|
|
99
|
+
attrs.push(kv("gen_ai.request.model", resp.model));
|
|
100
|
+
attrs.push(kv("gen_ai.system", "openai"));
|
|
101
|
+
}
|
|
102
|
+
const usage = resp.usage;
|
|
103
|
+
if (usage?.input_tokens != null) attrs.push(kv("gen_ai.usage.input_tokens", usage.input_tokens));
|
|
104
|
+
if (usage?.output_tokens != null) attrs.push(kv("gen_ai.usage.output_tokens", usage.output_tokens));
|
|
105
|
+
if (resp.output != null) attrs.push(kv("gen_ai.completion", JSON.stringify(resp.output)));
|
|
106
|
+
}
|
|
107
|
+
if (data._input != null) attrs.push(kv("ai.prompt.messages", JSON.stringify(data._input)));
|
|
93
108
|
break;
|
|
109
|
+
}
|
|
94
110
|
case "custom":
|
|
95
111
|
attrs.push(kv("openai.agents.custom.name", data.name));
|
|
96
112
|
attrs.push(kv("openai.agents.custom.data", JSON.stringify(data.data)));
|
|
@@ -37,7 +37,10 @@ function deriveSpanName(data) {
|
|
|
37
37
|
case "agent": return `Agent: ${data.name}`;
|
|
38
38
|
case "function": return `Tool: ${data.name}`;
|
|
39
39
|
case "generation": return data.model ? `Generation: ${data.model}` : "Generation";
|
|
40
|
-
case "response":
|
|
40
|
+
case "response": {
|
|
41
|
+
const model = data._response?.model;
|
|
42
|
+
return typeof model === "string" ? `Response: ${model}` : "Response";
|
|
43
|
+
}
|
|
41
44
|
case "handoff": return `Handoff: ${data.from_agent ?? "?"} → ${data.to_agent ?? "?"}`;
|
|
42
45
|
case "guardrail": return `Guardrail: ${data.name}`;
|
|
43
46
|
case "custom": return `Custom: ${data.name}`;
|
|
@@ -86,10 +89,23 @@ function convertSpanDataToAttributes(data, error) {
|
|
|
86
89
|
attrs.push(kv("llmops.guardrail.action", data.triggered ? "triggered" : "passed"));
|
|
87
90
|
attrs.push(kv("openai.agents.guardrail.name", data.name));
|
|
88
91
|
break;
|
|
89
|
-
case "response":
|
|
92
|
+
case "response": {
|
|
90
93
|
attrs.push(kv("gen_ai.operation.name", "chat"));
|
|
91
94
|
if (data.response_id) attrs.push(kv("openai.agents.response.id", data.response_id));
|
|
95
|
+
const resp = data._response;
|
|
96
|
+
if (resp) {
|
|
97
|
+
if (typeof resp.model === "string") {
|
|
98
|
+
attrs.push(kv("gen_ai.request.model", resp.model));
|
|
99
|
+
attrs.push(kv("gen_ai.system", "openai"));
|
|
100
|
+
}
|
|
101
|
+
const usage = resp.usage;
|
|
102
|
+
if (usage?.input_tokens != null) attrs.push(kv("gen_ai.usage.input_tokens", usage.input_tokens));
|
|
103
|
+
if (usage?.output_tokens != null) attrs.push(kv("gen_ai.usage.output_tokens", usage.output_tokens));
|
|
104
|
+
if (resp.output != null) attrs.push(kv("gen_ai.completion", JSON.stringify(resp.output)));
|
|
105
|
+
}
|
|
106
|
+
if (data._input != null) attrs.push(kv("ai.prompt.messages", JSON.stringify(data._input)));
|
|
92
107
|
break;
|
|
108
|
+
}
|
|
93
109
|
case "custom":
|
|
94
110
|
attrs.push(kv("openai.agents.custom.name", data.name));
|
|
95
111
|
attrs.push(kv("openai.agents.custom.data", JSON.stringify(data.data)));
|
package/dist/agents.cjs
CHANGED
package/dist/agents.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-
|
|
1
|
+
import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-B-ADoC7t.cjs";
|
|
2
2
|
export { AgentsSpan, AgentsSpanData, AgentsSpanError, AgentsTrace, AgentsTracingExporter, LLMOpsAgentsExporterConfig, createLLMOpsAgentsExporter };
|
package/dist/agents.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-
|
|
1
|
+
import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-BZjfVkaH.mjs";
|
|
2
2
|
export { AgentsSpan, AgentsSpanData, AgentsSpanError, AgentsTrace, AgentsTracingExporter, LLMOpsAgentsExporterConfig, createLLMOpsAgentsExporter };
|
package/dist/agents.mjs
CHANGED
package/dist/express.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./agents-exporter-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
1
|
+
import "./agents-exporter-B-ADoC7t.cjs";
|
|
2
|
+
import "./index-Dtp5Lgj8.cjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-Chr-puA7.cjs";
|
|
4
4
|
export { createLLMOpsMiddleware };
|
package/dist/express.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./agents-exporter-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
1
|
+
import "./agents-exporter-BZjfVkaH.mjs";
|
|
2
|
+
import "./index-C1cyvMt2.mjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-CRUhyzzA.mjs";
|
|
4
4
|
export { createLLMOpsMiddleware };
|
package/dist/hono.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./agents-exporter-
|
|
2
|
-
import { t as LLMOpsClient } from "./index-
|
|
1
|
+
import "./agents-exporter-B-ADoC7t.cjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-Dtp5Lgj8.cjs";
|
|
3
3
|
import { MiddlewareHandler } from "hono";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/hono/index.d.ts
|
package/dist/hono.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./agents-exporter-
|
|
2
|
-
import { t as LLMOpsClient } from "./index-
|
|
1
|
+
import "./agents-exporter-BZjfVkaH.mjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-C1cyvMt2.mjs";
|
|
3
3
|
import { MiddlewareHandler } from "hono";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/hono/index.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_express = require('./express-B-wbCza5.cjs');
|
|
2
|
-
const require_agents_exporter = require('./agents-exporter-
|
|
2
|
+
const require_agents_exporter = require('./agents-exporter-C0mNajZs.cjs');
|
|
3
3
|
let __llmops_core = require("@llmops/core");
|
|
4
4
|
let __llmops_app = require("@llmops/app");
|
|
5
5
|
|
|
@@ -25,22 +25,22 @@ const createLLMOps = (config) => {
|
|
|
25
25
|
const request = new Request(input, init);
|
|
26
26
|
const url = new URL(request.url);
|
|
27
27
|
if (basePath && basePath !== "/" && url.pathname.startsWith(basePath)) url.pathname = url.pathname.slice(basePath.length) || "/";
|
|
28
|
+
const headers = new Headers(request.headers);
|
|
29
|
+
headers.set(__llmops_core.LLMOPS_INTERNAL_HEADER, "1");
|
|
28
30
|
if (getTraceContext) {
|
|
29
31
|
const ctx = getTraceContext();
|
|
30
32
|
if (ctx) {
|
|
31
|
-
const headers = new Headers(request.headers);
|
|
32
33
|
if (ctx.traceId) headers.set(__llmops_core.LLMOPS_TRACE_ID_HEADER, ctx.traceId);
|
|
33
34
|
if (ctx.traceName) headers.set(__llmops_core.LLMOPS_TRACE_NAME_HEADER, ctx.traceName);
|
|
34
35
|
if (ctx.spanName) headers.set(__llmops_core.LLMOPS_SPAN_NAME_HEADER, ctx.spanName);
|
|
35
|
-
return handler(new Request(url.toString(), {
|
|
36
|
-
method: request.method,
|
|
37
|
-
headers,
|
|
38
|
-
body: request.body,
|
|
39
|
-
duplex: "half"
|
|
40
|
-
}));
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
|
-
return handler(new Request(url.toString(),
|
|
38
|
+
return handler(new Request(url.toString(), {
|
|
39
|
+
method: request.method,
|
|
40
|
+
headers,
|
|
41
|
+
body: request.body,
|
|
42
|
+
duplex: "half"
|
|
43
|
+
}));
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
return {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-
|
|
2
|
-
import { i as createLLMOps, n as ProviderOptions, r as TraceContext, t as LLMOpsClient } from "./index-
|
|
3
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
1
|
+
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-B-ADoC7t.cjs";
|
|
2
|
+
import { i as createLLMOps, n as ProviderOptions, r as TraceContext, t as LLMOpsClient } from "./index-Dtp5Lgj8.cjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-Chr-puA7.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/auth/client.d.ts
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-
|
|
2
|
-
import { i as createLLMOps, n as ProviderOptions, r as TraceContext, t as LLMOpsClient } from "./index-
|
|
3
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
1
|
+
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-BZjfVkaH.mjs";
|
|
2
|
+
import { i as createLLMOps, n as ProviderOptions, r as TraceContext, t as LLMOpsClient } from "./index-C1cyvMt2.mjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-CRUhyzzA.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/auth/client.d.ts
|
|
6
6
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as createLLMOpsMiddleware } from "./express-ClEIbLM9.mjs";
|
|
2
|
-
import { t as createLLMOpsAgentsExporter } from "./agents-exporter-
|
|
3
|
-
import { LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER } from "@llmops/core";
|
|
2
|
+
import { t as createLLMOpsAgentsExporter } from "./agents-exporter-vcQaaBwp.mjs";
|
|
3
|
+
import { LLMOPS_INTERNAL_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER } from "@llmops/core";
|
|
4
4
|
import { createApp } from "@llmops/app";
|
|
5
5
|
|
|
6
6
|
//#region src/lib/auth/client.ts
|
|
@@ -25,22 +25,22 @@ const createLLMOps = (config) => {
|
|
|
25
25
|
const request = new Request(input, init);
|
|
26
26
|
const url = new URL(request.url);
|
|
27
27
|
if (basePath && basePath !== "/" && url.pathname.startsWith(basePath)) url.pathname = url.pathname.slice(basePath.length) || "/";
|
|
28
|
+
const headers = new Headers(request.headers);
|
|
29
|
+
headers.set(LLMOPS_INTERNAL_HEADER, "1");
|
|
28
30
|
if (getTraceContext) {
|
|
29
31
|
const ctx = getTraceContext();
|
|
30
32
|
if (ctx) {
|
|
31
|
-
const headers = new Headers(request.headers);
|
|
32
33
|
if (ctx.traceId) headers.set(LLMOPS_TRACE_ID_HEADER, ctx.traceId);
|
|
33
34
|
if (ctx.traceName) headers.set(LLMOPS_TRACE_NAME_HEADER, ctx.traceName);
|
|
34
35
|
if (ctx.spanName) headers.set(LLMOPS_SPAN_NAME_HEADER, ctx.spanName);
|
|
35
|
-
return handler(new Request(url.toString(), {
|
|
36
|
-
method: request.method,
|
|
37
|
-
headers,
|
|
38
|
-
body: request.body,
|
|
39
|
-
duplex: "half"
|
|
40
|
-
}));
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
|
-
return handler(new Request(url.toString(),
|
|
38
|
+
return handler(new Request(url.toString(), {
|
|
39
|
+
method: request.method,
|
|
40
|
+
headers,
|
|
41
|
+
body: request.body,
|
|
42
|
+
duplex: "half"
|
|
43
|
+
}));
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
return {
|
package/dist/nextjs.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./agents-exporter-
|
|
2
|
-
import { t as LLMOpsClient } from "./index-
|
|
1
|
+
import "./agents-exporter-B-ADoC7t.cjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-Dtp5Lgj8.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/nextjs/index.d.ts
|
|
5
5
|
declare function toNextJsHandler(client: LLMOpsClient): {
|
package/dist/nextjs.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./agents-exporter-
|
|
2
|
-
import { t as LLMOpsClient } from "./index-
|
|
1
|
+
import "./agents-exporter-BZjfVkaH.mjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-C1cyvMt2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/nextjs/index.d.ts
|
|
5
5
|
declare function toNextJsHandler(client: LLMOpsClient): {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1-beta.2",
|
|
4
4
|
"description": "An LLMOps toolkit for TypeScript applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@llmops/app": "^0.6.
|
|
88
|
-
"@llmops/core": "^0.6.
|
|
87
|
+
"@llmops/app": "^0.6.1-beta.2",
|
|
88
|
+
"@llmops/core": "^0.6.1-beta.2"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@types/express": "^5.0.6",
|