@llmops/core 0.6.10 → 1.0.0-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.
@@ -12969,7 +12969,8 @@ const playgroundColumnSchema = object({
12969
12969
  id: string$1().uuid(),
12970
12970
  name: string$1(),
12971
12971
  position: number$1().int().min(0),
12972
- providerConfigId: union([string$1().uuid(), _null()]),
12972
+ providerConfigId: union([string$1().uuid(), _null()]).optional(),
12973
+ providerSlug: string$1().nullable().optional(),
12973
12974
  modelName: string$1(),
12974
12975
  messages: array(object({
12975
12976
  role: _enum([
@@ -12983,10 +12984,7 @@ const playgroundColumnSchema = object({
12983
12984
  maxTokens: number$1().int().nullable().optional(),
12984
12985
  topP: number$1().nullable().optional(),
12985
12986
  frequencyPenalty: number$1().nullable().optional(),
12986
- presencePenalty: number$1().nullable().optional(),
12987
- configId: string$1().uuid().nullable().optional(),
12988
- variantId: string$1().uuid().nullable().optional(),
12989
- variantVersionId: string$1().uuid().nullable().optional()
12987
+ presencePenalty: number$1().nullable().optional()
12990
12988
  });
12991
12989
  const playgroundsSchema = object({
12992
12990
  ...baseSchema,
@@ -13184,237 +13182,6 @@ const spanEventsSchema = object({
13184
13182
  * Derived from Zod schemas
13185
13183
  */
13186
13184
  const SCHEMA_METADATA = { tables: {
13187
- configs: {
13188
- order: 1,
13189
- schema: configsSchema,
13190
- fields: {
13191
- id: {
13192
- type: "uuid",
13193
- primaryKey: true
13194
- },
13195
- slug: {
13196
- type: "text",
13197
- unique: true
13198
- },
13199
- name: {
13200
- type: "text",
13201
- nullable: true
13202
- },
13203
- createdAt: {
13204
- type: "timestamp",
13205
- default: "now()"
13206
- },
13207
- updatedAt: {
13208
- type: "timestamp",
13209
- default: "now()",
13210
- onUpdate: "now()"
13211
- }
13212
- }
13213
- },
13214
- variants: {
13215
- order: 2,
13216
- schema: variantsSchema,
13217
- fields: {
13218
- id: {
13219
- type: "uuid",
13220
- primaryKey: true
13221
- },
13222
- name: { type: "text" },
13223
- createdAt: {
13224
- type: "timestamp",
13225
- default: "now()"
13226
- },
13227
- updatedAt: {
13228
- type: "timestamp",
13229
- default: "now()",
13230
- onUpdate: "now()"
13231
- }
13232
- }
13233
- },
13234
- variant_versions: {
13235
- order: 3,
13236
- schema: variantVersionsSchema,
13237
- fields: {
13238
- id: {
13239
- type: "uuid",
13240
- primaryKey: true
13241
- },
13242
- variantId: {
13243
- type: "uuid",
13244
- references: {
13245
- table: "variants",
13246
- column: "id"
13247
- }
13248
- },
13249
- version: { type: "integer" },
13250
- provider: { type: "text" },
13251
- modelName: { type: "text" },
13252
- jsonData: { type: "jsonb" },
13253
- createdAt: {
13254
- type: "timestamp",
13255
- default: "now()"
13256
- },
13257
- updatedAt: {
13258
- type: "timestamp",
13259
- default: "now()",
13260
- onUpdate: "now()"
13261
- }
13262
- },
13263
- uniqueConstraints: [{ columns: ["variantId", "version"] }]
13264
- },
13265
- environments: {
13266
- order: 4,
13267
- schema: environmentsSchema,
13268
- fields: {
13269
- id: {
13270
- type: "uuid",
13271
- primaryKey: true
13272
- },
13273
- name: { type: "text" },
13274
- slug: {
13275
- type: "text",
13276
- unique: true
13277
- },
13278
- isProd: {
13279
- type: "boolean",
13280
- default: false
13281
- },
13282
- createdAt: {
13283
- type: "timestamp",
13284
- default: "now()"
13285
- },
13286
- updatedAt: {
13287
- type: "timestamp",
13288
- default: "now()",
13289
- onUpdate: "now()"
13290
- }
13291
- }
13292
- },
13293
- environment_secrets: {
13294
- order: 5,
13295
- schema: environmentSecretsSchema,
13296
- fields: {
13297
- id: {
13298
- type: "uuid",
13299
- primaryKey: true
13300
- },
13301
- environmentId: {
13302
- type: "uuid",
13303
- references: {
13304
- table: "environments",
13305
- column: "id"
13306
- }
13307
- },
13308
- keyName: { type: "text" },
13309
- keyValue: { type: "text" },
13310
- createdAt: {
13311
- type: "timestamp",
13312
- default: "now()"
13313
- },
13314
- updatedAt: {
13315
- type: "timestamp",
13316
- default: "now()",
13317
- onUpdate: "now()"
13318
- }
13319
- }
13320
- },
13321
- config_variants: {
13322
- order: 6,
13323
- schema: configVariantsSchema,
13324
- fields: {
13325
- id: {
13326
- type: "uuid",
13327
- primaryKey: true
13328
- },
13329
- configId: {
13330
- type: "uuid",
13331
- references: {
13332
- table: "configs",
13333
- column: "id"
13334
- }
13335
- },
13336
- variantId: {
13337
- type: "uuid",
13338
- references: {
13339
- table: "variants",
13340
- column: "id"
13341
- }
13342
- },
13343
- createdAt: {
13344
- type: "timestamp",
13345
- default: "now()"
13346
- },
13347
- updatedAt: {
13348
- type: "timestamp",
13349
- default: "now()",
13350
- onUpdate: "now()"
13351
- }
13352
- }
13353
- },
13354
- targeting_rules: {
13355
- order: 7,
13356
- schema: targetingRulesSchema,
13357
- fields: {
13358
- id: {
13359
- type: "uuid",
13360
- primaryKey: true
13361
- },
13362
- environmentId: {
13363
- type: "uuid",
13364
- references: {
13365
- table: "environments",
13366
- column: "id"
13367
- }
13368
- },
13369
- configId: {
13370
- type: "uuid",
13371
- references: {
13372
- table: "configs",
13373
- column: "id"
13374
- }
13375
- },
13376
- configVariantId: {
13377
- type: "uuid",
13378
- references: {
13379
- table: "config_variants",
13380
- column: "id"
13381
- }
13382
- },
13383
- variantVersionId: {
13384
- type: "uuid",
13385
- nullable: true,
13386
- references: {
13387
- table: "variant_versions",
13388
- column: "id"
13389
- }
13390
- },
13391
- weight: {
13392
- type: "integer",
13393
- default: 1e4
13394
- },
13395
- priority: {
13396
- type: "integer",
13397
- default: 0
13398
- },
13399
- enabled: {
13400
- type: "boolean",
13401
- default: true
13402
- },
13403
- conditions: {
13404
- type: "jsonb",
13405
- default: "{}"
13406
- },
13407
- createdAt: {
13408
- type: "timestamp",
13409
- default: "now()"
13410
- },
13411
- updatedAt: {
13412
- type: "timestamp",
13413
- default: "now()",
13414
- onUpdate: "now()"
13415
- }
13416
- }
13417
- },
13418
13185
  workspace_settings: {
13419
13186
  order: 8,
13420
13187
  schema: workspaceSettingsSchema,
@@ -13446,42 +13213,6 @@ const SCHEMA_METADATA = { tables: {
13446
13213
  }
13447
13214
  }
13448
13215
  },
13449
- provider_configs: {
13450
- order: 9,
13451
- schema: providerConfigsSchema,
13452
- fields: {
13453
- id: {
13454
- type: "uuid",
13455
- primaryKey: true
13456
- },
13457
- providerId: { type: "text" },
13458
- slug: {
13459
- type: "text",
13460
- nullable: true
13461
- },
13462
- name: {
13463
- type: "text",
13464
- nullable: true
13465
- },
13466
- config: {
13467
- type: "jsonb",
13468
- default: "{}"
13469
- },
13470
- enabled: {
13471
- type: "boolean",
13472
- default: true
13473
- },
13474
- createdAt: {
13475
- type: "timestamp",
13476
- default: "now()"
13477
- },
13478
- updatedAt: {
13479
- type: "timestamp",
13480
- default: "now()",
13481
- onUpdate: "now()"
13482
- }
13483
- }
13484
- },
13485
13216
  playgrounds: {
13486
13217
  order: 20,
13487
13218
  schema: playgroundsSchema,
@@ -13641,45 +13372,6 @@ const SCHEMA_METADATA = { tables: {
13641
13372
  }
13642
13373
  }
13643
13374
  },
13644
- guardrail_configs: {
13645
- order: 14,
13646
- schema: guardrailConfigsSchema,
13647
- fields: {
13648
- id: {
13649
- type: "uuid",
13650
- primaryKey: true
13651
- },
13652
- name: { type: "text" },
13653
- pluginId: { type: "text" },
13654
- functionId: { type: "text" },
13655
- hookType: { type: "text" },
13656
- parameters: {
13657
- type: "jsonb",
13658
- default: "{}"
13659
- },
13660
- enabled: {
13661
- type: "boolean",
13662
- default: true
13663
- },
13664
- priority: {
13665
- type: "integer",
13666
- default: 0
13667
- },
13668
- onFail: {
13669
- type: "text",
13670
- default: "block"
13671
- },
13672
- createdAt: {
13673
- type: "timestamp",
13674
- default: "now()"
13675
- },
13676
- updatedAt: {
13677
- type: "timestamp",
13678
- default: "now()",
13679
- onUpdate: "now()"
13680
- }
13681
- }
13682
- },
13683
13375
  datasets: {
13684
13376
  order: 10,
13685
13377
  schema: datasetsSchema,
@@ -13826,48 +13518,6 @@ const SCHEMA_METADATA = { tables: {
13826
13518
  },
13827
13519
  uniqueConstraints: [{ columns: ["datasetVersionId", "datasetRecordId"] }]
13828
13520
  },
13829
- provider_guardrail_overrides: {
13830
- order: 15,
13831
- schema: providerGuardrailOverridesSchema,
13832
- fields: {
13833
- id: {
13834
- type: "uuid",
13835
- primaryKey: true
13836
- },
13837
- providerConfigId: {
13838
- type: "uuid",
13839
- references: {
13840
- table: "provider_configs",
13841
- column: "id"
13842
- }
13843
- },
13844
- guardrailConfigId: {
13845
- type: "uuid",
13846
- references: {
13847
- table: "guardrail_configs",
13848
- column: "id"
13849
- }
13850
- },
13851
- enabled: {
13852
- type: "boolean",
13853
- default: true
13854
- },
13855
- parameters: {
13856
- type: "jsonb",
13857
- nullable: true
13858
- },
13859
- createdAt: {
13860
- type: "timestamp",
13861
- default: "now()"
13862
- },
13863
- updatedAt: {
13864
- type: "timestamp",
13865
- default: "now()",
13866
- onUpdate: "now()"
13867
- }
13868
- },
13869
- uniqueConstraints: [{ columns: ["providerConfigId", "guardrailConfigId"] }]
13870
- },
13871
13521
  llm_requests: {
13872
13522
  order: 17,
13873
13523
  schema: llmRequestsSchema,
@@ -14209,21 +13859,11 @@ const SCHEMA_METADATA = { tables: {
14209
13859
  * Export all Zod schemas for runtime validation
14210
13860
  */
14211
13861
  const schemas = {
14212
- configs: configsSchema,
14213
- variants: variantsSchema,
14214
- variant_versions: variantVersionsSchema,
14215
- environments: environmentsSchema,
14216
- environment_secrets: environmentSecretsSchema,
14217
- config_variants: configVariantsSchema,
14218
- targeting_rules: targetingRulesSchema,
14219
13862
  workspace_settings: workspaceSettingsSchema,
14220
- provider_configs: providerConfigsSchema,
14221
13863
  playgrounds: playgroundsSchema,
14222
13864
  playground_columns: playgroundColumnSchema,
14223
13865
  playground_runs: playgroundRunsSchema,
14224
13866
  playground_results: playgroundResultsSchema,
14225
- guardrail_configs: guardrailConfigsSchema,
14226
- provider_guardrail_overrides: providerGuardrailOverridesSchema,
14227
13867
  datasets: datasetsSchema,
14228
13868
  dataset_versions: datasetVersionsSchema,
14229
13869
  dataset_records: datasetRecordsSchema,
@@ -14266,27 +13906,6 @@ function parsePartialTableData(table, data) {
14266
13906
  //#region src/utils/logger.ts
14267
13907
  const logger = (0, pino.default)({ level: process.env.LOG_LEVEL || "info" });
14268
13908
 
14269
- //#endregion
14270
- //#region src/auth/get-auth-client-options.ts
14271
- /**
14272
- * Get Better Auth client options
14273
- *
14274
- * @param options - Auth client options including database config and hooks
14275
- */
14276
- const getAuthClientOptions = (options) => {
14277
- const { database, onUserCreated, baseURL, trustedOrigins } = options;
14278
- return {
14279
- database,
14280
- baseURL,
14281
- trustedOrigins,
14282
- emailAndPassword: { enabled: true },
14283
- advanced: { cookiePrefix: "llmops" },
14284
- databaseHooks: onUserCreated ? { user: { create: { after: async (user) => {
14285
- await onUserCreated(user.id);
14286
- } } } } : void 0
14287
- };
14288
- };
14289
-
14290
13909
  //#endregion
14291
13910
  //#region src/db/migrations.ts
14292
13911
  const postgresMap = {
@@ -14539,23 +14158,7 @@ async function getMigrations(db, dbType, options) {
14539
14158
  migrations.push(builder);
14540
14159
  }
14541
14160
  }
14542
- if (dbType === "postgres") try {
14543
- await kysely.sql`SET search_path TO "${options?.schema ?? "llmops"}"`.execute(db);
14544
- } catch (error$47) {
14545
- logger.warn({ error: error$47 }, "Failed to set search_path for Better Auth migrations");
14546
- }
14547
- let getAuthMigrations;
14548
- try {
14549
- const dbModule = await import("better-auth/db");
14550
- if (typeof dbModule.getMigrations === "function") getAuthMigrations = dbModule.getMigrations;
14551
- if (!getAuthMigrations) {
14552
- const migrationModule = await import("better-auth/db/migration");
14553
- if (typeof migrationModule.getMigrations === "function") getAuthMigrations = migrationModule.getMigrations;
14554
- }
14555
- } catch (error$47) {
14556
- logger.warn({ error: error$47 }, "Failed to import better-auth migrations; skipping auth migrations");
14557
- }
14558
- if (!getAuthMigrations) return {
14161
+ return {
14559
14162
  toBeCreated,
14560
14163
  toBeAdded,
14561
14164
  runMigrations: async () => {
@@ -14567,26 +14170,6 @@ async function getMigrations(db, dbType, options) {
14567
14170
  migrations,
14568
14171
  needsMigration: toBeCreated.length > 0 || toBeAdded.length > 0
14569
14172
  };
14570
- const authOptions = getAuthClientOptions({ database: {
14571
- db,
14572
- type: dbType === "neon" ? "postgres" : dbType
14573
- } });
14574
- const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await getAuthMigrations(authOptions);
14575
- async function runMigrations() {
14576
- for (const migration of migrations) await migration.execute();
14577
- await runAuthMigrations();
14578
- }
14579
- async function compileMigrations() {
14580
- return migrations.map((m) => m.compile().sql).join(";\n\n") + ";";
14581
- }
14582
- return {
14583
- toBeCreated: [...toBeCreated, ...authChangesToBeCreated],
14584
- toBeAdded: [...toBeAdded, ...authChangesToBeAdded],
14585
- runMigrations,
14586
- compileMigrations,
14587
- migrations,
14588
- needsMigration: toBeCreated.length > 0 || toBeAdded.length > 0 || authChangesToBeCreated.length > 0 || authChangesToBeAdded.length > 0
14589
- };
14590
14173
  }
14591
14174
  /**
14592
14175
  * Fix legacy constraints that may exist from previous schema versions
@@ -14718,12 +14301,12 @@ async function createDatabaseFromConnection(rawConnection, options) {
14718
14301
  case "sqlite":
14719
14302
  if ("aggregate" in rawConnection && !("createSession" in rawConnection)) dialect = new kysely.SqliteDialect({ database: rawConnection });
14720
14303
  else if ("fileControl" in rawConnection) {
14721
- const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-C06VxkTn.cjs"));
14304
+ const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-CVUG5QUU.cjs"));
14722
14305
  dialect = new BunSqliteDialect({ database: rawConnection });
14723
14306
  } else if ("createSession" in rawConnection && typeof window === "undefined") try {
14724
14307
  const { DatabaseSync } = await import("node:sqlite");
14725
14308
  if (rawConnection instanceof DatabaseSync) {
14726
- const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-AU81Qz0n.cjs"));
14309
+ const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-fwmW40Ar.cjs"));
14727
14310
  dialect = new NodeSqliteDialect({ database: rawConnection });
14728
14311
  }
14729
14312
  } catch {}
@@ -14741,7 +14324,7 @@ async function createDatabaseFromConnection(rawConnection, options) {
14741
14324
  break;
14742
14325
  case "neon": {
14743
14326
  if (typeof rawConnection === "function") {
14744
- const { createNeonDialect: createNeonDialect$1 } = await Promise.resolve().then(() => require("./neon-dialect-DIuEesTA.cjs"));
14327
+ const { createNeonDialect: createNeonDialect$1 } = await Promise.resolve().then(() => require("./neon-dialect-BOnuygPe.cjs"));
14745
14328
  dialect = createNeonDialect$1(rawConnection);
14746
14329
  break;
14747
14330
  }
@@ -14749,7 +14332,7 @@ async function createDatabaseFromConnection(rawConnection, options) {
14749
14332
  if (!connectionString) throw new Error("Neon connection string is required. Pass it directly as the database option or set one of: NEON_CONNECTION_STRING, NEON_PG_URL, DATABASE_URL, POSTGRES_URL");
14750
14333
  const { neon } = await import("@neondatabase/serverless");
14751
14334
  const sql$1 = neon(connectionString);
14752
- const { createNeonDialect } = await Promise.resolve().then(() => require("./neon-dialect-DIuEesTA.cjs"));
14335
+ const { createNeonDialect } = await Promise.resolve().then(() => require("./neon-dialect-BOnuygPe.cjs"));
14753
14336
  dialect = createNeonDialect(sql$1);
14754
14337
  break;
14755
14338
  }
@@ -14863,12 +14446,6 @@ Object.defineProperty(exports, 'environmentsSchema', {
14863
14446
  return environmentsSchema;
14864
14447
  }
14865
14448
  });
14866
- Object.defineProperty(exports, 'getAuthClientOptions', {
14867
- enumerable: true,
14868
- get: function () {
14869
- return getAuthClientOptions;
14870
- }
14871
- });
14872
14449
  Object.defineProperty(exports, 'getMigrations', {
14873
14450
  enumerable: true,
14874
14451
  get: function () {