@llmops/sdk 1.0.0-beta.7 → 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_pg_store = require('./pg-store-uawkO2hJ.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,10 +230,9 @@ function createLLMOpsSpanExporter(config) {
230
230
  }
231
231
 
232
232
  //#endregion
233
- exports.COST_SUMMARY_GROUP_BY = require_pg_store.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;
237
237
  exports.createLLMOpsSpanExporter = createLLMOpsSpanExporter;
238
- exports.llmops = createLLMOps;
239
- exports.pgStore = require_pg_store.createPgStore;
238
+ exports.llmops = createLLMOps;
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 PgStore, c as TraceUpsert, i as LLMRequestInsert, l as createPgStore, n as COST_SUMMARY_GROUP_BY, o as SpanEventInsert, r as CostSummaryGroupBy, s as SpanInsert, t as TelemetryStore } from "./interface-DMuF7YgM.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, COST_SUMMARY_GROUP_BY, type CostSummaryGroupBy, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, type LLMOpsLangChainClientConfig, type LLMRequestInsert, type LangChainTracingClient, type PgStore, type ProviderOptions, type SpanEventInsert, type SpanExporter, type SpanInsert, type TelemetryStore, type TraceContext, type TraceUpsert, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops, createPgStore as pgStore };
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
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 PgStore, c as TraceUpsert, i as LLMRequestInsert, l as createPgStore, n as COST_SUMMARY_GROUP_BY, o as SpanEventInsert, r as CostSummaryGroupBy, s as SpanInsert, t as TelemetryStore } from "./interface-BrJMazBg.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, COST_SUMMARY_GROUP_BY, type CostSummaryGroupBy, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, type LLMOpsLangChainClientConfig, type LLMRequestInsert, type LangChainTracingClient, type PgStore, type ProviderOptions, type SpanEventInsert, type SpanExporter, type SpanInsert, type TelemetryStore, type TraceContext, type TraceUpsert, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops, createPgStore as pgStore };
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,6 @@
1
- import { n as createPgStore, t as COST_SUMMARY_GROUP_BY } from "./pg-store-sIMdF_Pc.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
 
@@ -230,4 +230,4 @@ function createLLMOpsSpanExporter(config) {
230
230
  }
231
231
 
232
232
  //#endregion
233
- export { COST_SUMMARY_GROUP_BY, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops, createPgStore as pgStore };
233
+ export { COST_SUMMARY_GROUP_BY, createLLMOpsAgentsExporter, createLLMOpsLangChainClient, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops };
@@ -1,6 +1,11 @@
1
1
  import z from "zod";
2
2
 
3
- //#region src/telemetry/pg-store.d.ts
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
+
4
9
  declare const insertLLMRequestSchema: z.ZodObject<{
5
10
  requestId: z.ZodString;
6
11
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -48,8 +53,6 @@ declare const insertLLMRequestSchema: z.ZodObject<{
48
53
  sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
54
  }, z.core.$strip>;
50
55
  type LLMRequestInsert = z.infer<typeof insertLLMRequestSchema>;
51
- declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
52
- type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
53
56
  declare const upsertTraceSchema: z.ZodObject<{
54
57
  traceId: z.ZodString;
55
58
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -112,26 +115,6 @@ declare const insertSpanEventSchema: z.ZodObject<{
112
115
  attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
113
116
  }, z.core.$strip>;
114
117
  type SpanEventInsert = z.infer<typeof insertSpanEventSchema>;
115
- type PgStore = TelemetryStore & {
116
- _pool: unknown;
117
- _schema: string;
118
- };
119
- /**
120
- * Create a PostgreSQL-backed telemetry store.
121
- *
122
- * Usage:
123
- * ```ts
124
- * import { llmops } from '@llmops/sdk'
125
- * import { pgStore } from '@llmops/sdk/store/pg'
126
- *
127
- * const ops = llmops({
128
- * telemetry: pgStore(process.env.DATABASE_URL),
129
- * })
130
- * ```
131
- */
132
- declare function createPgStore(connectionString: string, options?: {
133
- schema?: string;
134
- }): PgStore;
135
118
  //#endregion
136
119
  //#region src/telemetry/interface.d.ts
137
120
  /**
@@ -237,4 +220,4 @@ interface TelemetryStore {
237
220
  }): Promise<unknown>;
238
221
  }
239
222
  //#endregion
240
- export { PgStore as a, TraceUpsert as c, LLMRequestInsert as i, createPgStore as l, COST_SUMMARY_GROUP_BY as n, SpanEventInsert as o, CostSummaryGroupBy as r, SpanInsert 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,11 @@
1
1
  import z from "zod";
2
2
 
3
- //#region src/telemetry/pg-store.d.ts
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
+
4
9
  declare const insertLLMRequestSchema: z.ZodObject<{
5
10
  requestId: z.ZodString;
6
11
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -48,8 +53,6 @@ declare const insertLLMRequestSchema: z.ZodObject<{
48
53
  sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
54
  }, z.core.$strip>;
50
55
  type LLMRequestInsert = z.infer<typeof insertLLMRequestSchema>;
51
- declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
52
- type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
53
56
  declare const upsertTraceSchema: z.ZodObject<{
54
57
  traceId: z.ZodString;
55
58
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -112,26 +115,6 @@ declare const insertSpanEventSchema: z.ZodObject<{
112
115
  attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
113
116
  }, z.core.$strip>;
114
117
  type SpanEventInsert = z.infer<typeof insertSpanEventSchema>;
115
- type PgStore = TelemetryStore & {
116
- _pool: unknown;
117
- _schema: string;
118
- };
119
- /**
120
- * Create a PostgreSQL-backed telemetry store.
121
- *
122
- * Usage:
123
- * ```ts
124
- * import { llmops } from '@llmops/sdk'
125
- * import { pgStore } from '@llmops/sdk/store/pg'
126
- *
127
- * const ops = llmops({
128
- * telemetry: pgStore(process.env.DATABASE_URL),
129
- * })
130
- * ```
131
- */
132
- declare function createPgStore(connectionString: string, options?: {
133
- schema?: string;
134
- }): PgStore;
135
118
  //#endregion
136
119
  //#region src/telemetry/interface.d.ts
137
120
  /**
@@ -237,4 +220,4 @@ interface TelemetryStore {
237
220
  }): Promise<unknown>;
238
221
  }
239
222
  //#endregion
240
- export { PgStore as a, TraceUpsert as c, LLMRequestInsert as i, createPgStore as l, COST_SUMMARY_GROUP_BY as n, SpanEventInsert as o, CostSummaryGroupBy as r, SpanInsert 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-DMuF7YgM.cjs";
2
- import { n as createD1Store, r as D1Database, t as D1Store } from "../d1-store-D664VLg0.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-BrJMazBg.mjs";
2
- import { n as createD1Store, r as D1Database, t as D1Store } from "../d1-store-DBf99oU8.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.