@llmops/sdk 1.0.0-beta.1 → 1.0.0-beta.10
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.d.cts +1 -1
- package/dist/agents.d.mts +1 -1
- package/dist/agents.mjs +1 -1
- package/dist/constants-BrB5eRjw.cjs +18 -0
- package/dist/constants-sHtPfi36.mjs +12 -0
- package/dist/express.d.cts +3 -3
- package/dist/express.d.mts +3 -3
- package/dist/express.mjs +1 -1
- package/dist/hono.d.cts +2 -2
- package/dist/hono.d.mts +2 -2
- package/dist/{index-1uemrw2P.d.cts → index-BHO7MEJx.d.cts} +1 -1
- package/dist/{index-C7J-9Jvp.d.cts → index-C0CDqR9v.d.mts} +1 -1
- package/dist/{index-BeDbCYjz.d.mts → index-DVkfeg2W.d.mts} +1 -1
- package/dist/{index-D0LVaLA4.d.mts → index-sjRozlIk.d.cts} +1 -1
- package/dist/index.cjs +3 -7
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -4
- package/dist/interface-BbAwy96d.d.cts +223 -0
- package/dist/interface-Dz7B6QN1.d.mts +223 -0
- package/dist/nextjs.d.cts +2 -2
- package/dist/nextjs.d.mts +2 -2
- package/dist/store/d1.cjs +491 -0
- package/dist/store/d1.d.cts +60 -0
- package/dist/store/d1.d.mts +60 -0
- package/dist/store/d1.mjs +490 -0
- package/dist/store/pg.cjs +13636 -0
- package/dist/store/pg.d.cts +38 -0
- package/dist/store/pg.d.mts +38 -0
- package/dist/store/pg.mjs +13637 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +44 -3
- /package/dist/{agents-exporter-B-ADoC7t.d.cts → agents-exporter-Bn3NtzMO.d.mts} +0 -0
- /package/dist/{agents-exporter-CxbWY6xN.mjs → agents-exporter-DYmMvLPS.mjs} +0 -0
- /package/dist/{agents-exporter-BZjfVkaH.d.mts → agents-exporter-vuQine9v.d.cts} +0 -0
- /package/dist/{express-ClEIbLM9.mjs → express-Vt9JurUM.mjs} +0 -0
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-vuQine9v.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-Bn3NtzMO.mjs";
|
|
2
2
|
export { AgentsSpan, AgentsSpanData, AgentsSpanError, AgentsTrace, AgentsTracingExporter, LLMOpsAgentsExporterConfig, createLLMOpsAgentsExporter };
|
package/dist/agents.mjs
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/telemetry/constants.ts
|
|
3
|
+
const COST_SUMMARY_GROUP_BY = [
|
|
4
|
+
"day",
|
|
5
|
+
"hour",
|
|
6
|
+
"model",
|
|
7
|
+
"provider",
|
|
8
|
+
"endpoint",
|
|
9
|
+
"tags"
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
Object.defineProperty(exports, 'COST_SUMMARY_GROUP_BY', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return COST_SUMMARY_GROUP_BY;
|
|
17
|
+
}
|
|
18
|
+
});
|
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-vuQine9v.cjs";
|
|
2
|
+
import "./index-sjRozlIk.cjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-BHO7MEJx.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-Bn3NtzMO.mjs";
|
|
2
|
+
import "./index-C0CDqR9v.mjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-DVkfeg2W.mjs";
|
|
4
4
|
export { createLLMOpsMiddleware };
|
package/dist/express.mjs
CHANGED
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-vuQine9v.cjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-sjRozlIk.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-Bn3NtzMO.mjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-C0CDqR9v.mjs";
|
|
3
3
|
import { MiddlewareHandler } from "hono";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/hono/index.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter } from "./agents-exporter-
|
|
1
|
+
import { a as AgentsTracingExporter } from "./agents-exporter-Bn3NtzMO.mjs";
|
|
2
2
|
import { LLMOpsConfig, ValidatedLLMOpsConfig } from "@llmops/core";
|
|
3
3
|
|
|
4
4
|
//#region src/telemetry/langchain-client.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter } from "./agents-exporter-
|
|
1
|
+
import { a as AgentsTracingExporter } from "./agents-exporter-vuQine9v.cjs";
|
|
2
2
|
import { LLMOpsConfig, ValidatedLLMOpsConfig } from "@llmops/core";
|
|
3
3
|
|
|
4
4
|
//#region src/telemetry/langchain-client.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_express = require('./express-B-wbCza5.cjs');
|
|
2
2
|
const require_agents_exporter = require('./agents-exporter-BuTq2n2y.cjs');
|
|
3
|
+
const require_constants = require('./constants-BrB5eRjw.cjs');
|
|
3
4
|
let __llmops_core = require("@llmops/core");
|
|
4
5
|
let __llmops_app = require("@llmops/app");
|
|
5
6
|
|
|
@@ -229,14 +230,9 @@ function createLLMOpsSpanExporter(config) {
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
//#endregion
|
|
233
|
+
exports.COST_SUMMARY_GROUP_BY = require_constants.COST_SUMMARY_GROUP_BY;
|
|
232
234
|
exports.createLLMOpsAgentsExporter = require_agents_exporter.createLLMOpsAgentsExporter;
|
|
233
235
|
exports.createLLMOpsLangChainClient = createLLMOpsLangChainClient;
|
|
234
236
|
exports.createLLMOpsMiddleware = require_express.createLLMOpsMiddleware;
|
|
235
237
|
exports.createLLMOpsSpanExporter = createLLMOpsSpanExporter;
|
|
236
|
-
exports.llmops = createLLMOps;
|
|
237
|
-
Object.defineProperty(exports, 'pgStore', {
|
|
238
|
-
enumerable: true,
|
|
239
|
-
get: function () {
|
|
240
|
-
return __llmops_core.createPgStore;
|
|
241
|
-
}
|
|
242
|
-
});
|
|
238
|
+
exports.llmops = createLLMOps;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-
|
|
2
|
-
import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-
|
|
3
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
4
|
-
import {
|
|
1
|
+
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-vuQine9v.cjs";
|
|
2
|
+
import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-sjRozlIk.cjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-BHO7MEJx.cjs";
|
|
4
|
+
import { a as TraceUpsert, i as SpanInsert, n as LLMRequestInsert, o as COST_SUMMARY_GROUP_BY, r as SpanEventInsert, s as CostSummaryGroupBy, t as TelemetryStore } from "./interface-BbAwy96d.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/telemetry/exporter.d.ts
|
|
7
7
|
|
|
@@ -93,4 +93,4 @@ interface LLMOpsExporterConfig {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function createLLMOpsSpanExporter(config: LLMOpsExporterConfig): SpanExporter;
|
|
95
95
|
//#endregion
|
|
96
|
-
export { type AgentsTracingExporter, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, type LLMOpsLangChainClientConfig, type LangChainTracingClient, type ProviderOptions, type SpanExporter, type TelemetryStore, type TraceContext, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops
|
|
96
|
+
export { type AgentsTracingExporter, COST_SUMMARY_GROUP_BY, type CostSummaryGroupBy, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, type LLMOpsLangChainClientConfig, type LLMRequestInsert, type LangChainTracingClient, type ProviderOptions, type SpanEventInsert, type SpanExporter, type SpanInsert, type TelemetryStore, type TraceContext, type TraceUpsert, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-
|
|
2
|
-
import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-
|
|
3
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
4
|
-
import {
|
|
1
|
+
import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-Bn3NtzMO.mjs";
|
|
2
|
+
import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-C0CDqR9v.mjs";
|
|
3
|
+
import { t as createLLMOpsMiddleware } from "./index-DVkfeg2W.mjs";
|
|
4
|
+
import { a as TraceUpsert, i as SpanInsert, n as LLMRequestInsert, o as COST_SUMMARY_GROUP_BY, r as SpanEventInsert, s as CostSummaryGroupBy, t as TelemetryStore } from "./interface-Dz7B6QN1.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/telemetry/exporter.d.ts
|
|
7
7
|
|
|
@@ -93,4 +93,4 @@ interface LLMOpsExporterConfig {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function createLLMOpsSpanExporter(config: LLMOpsExporterConfig): SpanExporter;
|
|
95
95
|
//#endregion
|
|
96
|
-
export { type AgentsTracingExporter, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, type LLMOpsLangChainClientConfig, type LangChainTracingClient, type ProviderOptions, type SpanExporter, type TelemetryStore, type TraceContext, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops
|
|
96
|
+
export { type AgentsTracingExporter, COST_SUMMARY_GROUP_BY, type CostSummaryGroupBy, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, type LLMOpsLangChainClientConfig, type LLMRequestInsert, type LangChainTracingClient, type ProviderOptions, type SpanEventInsert, type SpanExporter, type SpanInsert, type TelemetryStore, type TraceContext, type TraceUpsert, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as createLLMOpsMiddleware } from "./express-
|
|
2
|
-
import { t as createLLMOpsAgentsExporter } from "./agents-exporter-
|
|
3
|
-
import {
|
|
1
|
+
import { t as createLLMOpsMiddleware } from "./express-Vt9JurUM.mjs";
|
|
2
|
+
import { t as createLLMOpsAgentsExporter } from "./agents-exporter-DYmMvLPS.mjs";
|
|
3
|
+
import { t as COST_SUMMARY_GROUP_BY } from "./constants-sHtPfi36.mjs";
|
|
4
|
+
import { LLMOPS_INTERNAL_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER } from "@llmops/core";
|
|
4
5
|
import { createApp } from "@llmops/app";
|
|
5
6
|
|
|
6
7
|
//#region src/telemetry/langchain-client.ts
|
|
@@ -229,4 +230,4 @@ function createLLMOpsSpanExporter(config) {
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
//#endregion
|
|
232
|
-
export { createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops
|
|
233
|
+
export { COST_SUMMARY_GROUP_BY, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/telemetry/constants.d.ts
|
|
4
|
+
declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
|
|
5
|
+
type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/telemetry/types.d.ts
|
|
8
|
+
|
|
9
|
+
declare const insertLLMRequestSchema: z.ZodObject<{
|
|
10
|
+
requestId: z.ZodString;
|
|
11
|
+
configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
provider: z.ZodString;
|
|
16
|
+
model: z.ZodString;
|
|
17
|
+
promptTokens: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
completionTokens: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
totalTokens: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
cachedTokens: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
cacheCreationTokens: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
cost: z.ZodDefault<z.ZodNumber>;
|
|
23
|
+
cacheSavings: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
inputCost: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
outputCost: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
endpoint: z.ZodString;
|
|
27
|
+
statusCode: z.ZodNumber;
|
|
28
|
+
latencyMs: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
isStreaming: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
tags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
32
|
+
guardrailResults: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
33
|
+
results: z.ZodArray<z.ZodObject<{
|
|
34
|
+
checkId: z.ZodString;
|
|
35
|
+
functionId: z.ZodString;
|
|
36
|
+
hookType: z.ZodEnum<{
|
|
37
|
+
beforeRequestHook: "beforeRequestHook";
|
|
38
|
+
afterRequestHook: "afterRequestHook";
|
|
39
|
+
}>;
|
|
40
|
+
verdict: z.ZodBoolean;
|
|
41
|
+
latencyMs: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
action: z.ZodEnum<{
|
|
44
|
+
allowed: "allowed";
|
|
45
|
+
blocked: "blocked";
|
|
46
|
+
logged: "logged";
|
|
47
|
+
}>;
|
|
48
|
+
totalLatencyMs: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
traceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
spanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
type LLMRequestInsert = z.infer<typeof insertLLMRequestSchema>;
|
|
56
|
+
declare const upsertTraceSchema: z.ZodObject<{
|
|
57
|
+
traceId: z.ZodString;
|
|
58
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
error: "error";
|
|
63
|
+
unset: "unset";
|
|
64
|
+
ok: "ok";
|
|
65
|
+
}>>;
|
|
66
|
+
startTime: z.ZodDate;
|
|
67
|
+
endTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
68
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
69
|
+
spanCount: z.ZodDefault<z.ZodNumber>;
|
|
70
|
+
totalInputTokens: z.ZodDefault<z.ZodNumber>;
|
|
71
|
+
totalOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
72
|
+
totalTokens: z.ZodDefault<z.ZodNumber>;
|
|
73
|
+
totalCost: z.ZodDefault<z.ZodNumber>;
|
|
74
|
+
tags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
75
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
type TraceUpsert = z.infer<typeof upsertTraceSchema>;
|
|
78
|
+
declare const insertSpanSchema: z.ZodObject<{
|
|
79
|
+
traceId: z.ZodString;
|
|
80
|
+
spanId: z.ZodString;
|
|
81
|
+
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
kind: z.ZodDefault<z.ZodNumber>;
|
|
84
|
+
status: z.ZodDefault<z.ZodNumber>;
|
|
85
|
+
statusMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
startTime: z.ZodDate;
|
|
87
|
+
endTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
88
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
89
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
promptTokens: z.ZodDefault<z.ZodNumber>;
|
|
92
|
+
completionTokens: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
totalTokens: z.ZodDefault<z.ZodNumber>;
|
|
94
|
+
cost: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
101
|
+
gateway: "gateway";
|
|
102
|
+
otlp: "otlp";
|
|
103
|
+
langsmith: "langsmith";
|
|
104
|
+
}>>;
|
|
105
|
+
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
106
|
+
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
107
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
type SpanInsert = z.infer<typeof insertSpanSchema>;
|
|
110
|
+
declare const insertSpanEventSchema: z.ZodObject<{
|
|
111
|
+
traceId: z.ZodString;
|
|
112
|
+
spanId: z.ZodString;
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
timestamp: z.ZodDate;
|
|
115
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
type SpanEventInsert = z.infer<typeof insertSpanEventSchema>;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/telemetry/interface.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* TelemetryStore provides read + write access to telemetry data.
|
|
122
|
+
* Implemented by pgStore, d1Store, and future store backends.
|
|
123
|
+
*/
|
|
124
|
+
interface TelemetryStore {
|
|
125
|
+
batchInsertRequests(requests: LLMRequestInsert[]): Promise<{
|
|
126
|
+
count: number;
|
|
127
|
+
}>;
|
|
128
|
+
insertRequest(request: LLMRequestInsert): Promise<unknown>;
|
|
129
|
+
listRequests(params?: {
|
|
130
|
+
limit?: number;
|
|
131
|
+
offset?: number;
|
|
132
|
+
configId?: string;
|
|
133
|
+
variantId?: string;
|
|
134
|
+
environmentId?: string;
|
|
135
|
+
providerConfigId?: string;
|
|
136
|
+
provider?: string;
|
|
137
|
+
model?: string;
|
|
138
|
+
startDate?: Date;
|
|
139
|
+
endDate?: Date;
|
|
140
|
+
tags?: Record<string, string[]>;
|
|
141
|
+
}): Promise<{
|
|
142
|
+
data: unknown[];
|
|
143
|
+
total: number;
|
|
144
|
+
limit: number;
|
|
145
|
+
offset: number;
|
|
146
|
+
}>;
|
|
147
|
+
getRequestByRequestId(requestId: string): Promise<unknown | undefined>;
|
|
148
|
+
getTotalCost(params: {
|
|
149
|
+
startDate: Date;
|
|
150
|
+
endDate: Date;
|
|
151
|
+
configId?: string;
|
|
152
|
+
variantId?: string;
|
|
153
|
+
environmentId?: string;
|
|
154
|
+
tags?: Record<string, string[]>;
|
|
155
|
+
}): Promise<unknown>;
|
|
156
|
+
getCostByModel(params: {
|
|
157
|
+
startDate: Date;
|
|
158
|
+
endDate: Date;
|
|
159
|
+
}): Promise<unknown[]>;
|
|
160
|
+
getCostByProvider(params: {
|
|
161
|
+
startDate: Date;
|
|
162
|
+
endDate: Date;
|
|
163
|
+
}): Promise<unknown[]>;
|
|
164
|
+
getDailyCosts(params: {
|
|
165
|
+
startDate: Date;
|
|
166
|
+
endDate: Date;
|
|
167
|
+
}): Promise<unknown[]>;
|
|
168
|
+
getCostSummary(params: {
|
|
169
|
+
startDate: Date;
|
|
170
|
+
endDate: Date;
|
|
171
|
+
configId?: string;
|
|
172
|
+
variantId?: string;
|
|
173
|
+
environmentId?: string;
|
|
174
|
+
groupBy?: CostSummaryGroupBy;
|
|
175
|
+
tags?: Record<string, string[]>;
|
|
176
|
+
tagKeys?: string[];
|
|
177
|
+
}): Promise<unknown[]>;
|
|
178
|
+
getRequestStats(params: {
|
|
179
|
+
startDate: Date;
|
|
180
|
+
endDate: Date;
|
|
181
|
+
configId?: string;
|
|
182
|
+
variantId?: string;
|
|
183
|
+
environmentId?: string;
|
|
184
|
+
tags?: Record<string, string[]>;
|
|
185
|
+
}): Promise<unknown>;
|
|
186
|
+
getDistinctTags(): Promise<unknown[]>;
|
|
187
|
+
upsertTrace(data: TraceUpsert): Promise<void>;
|
|
188
|
+
batchInsertSpans(spans: SpanInsert[]): Promise<{
|
|
189
|
+
count: number;
|
|
190
|
+
}>;
|
|
191
|
+
batchInsertSpanEvents(events: SpanEventInsert[]): Promise<{
|
|
192
|
+
count: number;
|
|
193
|
+
}>;
|
|
194
|
+
listTraces(params?: {
|
|
195
|
+
limit?: number;
|
|
196
|
+
offset?: number;
|
|
197
|
+
sessionId?: string;
|
|
198
|
+
userId?: string;
|
|
199
|
+
status?: string;
|
|
200
|
+
name?: string;
|
|
201
|
+
startDate?: Date;
|
|
202
|
+
endDate?: Date;
|
|
203
|
+
tags?: Record<string, string[]>;
|
|
204
|
+
}): Promise<{
|
|
205
|
+
data: unknown[];
|
|
206
|
+
total: number;
|
|
207
|
+
limit: number;
|
|
208
|
+
offset: number;
|
|
209
|
+
}>;
|
|
210
|
+
getTraceWithSpans(traceId: string): Promise<{
|
|
211
|
+
trace: unknown;
|
|
212
|
+
spans: unknown[];
|
|
213
|
+
events: unknown[];
|
|
214
|
+
} | undefined>;
|
|
215
|
+
getTraceStats(params: {
|
|
216
|
+
startDate: Date;
|
|
217
|
+
endDate: Date;
|
|
218
|
+
sessionId?: string;
|
|
219
|
+
userId?: string;
|
|
220
|
+
}): Promise<unknown>;
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
export { TraceUpsert as a, SpanInsert as i, LLMRequestInsert as n, COST_SUMMARY_GROUP_BY as o, SpanEventInsert as r, CostSummaryGroupBy as s, TelemetryStore as t };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/telemetry/constants.d.ts
|
|
4
|
+
declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
|
|
5
|
+
type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/telemetry/types.d.ts
|
|
8
|
+
|
|
9
|
+
declare const insertLLMRequestSchema: z.ZodObject<{
|
|
10
|
+
requestId: z.ZodString;
|
|
11
|
+
configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
provider: z.ZodString;
|
|
16
|
+
model: z.ZodString;
|
|
17
|
+
promptTokens: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
completionTokens: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
totalTokens: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
cachedTokens: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
cacheCreationTokens: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
cost: z.ZodDefault<z.ZodNumber>;
|
|
23
|
+
cacheSavings: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
inputCost: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
outputCost: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
endpoint: z.ZodString;
|
|
27
|
+
statusCode: z.ZodNumber;
|
|
28
|
+
latencyMs: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
isStreaming: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
tags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
32
|
+
guardrailResults: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
33
|
+
results: z.ZodArray<z.ZodObject<{
|
|
34
|
+
checkId: z.ZodString;
|
|
35
|
+
functionId: z.ZodString;
|
|
36
|
+
hookType: z.ZodEnum<{
|
|
37
|
+
beforeRequestHook: "beforeRequestHook";
|
|
38
|
+
afterRequestHook: "afterRequestHook";
|
|
39
|
+
}>;
|
|
40
|
+
verdict: z.ZodBoolean;
|
|
41
|
+
latencyMs: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
action: z.ZodEnum<{
|
|
44
|
+
allowed: "allowed";
|
|
45
|
+
blocked: "blocked";
|
|
46
|
+
logged: "logged";
|
|
47
|
+
}>;
|
|
48
|
+
totalLatencyMs: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
traceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
spanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
type LLMRequestInsert = z.infer<typeof insertLLMRequestSchema>;
|
|
56
|
+
declare const upsertTraceSchema: z.ZodObject<{
|
|
57
|
+
traceId: z.ZodString;
|
|
58
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
error: "error";
|
|
63
|
+
unset: "unset";
|
|
64
|
+
ok: "ok";
|
|
65
|
+
}>>;
|
|
66
|
+
startTime: z.ZodDate;
|
|
67
|
+
endTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
68
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
69
|
+
spanCount: z.ZodDefault<z.ZodNumber>;
|
|
70
|
+
totalInputTokens: z.ZodDefault<z.ZodNumber>;
|
|
71
|
+
totalOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
72
|
+
totalTokens: z.ZodDefault<z.ZodNumber>;
|
|
73
|
+
totalCost: z.ZodDefault<z.ZodNumber>;
|
|
74
|
+
tags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
75
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
type TraceUpsert = z.infer<typeof upsertTraceSchema>;
|
|
78
|
+
declare const insertSpanSchema: z.ZodObject<{
|
|
79
|
+
traceId: z.ZodString;
|
|
80
|
+
spanId: z.ZodString;
|
|
81
|
+
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
kind: z.ZodDefault<z.ZodNumber>;
|
|
84
|
+
status: z.ZodDefault<z.ZodNumber>;
|
|
85
|
+
statusMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
startTime: z.ZodDate;
|
|
87
|
+
endTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
88
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
89
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
promptTokens: z.ZodDefault<z.ZodNumber>;
|
|
92
|
+
completionTokens: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
totalTokens: z.ZodDefault<z.ZodNumber>;
|
|
94
|
+
cost: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
101
|
+
gateway: "gateway";
|
|
102
|
+
otlp: "otlp";
|
|
103
|
+
langsmith: "langsmith";
|
|
104
|
+
}>>;
|
|
105
|
+
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
106
|
+
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
107
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
type SpanInsert = z.infer<typeof insertSpanSchema>;
|
|
110
|
+
declare const insertSpanEventSchema: z.ZodObject<{
|
|
111
|
+
traceId: z.ZodString;
|
|
112
|
+
spanId: z.ZodString;
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
timestamp: z.ZodDate;
|
|
115
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
type SpanEventInsert = z.infer<typeof insertSpanEventSchema>;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/telemetry/interface.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* TelemetryStore provides read + write access to telemetry data.
|
|
122
|
+
* Implemented by pgStore, d1Store, and future store backends.
|
|
123
|
+
*/
|
|
124
|
+
interface TelemetryStore {
|
|
125
|
+
batchInsertRequests(requests: LLMRequestInsert[]): Promise<{
|
|
126
|
+
count: number;
|
|
127
|
+
}>;
|
|
128
|
+
insertRequest(request: LLMRequestInsert): Promise<unknown>;
|
|
129
|
+
listRequests(params?: {
|
|
130
|
+
limit?: number;
|
|
131
|
+
offset?: number;
|
|
132
|
+
configId?: string;
|
|
133
|
+
variantId?: string;
|
|
134
|
+
environmentId?: string;
|
|
135
|
+
providerConfigId?: string;
|
|
136
|
+
provider?: string;
|
|
137
|
+
model?: string;
|
|
138
|
+
startDate?: Date;
|
|
139
|
+
endDate?: Date;
|
|
140
|
+
tags?: Record<string, string[]>;
|
|
141
|
+
}): Promise<{
|
|
142
|
+
data: unknown[];
|
|
143
|
+
total: number;
|
|
144
|
+
limit: number;
|
|
145
|
+
offset: number;
|
|
146
|
+
}>;
|
|
147
|
+
getRequestByRequestId(requestId: string): Promise<unknown | undefined>;
|
|
148
|
+
getTotalCost(params: {
|
|
149
|
+
startDate: Date;
|
|
150
|
+
endDate: Date;
|
|
151
|
+
configId?: string;
|
|
152
|
+
variantId?: string;
|
|
153
|
+
environmentId?: string;
|
|
154
|
+
tags?: Record<string, string[]>;
|
|
155
|
+
}): Promise<unknown>;
|
|
156
|
+
getCostByModel(params: {
|
|
157
|
+
startDate: Date;
|
|
158
|
+
endDate: Date;
|
|
159
|
+
}): Promise<unknown[]>;
|
|
160
|
+
getCostByProvider(params: {
|
|
161
|
+
startDate: Date;
|
|
162
|
+
endDate: Date;
|
|
163
|
+
}): Promise<unknown[]>;
|
|
164
|
+
getDailyCosts(params: {
|
|
165
|
+
startDate: Date;
|
|
166
|
+
endDate: Date;
|
|
167
|
+
}): Promise<unknown[]>;
|
|
168
|
+
getCostSummary(params: {
|
|
169
|
+
startDate: Date;
|
|
170
|
+
endDate: Date;
|
|
171
|
+
configId?: string;
|
|
172
|
+
variantId?: string;
|
|
173
|
+
environmentId?: string;
|
|
174
|
+
groupBy?: CostSummaryGroupBy;
|
|
175
|
+
tags?: Record<string, string[]>;
|
|
176
|
+
tagKeys?: string[];
|
|
177
|
+
}): Promise<unknown[]>;
|
|
178
|
+
getRequestStats(params: {
|
|
179
|
+
startDate: Date;
|
|
180
|
+
endDate: Date;
|
|
181
|
+
configId?: string;
|
|
182
|
+
variantId?: string;
|
|
183
|
+
environmentId?: string;
|
|
184
|
+
tags?: Record<string, string[]>;
|
|
185
|
+
}): Promise<unknown>;
|
|
186
|
+
getDistinctTags(): Promise<unknown[]>;
|
|
187
|
+
upsertTrace(data: TraceUpsert): Promise<void>;
|
|
188
|
+
batchInsertSpans(spans: SpanInsert[]): Promise<{
|
|
189
|
+
count: number;
|
|
190
|
+
}>;
|
|
191
|
+
batchInsertSpanEvents(events: SpanEventInsert[]): Promise<{
|
|
192
|
+
count: number;
|
|
193
|
+
}>;
|
|
194
|
+
listTraces(params?: {
|
|
195
|
+
limit?: number;
|
|
196
|
+
offset?: number;
|
|
197
|
+
sessionId?: string;
|
|
198
|
+
userId?: string;
|
|
199
|
+
status?: string;
|
|
200
|
+
name?: string;
|
|
201
|
+
startDate?: Date;
|
|
202
|
+
endDate?: Date;
|
|
203
|
+
tags?: Record<string, string[]>;
|
|
204
|
+
}): Promise<{
|
|
205
|
+
data: unknown[];
|
|
206
|
+
total: number;
|
|
207
|
+
limit: number;
|
|
208
|
+
offset: number;
|
|
209
|
+
}>;
|
|
210
|
+
getTraceWithSpans(traceId: string): Promise<{
|
|
211
|
+
trace: unknown;
|
|
212
|
+
spans: unknown[];
|
|
213
|
+
events: unknown[];
|
|
214
|
+
} | undefined>;
|
|
215
|
+
getTraceStats(params: {
|
|
216
|
+
startDate: Date;
|
|
217
|
+
endDate: Date;
|
|
218
|
+
sessionId?: string;
|
|
219
|
+
userId?: string;
|
|
220
|
+
}): Promise<unknown>;
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
export { TraceUpsert as a, SpanInsert as i, LLMRequestInsert as n, COST_SUMMARY_GROUP_BY as o, SpanEventInsert as r, CostSummaryGroupBy as s, TelemetryStore as t };
|
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-vuQine9v.cjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-sjRozlIk.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-Bn3NtzMO.mjs";
|
|
2
|
+
import { t as LLMOpsClient } from "./index-C0CDqR9v.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/nextjs/index.d.ts
|
|
5
5
|
declare function toNextJsHandler(client: LLMOpsClient): {
|