@llmops/sdk 1.0.0-beta.8 → 1.0.0-beta.9

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.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_agents_exporter = require('./agents-exporter-CEbQkds8.cjs');
1
+ const require_agents_exporter = require('./agents-exporter-BuTq2n2y.cjs');
2
2
 
3
3
  exports.createLLMOpsAgentsExporter = require_agents_exporter.createLLMOpsAgentsExporter;
package/dist/agents.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as createLLMOpsAgentsExporter } from "./agents-exporter-CGxTzDeQ.mjs";
1
+ import { t as createLLMOpsAgentsExporter } from "./agents-exporter-DYmMvLPS.mjs";
2
2
 
3
3
  export { createLLMOpsAgentsExporter };
@@ -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
+ });
@@ -0,0 +1,12 @@
1
+ //#region src/telemetry/constants.ts
2
+ const COST_SUMMARY_GROUP_BY = [
3
+ "day",
4
+ "hour",
5
+ "model",
6
+ "provider",
7
+ "endpoint",
8
+ "tags"
9
+ ];
10
+
11
+ //#endregion
12
+ export { COST_SUMMARY_GROUP_BY as t };
package/dist/express.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_express = require('./express-D-Nfc61h.cjs');
1
+ const require_express = require('./express-B-wbCza5.cjs');
2
2
 
3
3
  exports.createLLMOpsMiddleware = require_express.createLLMOpsMiddleware;
package/dist/express.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as createLLMOpsMiddleware } from "./express-ClNV0OG9.mjs";
1
+ import { t as createLLMOpsMiddleware } from "./express-Vt9JurUM.mjs";
2
2
 
3
3
  export { createLLMOpsMiddleware };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- const require_types = require('./types-uIsMdtuF.cjs');
2
- const require_express = require('./express-D-Nfc61h.cjs');
3
- const require_agents_exporter = require('./agents-exporter-CEbQkds8.cjs');
1
+ const require_express = require('./express-B-wbCza5.cjs');
2
+ const require_agents_exporter = require('./agents-exporter-BuTq2n2y.cjs');
3
+ const require_constants = require('./constants-BrB5eRjw.cjs');
4
4
  let __llmops_core = require("@llmops/core");
5
5
  let __llmops_app = require("@llmops/app");
6
6
 
@@ -230,7 +230,7 @@ function createLLMOpsSpanExporter(config) {
230
230
  }
231
231
 
232
232
  //#endregion
233
- exports.COST_SUMMARY_GROUP_BY = require_types.COST_SUMMARY_GROUP_BY;
233
+ exports.COST_SUMMARY_GROUP_BY = require_constants.COST_SUMMARY_GROUP_BY;
234
234
  exports.createLLMOpsAgentsExporter = require_agents_exporter.createLLMOpsAgentsExporter;
235
235
  exports.createLLMOpsLangChainClient = createLLMOpsLangChainClient;
236
236
  exports.createLLMOpsMiddleware = require_express.createLLMOpsMiddleware;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-vuQine9v.cjs";
2
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
3
  import { t as createLLMOpsMiddleware } from "./index-BHO7MEJx.cjs";
4
- import { a as SpanEventInsert, i as LLMRequestInsert, n as COST_SUMMARY_GROUP_BY, o as SpanInsert, r as CostSummaryGroupBy, s as TraceUpsert, t as TelemetryStore } from "./interface-SBcQ5H-b.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
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-Bn3NtzMO.mjs";
2
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
3
  import { t as createLLMOpsMiddleware } from "./index-DVkfeg2W.mjs";
4
- import { a as SpanEventInsert, i as LLMRequestInsert, n as COST_SUMMARY_GROUP_BY, o as SpanInsert, r as CostSummaryGroupBy, s as TraceUpsert, t as TelemetryStore } from "./interface-CNLmcugg.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
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { t as COST_SUMMARY_GROUP_BY } from "./types-BerUVJ45.mjs";
2
- import { t as createLLMOpsMiddleware } from "./express-ClNV0OG9.mjs";
3
- import { t as createLLMOpsAgentsExporter } from "./agents-exporter-CGxTzDeQ.mjs";
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
4
  import { LLMOPS_INTERNAL_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER } from "@llmops/core";
5
5
  import { createApp } from "@llmops/app";
6
6
 
@@ -1,5 +1,9 @@
1
1
  import z from "zod";
2
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
3
7
  //#region src/telemetry/types.d.ts
4
8
 
5
9
  declare const insertLLMRequestSchema: z.ZodObject<{
@@ -49,8 +53,6 @@ declare const insertLLMRequestSchema: z.ZodObject<{
49
53
  sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
54
  }, z.core.$strip>;
51
55
  type LLMRequestInsert = z.infer<typeof insertLLMRequestSchema>;
52
- declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
53
- type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
54
56
  declare const upsertTraceSchema: z.ZodObject<{
55
57
  traceId: z.ZodString;
56
58
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -218,4 +220,4 @@ interface TelemetryStore {
218
220
  }): Promise<unknown>;
219
221
  }
220
222
  //#endregion
221
- export { SpanEventInsert as a, LLMRequestInsert as i, COST_SUMMARY_GROUP_BY as n, SpanInsert as o, CostSummaryGroupBy as r, TraceUpsert as s, TelemetryStore as t };
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 };
@@ -1,5 +1,9 @@
1
1
  import z from "zod";
2
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
3
7
  //#region src/telemetry/types.d.ts
4
8
 
5
9
  declare const insertLLMRequestSchema: z.ZodObject<{
@@ -49,8 +53,6 @@ declare const insertLLMRequestSchema: z.ZodObject<{
49
53
  sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
54
  }, z.core.$strip>;
51
55
  type LLMRequestInsert = z.infer<typeof insertLLMRequestSchema>;
52
- declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
53
- type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
54
56
  declare const upsertTraceSchema: z.ZodObject<{
55
57
  traceId: z.ZodString;
56
58
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -218,4 +220,4 @@ interface TelemetryStore {
218
220
  }): Promise<unknown>;
219
221
  }
220
222
  //#endregion
221
- export { SpanEventInsert as a, LLMRequestInsert as i, COST_SUMMARY_GROUP_BY as n, SpanInsert as o, CostSummaryGroupBy as r, TraceUpsert as s, TelemetryStore as t };
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 };
@@ -1,6 +1,54 @@
1
- import "../interface-SBcQ5H-b.cjs";
2
- import { n as createD1Store, r as D1Database, t as D1Store } from "../d1-store-Pbuwjx6D.cjs";
1
+ import { t as TelemetryStore } from "../interface-BbAwy96d.cjs";
3
2
 
3
+ //#region src/store/d1/types.d.ts
4
+
5
+ /**
6
+ * Minimal D1Database type interface.
7
+ * Avoids depending on @cloudflare/workers-types (10MB+).
8
+ * Users pass their actual D1 binding which satisfies this structurally.
9
+ */
10
+ interface D1Database {
11
+ prepare(query: string): D1PreparedStatement;
12
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
13
+ }
14
+ interface D1PreparedStatement {
15
+ bind(...values: unknown[]): D1PreparedStatement;
16
+ first<T = unknown>(colName?: string): Promise<T | null>;
17
+ all<T = unknown>(): Promise<D1Result<T>>;
18
+ run(): Promise<D1Result>;
19
+ }
20
+ interface D1Result<T = unknown> {
21
+ results: T[];
22
+ success: boolean;
23
+ meta: {
24
+ changes: number;
25
+ duration: number;
26
+ last_row_id: number;
27
+ };
28
+ }
29
+ //#endregion
30
+ //#region src/store/d1/d1-store.d.ts
31
+ type D1Store = TelemetryStore & {
32
+ _db: D1Database;
33
+ };
34
+ /**
35
+ * Create a Cloudflare D1-backed telemetry store.
36
+ *
37
+ * Usage:
38
+ * ```ts
39
+ * import { d1Store } from '@llmops/sdk/store/d1'
40
+ *
41
+ * export default {
42
+ * async fetch(request, env) {
43
+ * const ops = llmops({
44
+ * telemetry: d1Store(env.DB),
45
+ * })
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ declare function createD1Store(db: D1Database): D1Store;
51
+ //#endregion
4
52
  //#region src/store/d1/migrate.d.ts
5
53
  /**
6
54
  * Run pending migrations against a D1 database.
@@ -1,6 +1,54 @@
1
- import "../interface-CNLmcugg.mjs";
2
- import { n as createD1Store, r as D1Database, t as D1Store } from "../d1-store-DC1FMAzk.mjs";
1
+ import { t as TelemetryStore } from "../interface-Dz7B6QN1.mjs";
3
2
 
3
+ //#region src/store/d1/types.d.ts
4
+
5
+ /**
6
+ * Minimal D1Database type interface.
7
+ * Avoids depending on @cloudflare/workers-types (10MB+).
8
+ * Users pass their actual D1 binding which satisfies this structurally.
9
+ */
10
+ interface D1Database {
11
+ prepare(query: string): D1PreparedStatement;
12
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
13
+ }
14
+ interface D1PreparedStatement {
15
+ bind(...values: unknown[]): D1PreparedStatement;
16
+ first<T = unknown>(colName?: string): Promise<T | null>;
17
+ all<T = unknown>(): Promise<D1Result<T>>;
18
+ run(): Promise<D1Result>;
19
+ }
20
+ interface D1Result<T = unknown> {
21
+ results: T[];
22
+ success: boolean;
23
+ meta: {
24
+ changes: number;
25
+ duration: number;
26
+ last_row_id: number;
27
+ };
28
+ }
29
+ //#endregion
30
+ //#region src/store/d1/d1-store.d.ts
31
+ type D1Store = TelemetryStore & {
32
+ _db: D1Database;
33
+ };
34
+ /**
35
+ * Create a Cloudflare D1-backed telemetry store.
36
+ *
37
+ * Usage:
38
+ * ```ts
39
+ * import { d1Store } from '@llmops/sdk/store/d1'
40
+ *
41
+ * export default {
42
+ * async fetch(request, env) {
43
+ * const ops = llmops({
44
+ * telemetry: d1Store(env.DB),
45
+ * })
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ declare function createD1Store(db: D1Database): D1Store;
51
+ //#endregion
4
52
  //#region src/store/d1/migrate.d.ts
5
53
  /**
6
54
  * Run pending migrations against a D1 database.