@llmops/core 0.3.2-beta.3 → 0.3.3

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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as environmentsSchema, A as GuardrailResults, B as TableName, C as Environment, D as GuardrailConfig, E as EnvironmentsTable, F as ProviderConfigsTable, G as VariantVersion, H as TargetingRulesTable, I as ProviderGuardrailOverride, J as WorkspaceSettings, K as VariantVersionsTable, L as ProviderGuardrailOverridesTable, M as LLMRequest, N as LLMRequestsTable, O as GuardrailConfigsTable, P as ProviderConfig, Q as environmentSecretsSchema, R as SCHEMA_METADATA, S as Database, T as EnvironmentSecretsTable, U as Updateable, V as TargetingRule, W as Variant, X as configVariantsSchema, Y as WorkspaceSettingsTable, Z as configsSchema, _ as validateTableData, a as createDatabaseFromConnection, at as targetingRulesSchema, b as ConfigVariantsTable, c as executeWithSchema, ct as workspaceSettingsSchema, d as getMigrations, et as guardrailConfigsSchema, f as matchType, g as validatePartialTableData, h as parseTableData, i as createDatabase, it as schemas, j as Insertable, k as GuardrailResult, l as MigrationOptions, m as parsePartialTableData, n as DatabaseOptions, nt as providerConfigsSchema, o as detectDatabaseType, ot as variantVersionsSchema, p as runAutoMigrations, q as VariantsTable, r as DatabaseType, rt as providerGuardrailOverridesSchema, s as createNeonDialect, st as variantsSchema, t as DatabaseConnection, tt as llmRequestsSchema, u as MigrationResult, v as Config, w as EnvironmentSecret, x as ConfigsTable, y as ConfigVariant, z as Selectable } from "./index-DhVBYci7.mjs";
1
+ import { $ as environmentsSchema, A as GuardrailResults, B as TableName, C as Environment, D as GuardrailConfig, E as EnvironmentsTable, F as ProviderConfigsTable, G as VariantVersion, H as TargetingRulesTable, I as ProviderGuardrailOverride, J as WorkspaceSettings, K as VariantVersionsTable, L as ProviderGuardrailOverridesTable, M as LLMRequest, N as LLMRequestsTable, O as GuardrailConfigsTable, P as ProviderConfig, Q as environmentSecretsSchema, R as SCHEMA_METADATA, S as Database, T as EnvironmentSecretsTable, U as Updateable, V as TargetingRule, W as Variant, X as configVariantsSchema, Y as WorkspaceSettingsTable, Z as configsSchema, _ as validateTableData, a as createDatabaseFromConnection, at as targetingRulesSchema, b as ConfigVariantsTable, c as executeWithSchema, ct as workspaceSettingsSchema, d as getMigrations, et as guardrailConfigsSchema, f as matchType, g as validatePartialTableData, h as parseTableData, i as createDatabase, it as schemas, j as Insertable, k as GuardrailResult, l as MigrationOptions, m as parsePartialTableData, n as DatabaseOptions, nt as providerConfigsSchema, o as detectDatabaseType, ot as variantVersionsSchema, p as runAutoMigrations, q as VariantsTable, r as DatabaseType, rt as providerGuardrailOverridesSchema, s as createNeonDialect, st as variantsSchema, t as DatabaseConnection, tt as llmRequestsSchema, u as MigrationResult, v as Config, w as EnvironmentSecret, x as ConfigsTable, y as ConfigVariant, z as Selectable } from "./index-yuxB_8bc.mjs";
2
2
  import gateway from "@llmops/gateway";
3
3
  import * as kysely0 from "kysely";
4
4
  import { Kysely } from "kysely";
@@ -1091,6 +1091,24 @@ declare const insertLLMRequestSchema: z$1.ZodObject<{
1091
1091
  isStreaming: z$1.ZodDefault<z$1.ZodBoolean>;
1092
1092
  userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1093
1093
  tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1094
+ guardrailResults: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
1095
+ results: z$1.ZodArray<z$1.ZodObject<{
1096
+ checkId: z$1.ZodString;
1097
+ functionId: z$1.ZodString;
1098
+ hookType: z$1.ZodEnum<{
1099
+ beforeRequestHook: "beforeRequestHook";
1100
+ afterRequestHook: "afterRequestHook";
1101
+ }>;
1102
+ verdict: z$1.ZodBoolean;
1103
+ latencyMs: z$1.ZodNumber;
1104
+ }, z$1.core.$strip>>;
1105
+ action: z$1.ZodEnum<{
1106
+ allowed: "allowed";
1107
+ blocked: "blocked";
1108
+ logged: "logged";
1109
+ }>;
1110
+ totalLatencyMs: z$1.ZodNumber;
1111
+ }, z$1.core.$strip>>>;
1094
1112
  }, z$1.core.$strip>;
1095
1113
  type LLMRequestInsert = z$1.infer<typeof insertLLMRequestSchema>;
1096
1114
  /**
@@ -1171,11 +1189,9 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1171
1189
  isStreaming: boolean;
1172
1190
  userId: string | null;
1173
1191
  tags: Record<string, string>;
1174
- createdAt: Date;
1175
- updatedAt: Date;
1176
1192
  guardrailResults: {
1177
1193
  results: {
1178
- configId: string;
1194
+ checkId: string;
1179
1195
  functionId: string;
1180
1196
  hookType: "beforeRequestHook" | "afterRequestHook";
1181
1197
  verdict: boolean;
@@ -1184,6 +1200,8 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1184
1200
  action: "allowed" | "blocked" | "logged";
1185
1201
  totalLatencyMs: number;
1186
1202
  } | null;
1203
+ createdAt: Date;
1204
+ updatedAt: Date;
1187
1205
  } | undefined>;
1188
1206
  /**
1189
1207
  * List LLM requests with filtering and pagination
@@ -1212,11 +1230,9 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1212
1230
  isStreaming: boolean;
1213
1231
  userId: string | null;
1214
1232
  tags: Record<string, string>;
1215
- createdAt: Date;
1216
- updatedAt: Date;
1217
1233
  guardrailResults: {
1218
1234
  results: {
1219
- configId: string;
1235
+ checkId: string;
1220
1236
  functionId: string;
1221
1237
  hookType: "beforeRequestHook" | "afterRequestHook";
1222
1238
  verdict: boolean;
@@ -1225,6 +1241,8 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1225
1241
  action: "allowed" | "blocked" | "logged";
1226
1242
  totalLatencyMs: number;
1227
1243
  } | null;
1244
+ createdAt: Date;
1245
+ updatedAt: Date;
1228
1246
  }[];
1229
1247
  total: number;
1230
1248
  limit: number;
@@ -1255,11 +1273,9 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1255
1273
  isStreaming: boolean;
1256
1274
  userId: string | null;
1257
1275
  tags: Record<string, string>;
1258
- createdAt: Date;
1259
- updatedAt: Date;
1260
1276
  guardrailResults: {
1261
1277
  results: {
1262
- configId: string;
1278
+ checkId: string;
1263
1279
  functionId: string;
1264
1280
  hookType: "beforeRequestHook" | "afterRequestHook";
1265
1281
  verdict: boolean;
@@ -1268,6 +1284,8 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1268
1284
  action: "allowed" | "blocked" | "logged";
1269
1285
  totalLatencyMs: number;
1270
1286
  } | null;
1287
+ createdAt: Date;
1288
+ updatedAt: Date;
1271
1289
  } | undefined>;
1272
1290
  /**
1273
1291
  * Get total cost for a date range with optional filters
@@ -2453,11 +2471,9 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2453
2471
  isStreaming: boolean;
2454
2472
  userId: string | null;
2455
2473
  tags: Record<string, string>;
2456
- createdAt: Date;
2457
- updatedAt: Date;
2458
2474
  guardrailResults: {
2459
2475
  results: {
2460
- configId: string;
2476
+ checkId: string;
2461
2477
  functionId: string;
2462
2478
  hookType: "beforeRequestHook" | "afterRequestHook";
2463
2479
  verdict: boolean;
@@ -2466,6 +2482,8 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2466
2482
  action: "allowed" | "blocked" | "logged";
2467
2483
  totalLatencyMs: number;
2468
2484
  } | null;
2485
+ createdAt: Date;
2486
+ updatedAt: Date;
2469
2487
  } | undefined>;
2470
2488
  listRequests: (params?: zod0.infer<zod0.ZodObject<{
2471
2489
  limit: zod0.ZodDefault<zod0.ZodNumber>;
@@ -2502,11 +2520,9 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2502
2520
  isStreaming: boolean;
2503
2521
  userId: string | null;
2504
2522
  tags: Record<string, string>;
2505
- createdAt: Date;
2506
- updatedAt: Date;
2507
2523
  guardrailResults: {
2508
2524
  results: {
2509
- configId: string;
2525
+ checkId: string;
2510
2526
  functionId: string;
2511
2527
  hookType: "beforeRequestHook" | "afterRequestHook";
2512
2528
  verdict: boolean;
@@ -2515,6 +2531,8 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2515
2531
  action: "allowed" | "blocked" | "logged";
2516
2532
  totalLatencyMs: number;
2517
2533
  } | null;
2534
+ createdAt: Date;
2535
+ updatedAt: Date;
2518
2536
  }[];
2519
2537
  total: number;
2520
2538
  limit: number;
@@ -2542,11 +2560,9 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2542
2560
  isStreaming: boolean;
2543
2561
  userId: string | null;
2544
2562
  tags: Record<string, string>;
2545
- createdAt: Date;
2546
- updatedAt: Date;
2547
2563
  guardrailResults: {
2548
2564
  results: {
2549
- configId: string;
2565
+ checkId: string;
2550
2566
  functionId: string;
2551
2567
  hookType: "beforeRequestHook" | "afterRequestHook";
2552
2568
  verdict: boolean;
@@ -2555,6 +2571,8 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2555
2571
  action: "allowed" | "blocked" | "logged";
2556
2572
  totalLatencyMs: number;
2557
2573
  } | null;
2574
+ createdAt: Date;
2575
+ updatedAt: Date;
2558
2576
  } | undefined>;
2559
2577
  getTotalCost: (params: zod0.infer<zod0.ZodObject<{
2560
2578
  startDate: zod0.ZodDate;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as array, C as targetingRulesSchema, D as zod_default, E as workspaceSettingsSchema, F as record, I as string, L as union, M as literal, N as number, O as _enum, P as object, R as unknown, S as schemas, T as variantsSchema, _ as environmentsSchema, a as matchType, b as providerConfigsSchema, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as boolean, k as any, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, s as getAuthClientOptions, t as createDatabase, u as parseTableData, v as guardrailConfigsSchema, w as variantVersionsSchema, x as providerGuardrailOverridesSchema, y as llmRequestsSchema } from "./db-Bkg85wso.mjs";
1
+ import { A as array, C as targetingRulesSchema, D as zod_default, E as workspaceSettingsSchema, F as record, I as string, L as union, M as literal, N as number, O as _enum, P as object, R as unknown, S as schemas, T as variantsSchema, _ as environmentsSchema, a as matchType, b as providerConfigsSchema, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as boolean, k as any, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, s as getAuthClientOptions, t as createDatabase, u as parseTableData, v as guardrailConfigsSchema, w as variantVersionsSchema, x as providerGuardrailOverridesSchema, y as llmRequestsSchema } from "./db-CoCzHm6p.mjs";
2
2
  import { n as executeWithSchema, t as createNeonDialect } from "./neon-dialect-DySGBYUi.mjs";
3
3
  import gateway from "@llmops/gateway";
4
4
  import { sql } from "kysely";
@@ -1550,6 +1550,28 @@ const createGuardrailConfigsDataLayer = (db) => {
1550
1550
  //#endregion
1551
1551
  //#region src/datalayer/llmRequests.ts
1552
1552
  /**
1553
+ * Schema for individual guardrail result in telemetry
1554
+ */
1555
+ const guardrailResultSchema = zod_default.object({
1556
+ checkId: zod_default.string(),
1557
+ functionId: zod_default.string(),
1558
+ hookType: zod_default.enum(["beforeRequestHook", "afterRequestHook"]),
1559
+ verdict: zod_default.boolean(),
1560
+ latencyMs: zod_default.number()
1561
+ });
1562
+ /**
1563
+ * Schema for guardrail results aggregate
1564
+ */
1565
+ const guardrailResultsSchema = zod_default.object({
1566
+ results: zod_default.array(guardrailResultSchema),
1567
+ action: zod_default.enum([
1568
+ "allowed",
1569
+ "blocked",
1570
+ "logged"
1571
+ ]),
1572
+ totalLatencyMs: zod_default.number()
1573
+ });
1574
+ /**
1553
1575
  * Schema for inserting a new LLM request log
1554
1576
  */
1555
1577
  const insertLLMRequestSchema = zod_default.object({
@@ -1572,7 +1594,8 @@ const insertLLMRequestSchema = zod_default.object({
1572
1594
  latencyMs: zod_default.number().int().default(0),
1573
1595
  isStreaming: zod_default.boolean().default(false),
1574
1596
  userId: zod_default.string().nullable().optional(),
1575
- tags: zod_default.record(zod_default.string(), zod_default.string()).default({})
1597
+ tags: zod_default.record(zod_default.string(), zod_default.string()).default({}),
1598
+ guardrailResults: guardrailResultsSchema.nullable().optional()
1576
1599
  });
1577
1600
  /**
1578
1601
  * Schema for listing LLM requests
@@ -1657,6 +1680,7 @@ const createLLMRequestsDataLayer = (db) => {
1657
1680
  isStreaming: req.isStreaming,
1658
1681
  userId: req.userId ?? null,
1659
1682
  tags: JSON.stringify(req.tags),
1683
+ guardrailResults: req.guardrailResults ? JSON.stringify(req.guardrailResults) : null,
1660
1684
  createdAt: now,
1661
1685
  updatedAt: now
1662
1686
  }));
@@ -1690,6 +1714,7 @@ const createLLMRequestsDataLayer = (db) => {
1690
1714
  isStreaming: req.isStreaming,
1691
1715
  userId: req.userId ?? null,
1692
1716
  tags: JSON.stringify(req.tags),
1717
+ guardrailResults: req.guardrailResults ? JSON.stringify(req.guardrailResults) : null,
1693
1718
  createdAt: now,
1694
1719
  updatedAt: now
1695
1720
  }).returningAll().executeTakeFirst();
@@ -1,4 +1,4 @@
1
- const require_db = require('./db-CCKBHjuz.cjs');
1
+ const require_db = require('./db-BF1a1duC.cjs');
2
2
  let kysely_neon = require("kysely-neon");
3
3
  require("@neondatabase/serverless");
4
4
 
@@ -1,3 +1,3 @@
1
- const require_neon_dialect = require('./neon-dialect-DmI-frVR.cjs');
1
+ const require_neon_dialect = require('./neon-dialect-BQsMY2pg.cjs');
2
2
 
3
3
  exports.createNeonDialect = require_neon_dialect.createNeonDialect;
@@ -1,4 +1,4 @@
1
- const require_db = require('./db-CCKBHjuz.cjs');
1
+ const require_db = require('./db-BF1a1duC.cjs');
2
2
  let kysely = require("kysely");
3
3
 
4
4
  //#region src/db/node-sqlite-dialect.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/core",
3
- "version": "0.3.2-beta.3",
3
+ "version": "0.3.3",
4
4
  "description": "Core LLMOps functionality and utilities",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -55,7 +55,7 @@
55
55
  "kysely": "^0.28.8",
56
56
  "kysely-neon": "^2.0.2",
57
57
  "pino": "^10.1.0",
58
- "@llmops/gateway": "^0.3.2-beta.3"
58
+ "@llmops/gateway": "^0.3.3"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/json-logic-js": "^2.0.8",