@llmops/core 0.2.11-beta.1 → 0.2.11-beta.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.
@@ -1,4 +1,5 @@
1
- const require_db = require('./db-CzLvkATK.cjs');
1
+ "use node";
2
+ const require_db = require('./db-CGuiUiaR.cjs');
2
3
  let kysely = require("kysely");
3
4
 
4
5
  //#region src/db/bun-sqlite-dialect.ts
@@ -1,3 +1,4 @@
1
+ "use node";
1
2
  import { CompiledQuery, DEFAULT_MIGRATION_LOCK_TABLE, DEFAULT_MIGRATION_TABLE, DefaultQueryCompiler, sql } from "kysely";
2
3
 
3
4
  //#region src/db/bun-sqlite-dialect.ts
package/dist/db/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
- const require_db = require('../db-CzLvkATK.cjs');
1
+ "use node";
2
+ const require_db = require('../db-CGuiUiaR.cjs');
2
3
 
3
4
  exports.SCHEMA_METADATA = require_db.SCHEMA_METADATA;
4
5
  exports.configVariantsSchema = require_db.configVariantsSchema;
@@ -1,2 +1,2 @@
1
- import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "../index-8czO0OIS.cjs";
1
+ import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "../index-BiHQ7UWZ.cjs";
2
2
  export { Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, Insertable, LLMRequest, LLMRequestsTable, MigrationOptions, MigrationResult, ProviderConfig, ProviderConfigsTable, SCHEMA_METADATA, Selectable, TableName, TargetingRule, TargetingRulesTable, Updateable, Variant, VariantVersion, VariantVersionsTable, VariantsTable, WorkspaceSettings, WorkspaceSettingsTable, configVariantsSchema, configsSchema, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, getMigrations, llmRequestsSchema, matchType, parsePartialTableData, parseTableData, providerConfigsSchema, runAutoMigrations, schemas, targetingRulesSchema, validatePartialTableData, validateTableData, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
@@ -1,2 +1,2 @@
1
- import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "../index-BEoqwM0H.mjs";
1
+ import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "../index-CVGG0zoD.mjs";
2
2
  export { Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, Insertable, LLMRequest, LLMRequestsTable, MigrationOptions, MigrationResult, ProviderConfig, ProviderConfigsTable, SCHEMA_METADATA, Selectable, TableName, TargetingRule, TargetingRulesTable, Updateable, Variant, VariantVersion, VariantVersionsTable, VariantsTable, WorkspaceSettings, WorkspaceSettingsTable, configVariantsSchema, configsSchema, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, getMigrations, llmRequestsSchema, matchType, parsePartialTableData, parseTableData, providerConfigsSchema, runAutoMigrations, schemas, targetingRulesSchema, validatePartialTableData, validateTableData, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
package/dist/db/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
- import { C as variantsSchema, S as variantVersionsSchema, _ as environmentsSchema, a as matchType, b as schemas, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, t as createDatabase, u as parseTableData, v as llmRequestsSchema, w as workspaceSettingsSchema, x as targetingRulesSchema, y as providerConfigsSchema } from "../db-DA8xIZ3w.mjs";
1
+ "use node";
2
+ import { C as variantsSchema, S as variantVersionsSchema, _ as environmentsSchema, a as matchType, b as schemas, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, t as createDatabase, u as parseTableData, v as llmRequestsSchema, w as workspaceSettingsSchema, x as targetingRulesSchema, y as providerConfigsSchema } from "../db-SQ9IcEvp.mjs";
2
3
 
3
4
  export { SCHEMA_METADATA, configVariantsSchema, configsSchema, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, getMigrations, llmRequestsSchema, matchType, parsePartialTableData, parseTableData, providerConfigsSchema, runAutoMigrations, schemas, targetingRulesSchema, validatePartialTableData, validateTableData, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
@@ -1,3 +1,4 @@
1
+ "use node";
1
2
  //#region rolldown:runtime
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -12971,6 +12972,7 @@ const llmRequestsSchema = object({
12971
12972
  configId: string$1().uuid().nullable().optional(),
12972
12973
  variantId: string$1().uuid().nullable().optional(),
12973
12974
  environmentId: string$1().uuid().nullable().optional(),
12975
+ providerConfigId: string$1().uuid().nullable().optional(),
12974
12976
  provider: string$1(),
12975
12977
  model: string$1(),
12976
12978
  promptTokens: number$1().int().default(0),
@@ -13319,6 +13321,14 @@ const SCHEMA_METADATA = { tables: {
13319
13321
  column: "id"
13320
13322
  }
13321
13323
  },
13324
+ providerConfigId: {
13325
+ type: "uuid",
13326
+ nullable: true,
13327
+ references: {
13328
+ table: "provider_configs",
13329
+ column: "id"
13330
+ }
13331
+ },
13322
13332
  provider: { type: "text" },
13323
13333
  model: { type: "text" },
13324
13334
  promptTokens: {
@@ -13820,12 +13830,12 @@ async function createDatabaseFromConnection(rawConnection, options) {
13820
13830
  case "sqlite":
13821
13831
  if ("aggregate" in rawConnection && !("createSession" in rawConnection)) dialect = new kysely.SqliteDialect({ database: rawConnection });
13822
13832
  else if ("fileControl" in rawConnection) {
13823
- const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-DxPi9X8H.cjs"));
13833
+ const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-X0mhNuEg.cjs"));
13824
13834
  dialect = new BunSqliteDialect({ database: rawConnection });
13825
13835
  } else if ("createSession" in rawConnection && typeof window === "undefined") try {
13826
13836
  const { DatabaseSync } = await import("node:sqlite");
13827
13837
  if (rawConnection instanceof DatabaseSync) {
13828
- const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-Ckt6QTf5.cjs"));
13838
+ const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-HzfDkMfV.cjs"));
13829
13839
  dialect = new NodeSqliteDialect({ database: rawConnection });
13830
13840
  }
13831
13841
  } catch {}
@@ -1,3 +1,4 @@
1
+ "use node";
1
2
  import { CompiledQuery, Kysely, MssqlDialect, MysqlDialect, PostgresDialect, SqliteDialect, sql } from "kysely";
2
3
  import { getMigrations } from "better-auth/db";
3
4
  import pino from "pino";
@@ -12947,6 +12948,7 @@ const llmRequestsSchema = object({
12947
12948
  configId: string$1().uuid().nullable().optional(),
12948
12949
  variantId: string$1().uuid().nullable().optional(),
12949
12950
  environmentId: string$1().uuid().nullable().optional(),
12951
+ providerConfigId: string$1().uuid().nullable().optional(),
12950
12952
  provider: string$1(),
12951
12953
  model: string$1(),
12952
12954
  promptTokens: number$1().int().default(0),
@@ -13295,6 +13297,14 @@ const SCHEMA_METADATA = { tables: {
13295
13297
  column: "id"
13296
13298
  }
13297
13299
  },
13300
+ providerConfigId: {
13301
+ type: "uuid",
13302
+ nullable: true,
13303
+ references: {
13304
+ table: "provider_configs",
13305
+ column: "id"
13306
+ }
13307
+ },
13298
13308
  provider: { type: "text" },
13299
13309
  model: { type: "text" },
13300
13310
  promptTokens: {
@@ -13796,12 +13806,12 @@ async function createDatabaseFromConnection(rawConnection, options) {
13796
13806
  case "sqlite":
13797
13807
  if ("aggregate" in rawConnection && !("createSession" in rawConnection)) dialect = new SqliteDialect({ database: rawConnection });
13798
13808
  else if ("fileControl" in rawConnection) {
13799
- const { BunSqliteDialect } = await import("./bun-sqlite-dialect-YVmcpOaa.mjs");
13809
+ const { BunSqliteDialect } = await import("./bun-sqlite-dialect-XvGuhnjL.mjs");
13800
13810
  dialect = new BunSqliteDialect({ database: rawConnection });
13801
13811
  } else if ("createSession" in rawConnection && typeof window === "undefined") try {
13802
13812
  const { DatabaseSync } = await import("node:sqlite");
13803
13813
  if (rawConnection instanceof DatabaseSync) {
13804
- const { NodeSqliteDialect } = await import("./node-sqlite-dialect-rrsskSJp.mjs");
13814
+ const { NodeSqliteDialect } = await import("./node-sqlite-dialect-DuDolQU1.mjs");
13805
13815
  dialect = new NodeSqliteDialect({ database: rawConnection });
13806
13816
  }
13807
13817
  } catch {}
@@ -1,5 +1,5 @@
1
1
  import { ColumnType, Generated, Kysely, MssqlDialect, MysqlDialect, PostgresDialect, SqliteDialect } from "kysely";
2
- import * as zod495 from "zod";
2
+ import * as zod497 from "zod";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/db/schema.d.ts
@@ -84,6 +84,7 @@ declare const llmRequestsSchema: z.ZodObject<{
84
84
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
85
  variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
86
  environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
88
  provider: z.ZodString;
88
89
  model: z.ZodString;
89
90
  promptTokens: z.ZodDefault<z.ZodNumber>;
@@ -179,6 +180,7 @@ interface LLMRequestsTable extends BaseTable {
179
180
  configId: string | null;
180
181
  variantId: string | null;
181
182
  environmentId: string | null;
183
+ providerConfigId: string | null;
182
184
  provider: string;
183
185
  model: string;
184
186
  promptTokens: ColumnType<number, number | undefined, number | undefined>;
@@ -614,6 +616,7 @@ declare const SCHEMA_METADATA: {
614
616
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
617
  variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
616
618
  environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
619
+ providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
617
620
  provider: z.ZodString;
618
621
  model: z.ZodString;
619
622
  promptTokens: z.ZodDefault<z.ZodNumber>;
@@ -665,6 +668,14 @@ declare const SCHEMA_METADATA: {
665
668
  readonly column: "id";
666
669
  };
667
670
  };
671
+ readonly providerConfigId: {
672
+ readonly type: "uuid";
673
+ readonly nullable: true;
674
+ readonly references: {
675
+ readonly table: "provider_configs";
676
+ readonly column: "id";
677
+ };
678
+ };
668
679
  readonly provider: {
669
680
  readonly type: "text";
670
681
  };
@@ -819,6 +830,7 @@ declare const schemas: {
819
830
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
820
831
  variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
821
832
  environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
833
+ providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
822
834
  provider: z.ZodString;
823
835
  model: z.ZodString;
824
836
  promptTokens: z.ZodDefault<z.ZodNumber>;
@@ -845,29 +857,29 @@ declare const schemas: {
845
857
  * Validate data against table schema
846
858
  * Useful for runtime validation before inserting/updating
847
859
  */
848
- declare function validateTableData<T extends TableName>(table: T, data: unknown): zod495.ZodSafeParseSuccess<{
860
+ declare function validateTableData<T extends TableName>(table: T, data: unknown): zod497.ZodSafeParseSuccess<{
849
861
  slug: string;
850
862
  id: string;
851
863
  createdAt: Date;
852
864
  updatedAt: Date;
853
865
  name?: string | undefined;
854
- }> | zod495.ZodSafeParseError<{
866
+ }> | zod497.ZodSafeParseError<{
855
867
  slug: string;
856
868
  id: string;
857
869
  createdAt: Date;
858
870
  updatedAt: Date;
859
871
  name?: string | undefined;
860
- }> | zod495.ZodSafeParseSuccess<{
872
+ }> | zod497.ZodSafeParseSuccess<{
861
873
  name: string;
862
874
  id: string;
863
875
  createdAt: Date;
864
876
  updatedAt: Date;
865
- }> | zod495.ZodSafeParseError<{
877
+ }> | zod497.ZodSafeParseError<{
866
878
  name: string;
867
879
  id: string;
868
880
  createdAt: Date;
869
881
  updatedAt: Date;
870
- }> | zod495.ZodSafeParseSuccess<{
882
+ }> | zod497.ZodSafeParseSuccess<{
871
883
  variantId: string;
872
884
  version: number;
873
885
  provider: string;
@@ -876,7 +888,7 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
876
888
  id: string;
877
889
  createdAt: Date;
878
890
  updatedAt: Date;
879
- }> | zod495.ZodSafeParseError<{
891
+ }> | zod497.ZodSafeParseError<{
880
892
  variantId: string;
881
893
  version: number;
882
894
  provider: string;
@@ -885,33 +897,33 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
885
897
  id: string;
886
898
  createdAt: Date;
887
899
  updatedAt: Date;
888
- }> | zod495.ZodSafeParseSuccess<{
900
+ }> | zod497.ZodSafeParseSuccess<{
889
901
  environmentId: string;
890
902
  keyName: string;
891
903
  keyValue: string;
892
904
  id: string;
893
905
  createdAt: Date;
894
906
  updatedAt: Date;
895
- }> | zod495.ZodSafeParseError<{
907
+ }> | zod497.ZodSafeParseError<{
896
908
  environmentId: string;
897
909
  keyName: string;
898
910
  keyValue: string;
899
911
  id: string;
900
912
  createdAt: Date;
901
913
  updatedAt: Date;
902
- }> | zod495.ZodSafeParseSuccess<{
914
+ }> | zod497.ZodSafeParseSuccess<{
903
915
  configId: string;
904
916
  variantId: string;
905
917
  id: string;
906
918
  createdAt: Date;
907
919
  updatedAt: Date;
908
- }> | zod495.ZodSafeParseError<{
920
+ }> | zod497.ZodSafeParseError<{
909
921
  configId: string;
910
922
  variantId: string;
911
923
  id: string;
912
924
  createdAt: Date;
913
925
  updatedAt: Date;
914
- }> | zod495.ZodSafeParseSuccess<{
926
+ }> | zod497.ZodSafeParseSuccess<{
915
927
  environmentId: string;
916
928
  configId: string;
917
929
  configVariantId: string;
@@ -923,7 +935,7 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
923
935
  createdAt: Date;
924
936
  updatedAt: Date;
925
937
  variantVersionId?: string | null | undefined;
926
- }> | zod495.ZodSafeParseError<{
938
+ }> | zod497.ZodSafeParseError<{
927
939
  environmentId: string;
928
940
  configId: string;
929
941
  configVariantId: string;
@@ -935,21 +947,21 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
935
947
  createdAt: Date;
936
948
  updatedAt: Date;
937
949
  variantVersionId?: string | null | undefined;
938
- }> | zod495.ZodSafeParseSuccess<{
950
+ }> | zod497.ZodSafeParseSuccess<{
939
951
  setupComplete: boolean;
940
952
  id: string;
941
953
  createdAt: Date;
942
954
  updatedAt: Date;
943
955
  name?: string | null | undefined;
944
956
  superAdminId?: string | null | undefined;
945
- }> | zod495.ZodSafeParseError<{
957
+ }> | zod497.ZodSafeParseError<{
946
958
  setupComplete: boolean;
947
959
  id: string;
948
960
  createdAt: Date;
949
961
  updatedAt: Date;
950
962
  name?: string | null | undefined;
951
963
  superAdminId?: string | null | undefined;
952
- }> | zod495.ZodSafeParseSuccess<{
964
+ }> | zod497.ZodSafeParseSuccess<{
953
965
  providerId: string;
954
966
  config: Record<string, unknown>;
955
967
  enabled: boolean;
@@ -957,7 +969,7 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
957
969
  createdAt: Date;
958
970
  updatedAt: Date;
959
971
  name?: string | null | undefined;
960
- }> | zod495.ZodSafeParseError<{
972
+ }> | zod497.ZodSafeParseError<{
961
973
  providerId: string;
962
974
  config: Record<string, unknown>;
963
975
  enabled: boolean;
@@ -965,7 +977,7 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
965
977
  createdAt: Date;
966
978
  updatedAt: Date;
967
979
  name?: string | null | undefined;
968
- }> | zod495.ZodSafeParseSuccess<{
980
+ }> | zod497.ZodSafeParseSuccess<{
969
981
  requestId: string;
970
982
  provider: string;
971
983
  model: string;
@@ -987,8 +999,9 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
987
999
  configId?: string | null | undefined;
988
1000
  variantId?: string | null | undefined;
989
1001
  environmentId?: string | null | undefined;
1002
+ providerConfigId?: string | null | undefined;
990
1003
  userId?: string | null | undefined;
991
- }> | zod495.ZodSafeParseError<{
1004
+ }> | zod497.ZodSafeParseError<{
992
1005
  requestId: string;
993
1006
  provider: string;
994
1007
  model: string;
@@ -1010,22 +1023,23 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
1010
1023
  configId?: string | null | undefined;
1011
1024
  variantId?: string | null | undefined;
1012
1025
  environmentId?: string | null | undefined;
1026
+ providerConfigId?: string | null | undefined;
1013
1027
  userId?: string | null | undefined;
1014
1028
  }>;
1015
1029
  /**
1016
1030
  * Validate partial data (for updates)
1017
1031
  */
1018
- declare function validatePartialTableData<T extends TableName>(table: T, data: unknown): zod495.ZodSafeParseSuccess<{
1032
+ declare function validatePartialTableData<T extends TableName>(table: T, data: unknown): zod497.ZodSafeParseSuccess<{
1019
1033
  name?: string | undefined;
1020
1034
  id?: string | undefined;
1021
1035
  createdAt?: Date | undefined;
1022
1036
  updatedAt?: Date | undefined;
1023
- }> | zod495.ZodSafeParseError<{
1037
+ }> | zod497.ZodSafeParseError<{
1024
1038
  name?: string | undefined;
1025
1039
  id?: string | undefined;
1026
1040
  createdAt?: Date | undefined;
1027
1041
  updatedAt?: Date | undefined;
1028
- }> | zod495.ZodSafeParseSuccess<{
1042
+ }> | zod497.ZodSafeParseSuccess<{
1029
1043
  variantId?: string | undefined;
1030
1044
  version?: number | undefined;
1031
1045
  provider?: string | undefined;
@@ -1034,7 +1048,7 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1034
1048
  id?: string | undefined;
1035
1049
  createdAt?: Date | undefined;
1036
1050
  updatedAt?: Date | undefined;
1037
- }> | zod495.ZodSafeParseError<{
1051
+ }> | zod497.ZodSafeParseError<{
1038
1052
  variantId?: string | undefined;
1039
1053
  version?: number | undefined;
1040
1054
  provider?: string | undefined;
@@ -1043,33 +1057,33 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1043
1057
  id?: string | undefined;
1044
1058
  createdAt?: Date | undefined;
1045
1059
  updatedAt?: Date | undefined;
1046
- }> | zod495.ZodSafeParseSuccess<{
1060
+ }> | zod497.ZodSafeParseSuccess<{
1047
1061
  environmentId?: string | undefined;
1048
1062
  keyName?: string | undefined;
1049
1063
  keyValue?: string | undefined;
1050
1064
  id?: string | undefined;
1051
1065
  createdAt?: Date | undefined;
1052
1066
  updatedAt?: Date | undefined;
1053
- }> | zod495.ZodSafeParseError<{
1067
+ }> | zod497.ZodSafeParseError<{
1054
1068
  environmentId?: string | undefined;
1055
1069
  keyName?: string | undefined;
1056
1070
  keyValue?: string | undefined;
1057
1071
  id?: string | undefined;
1058
1072
  createdAt?: Date | undefined;
1059
1073
  updatedAt?: Date | undefined;
1060
- }> | zod495.ZodSafeParseSuccess<{
1074
+ }> | zod497.ZodSafeParseSuccess<{
1061
1075
  configId?: string | undefined;
1062
1076
  variantId?: string | undefined;
1063
1077
  id?: string | undefined;
1064
1078
  createdAt?: Date | undefined;
1065
1079
  updatedAt?: Date | undefined;
1066
- }> | zod495.ZodSafeParseError<{
1080
+ }> | zod497.ZodSafeParseError<{
1067
1081
  configId?: string | undefined;
1068
1082
  variantId?: string | undefined;
1069
1083
  id?: string | undefined;
1070
1084
  createdAt?: Date | undefined;
1071
1085
  updatedAt?: Date | undefined;
1072
- }> | zod495.ZodSafeParseSuccess<{
1086
+ }> | zod497.ZodSafeParseSuccess<{
1073
1087
  environmentId?: string | undefined;
1074
1088
  configId?: string | undefined;
1075
1089
  configVariantId?: string | undefined;
@@ -1081,7 +1095,7 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1081
1095
  id?: string | undefined;
1082
1096
  createdAt?: Date | undefined;
1083
1097
  updatedAt?: Date | undefined;
1084
- }> | zod495.ZodSafeParseError<{
1098
+ }> | zod497.ZodSafeParseError<{
1085
1099
  environmentId?: string | undefined;
1086
1100
  configId?: string | undefined;
1087
1101
  configVariantId?: string | undefined;
@@ -1093,21 +1107,21 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1093
1107
  id?: string | undefined;
1094
1108
  createdAt?: Date | undefined;
1095
1109
  updatedAt?: Date | undefined;
1096
- }> | zod495.ZodSafeParseSuccess<{
1110
+ }> | zod497.ZodSafeParseSuccess<{
1097
1111
  name?: string | null | undefined;
1098
1112
  setupComplete?: boolean | undefined;
1099
1113
  superAdminId?: string | null | undefined;
1100
1114
  id?: string | undefined;
1101
1115
  createdAt?: Date | undefined;
1102
1116
  updatedAt?: Date | undefined;
1103
- }> | zod495.ZodSafeParseError<{
1117
+ }> | zod497.ZodSafeParseError<{
1104
1118
  name?: string | null | undefined;
1105
1119
  setupComplete?: boolean | undefined;
1106
1120
  superAdminId?: string | null | undefined;
1107
1121
  id?: string | undefined;
1108
1122
  createdAt?: Date | undefined;
1109
1123
  updatedAt?: Date | undefined;
1110
- }> | zod495.ZodSafeParseSuccess<{
1124
+ }> | zod497.ZodSafeParseSuccess<{
1111
1125
  providerId?: string | undefined;
1112
1126
  name?: string | null | undefined;
1113
1127
  config?: Record<string, unknown> | undefined;
@@ -1115,7 +1129,7 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1115
1129
  id?: string | undefined;
1116
1130
  createdAt?: Date | undefined;
1117
1131
  updatedAt?: Date | undefined;
1118
- }> | zod495.ZodSafeParseError<{
1132
+ }> | zod497.ZodSafeParseError<{
1119
1133
  providerId?: string | undefined;
1120
1134
  name?: string | null | undefined;
1121
1135
  config?: Record<string, unknown> | undefined;
@@ -1123,11 +1137,12 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1123
1137
  id?: string | undefined;
1124
1138
  createdAt?: Date | undefined;
1125
1139
  updatedAt?: Date | undefined;
1126
- }> | zod495.ZodSafeParseSuccess<{
1140
+ }> | zod497.ZodSafeParseSuccess<{
1127
1141
  requestId?: string | undefined;
1128
1142
  configId?: string | null | undefined;
1129
1143
  variantId?: string | null | undefined;
1130
1144
  environmentId?: string | null | undefined;
1145
+ providerConfigId?: string | null | undefined;
1131
1146
  provider?: string | undefined;
1132
1147
  model?: string | undefined;
1133
1148
  promptTokens?: number | undefined;
@@ -1146,11 +1161,12 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1146
1161
  id?: string | undefined;
1147
1162
  createdAt?: Date | undefined;
1148
1163
  updatedAt?: Date | undefined;
1149
- }> | zod495.ZodSafeParseError<{
1164
+ }> | zod497.ZodSafeParseError<{
1150
1165
  requestId?: string | undefined;
1151
1166
  configId?: string | null | undefined;
1152
1167
  variantId?: string | null | undefined;
1153
1168
  environmentId?: string | null | undefined;
1169
+ providerConfigId?: string | null | undefined;
1154
1170
  provider?: string | undefined;
1155
1171
  model?: string | undefined;
1156
1172
  promptTokens?: number | undefined;
@@ -1255,6 +1271,7 @@ declare function parseTableData<T extends TableName>(table: T, data: unknown): {
1255
1271
  configId?: string | null | undefined;
1256
1272
  variantId?: string | null | undefined;
1257
1273
  environmentId?: string | null | undefined;
1274
+ providerConfigId?: string | null | undefined;
1258
1275
  userId?: string | null | undefined;
1259
1276
  };
1260
1277
  /**
@@ -1319,6 +1336,7 @@ declare function parsePartialTableData<T extends TableName>(table: T, data: unkn
1319
1336
  configId?: string | null | undefined;
1320
1337
  variantId?: string | null | undefined;
1321
1338
  environmentId?: string | null | undefined;
1339
+ providerConfigId?: string | null | undefined;
1322
1340
  provider?: string | undefined;
1323
1341
  model?: string | undefined;
1324
1342
  promptTokens?: number | undefined;
@@ -84,6 +84,7 @@ declare const llmRequestsSchema: z.ZodObject<{
84
84
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
85
  variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
86
  environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
88
  provider: z.ZodString;
88
89
  model: z.ZodString;
89
90
  promptTokens: z.ZodDefault<z.ZodNumber>;
@@ -179,6 +180,7 @@ interface LLMRequestsTable extends BaseTable {
179
180
  configId: string | null;
180
181
  variantId: string | null;
181
182
  environmentId: string | null;
183
+ providerConfigId: string | null;
182
184
  provider: string;
183
185
  model: string;
184
186
  promptTokens: ColumnType<number, number | undefined, number | undefined>;
@@ -614,6 +616,7 @@ declare const SCHEMA_METADATA: {
614
616
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
617
  variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
616
618
  environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
619
+ providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
617
620
  provider: z.ZodString;
618
621
  model: z.ZodString;
619
622
  promptTokens: z.ZodDefault<z.ZodNumber>;
@@ -665,6 +668,14 @@ declare const SCHEMA_METADATA: {
665
668
  readonly column: "id";
666
669
  };
667
670
  };
671
+ readonly providerConfigId: {
672
+ readonly type: "uuid";
673
+ readonly nullable: true;
674
+ readonly references: {
675
+ readonly table: "provider_configs";
676
+ readonly column: "id";
677
+ };
678
+ };
668
679
  readonly provider: {
669
680
  readonly type: "text";
670
681
  };
@@ -819,6 +830,7 @@ declare const schemas: {
819
830
  configId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
820
831
  variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
821
832
  environmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
833
+ providerConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
822
834
  provider: z.ZodString;
823
835
  model: z.ZodString;
824
836
  promptTokens: z.ZodDefault<z.ZodNumber>;
@@ -987,6 +999,7 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
987
999
  configId?: string | null | undefined;
988
1000
  variantId?: string | null | undefined;
989
1001
  environmentId?: string | null | undefined;
1002
+ providerConfigId?: string | null | undefined;
990
1003
  userId?: string | null | undefined;
991
1004
  }> | zod0.ZodSafeParseError<{
992
1005
  requestId: string;
@@ -1010,6 +1023,7 @@ declare function validateTableData<T extends TableName>(table: T, data: unknown)
1010
1023
  configId?: string | null | undefined;
1011
1024
  variantId?: string | null | undefined;
1012
1025
  environmentId?: string | null | undefined;
1026
+ providerConfigId?: string | null | undefined;
1013
1027
  userId?: string | null | undefined;
1014
1028
  }>;
1015
1029
  /**
@@ -1128,6 +1142,7 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1128
1142
  configId?: string | null | undefined;
1129
1143
  variantId?: string | null | undefined;
1130
1144
  environmentId?: string | null | undefined;
1145
+ providerConfigId?: string | null | undefined;
1131
1146
  provider?: string | undefined;
1132
1147
  model?: string | undefined;
1133
1148
  promptTokens?: number | undefined;
@@ -1151,6 +1166,7 @@ declare function validatePartialTableData<T extends TableName>(table: T, data: u
1151
1166
  configId?: string | null | undefined;
1152
1167
  variantId?: string | null | undefined;
1153
1168
  environmentId?: string | null | undefined;
1169
+ providerConfigId?: string | null | undefined;
1154
1170
  provider?: string | undefined;
1155
1171
  model?: string | undefined;
1156
1172
  promptTokens?: number | undefined;
@@ -1255,6 +1271,7 @@ declare function parseTableData<T extends TableName>(table: T, data: unknown): {
1255
1271
  configId?: string | null | undefined;
1256
1272
  variantId?: string | null | undefined;
1257
1273
  environmentId?: string | null | undefined;
1274
+ providerConfigId?: string | null | undefined;
1258
1275
  userId?: string | null | undefined;
1259
1276
  };
1260
1277
  /**
@@ -1319,6 +1336,7 @@ declare function parsePartialTableData<T extends TableName>(table: T, data: unkn
1319
1336
  configId?: string | null | undefined;
1320
1337
  variantId?: string | null | undefined;
1321
1338
  environmentId?: string | null | undefined;
1339
+ providerConfigId?: string | null | undefined;
1322
1340
  provider?: string | undefined;
1323
1341
  model?: string | undefined;
1324
1342
  promptTokens?: number | undefined;
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
- const require_db = require('./db-CzLvkATK.cjs');
1
+ "use node";
2
+ const require_db = require('./db-CGuiUiaR.cjs');
2
3
  let __llmops_gateway = require("@llmops/gateway");
3
4
  __llmops_gateway = require_db.__toESM(__llmops_gateway);
4
5
  let kysely = require("kysely");
@@ -1264,8 +1265,19 @@ const createConfigVariantDataLayer = (db) => {
1264
1265
  "version"
1265
1266
  ]).where("variantId", "=", configVariant.variantId).orderBy("version", "desc").limit(1).executeTakeFirst();
1266
1267
  if (!versionData) throw new LLMOpsError(`No variant version found for variant ${configVariant.variantId}`);
1268
+ let finalProvider = versionData.provider;
1269
+ let providerConfigId = null;
1270
+ if (UUID_REGEX.test(versionData.provider)) {
1271
+ const providerConfig = await db.selectFrom("provider_configs").select(["id", "providerId"]).where("id", "=", versionData.provider).executeTakeFirst();
1272
+ if (providerConfig) {
1273
+ finalProvider = providerConfig.providerId;
1274
+ providerConfigId = providerConfig.id;
1275
+ }
1276
+ }
1267
1277
  return {
1268
1278
  ...versionData,
1279
+ provider: finalProvider,
1280
+ providerConfigId,
1269
1281
  configId: resolvedConfigId,
1270
1282
  variantId: configVariant.variantId,
1271
1283
  environmentId
@@ -1439,6 +1451,7 @@ const insertLLMRequestSchema = require_db.zod_default.object({
1439
1451
  configId: require_db.zod_default.string().uuid().nullable().optional(),
1440
1452
  variantId: require_db.zod_default.string().uuid().nullable().optional(),
1441
1453
  environmentId: require_db.zod_default.string().uuid().nullable().optional(),
1454
+ providerConfigId: require_db.zod_default.string().uuid().nullable().optional(),
1442
1455
  provider: require_db.zod_default.string(),
1443
1456
  model: require_db.zod_default.string(),
1444
1457
  promptTokens: require_db.zod_default.number().int().default(0),
@@ -1464,6 +1477,7 @@ const listRequestsSchema = require_db.zod_default.object({
1464
1477
  configId: require_db.zod_default.string().uuid().optional(),
1465
1478
  variantId: require_db.zod_default.string().uuid().optional(),
1466
1479
  environmentId: require_db.zod_default.string().uuid().optional(),
1480
+ providerConfigId: require_db.zod_default.string().uuid().optional(),
1467
1481
  provider: require_db.zod_default.string().optional(),
1468
1482
  model: require_db.zod_default.string().optional(),
1469
1483
  startDate: require_db.zod_default.date().optional(),
@@ -1521,6 +1535,7 @@ const createLLMRequestsDataLayer = (db) => {
1521
1535
  configId: req.configId ?? null,
1522
1536
  variantId: req.variantId ?? null,
1523
1537
  environmentId: req.environmentId ?? null,
1538
+ providerConfigId: req.providerConfigId ?? null,
1524
1539
  provider: req.provider,
1525
1540
  model: req.model,
1526
1541
  promptTokens: req.promptTokens,
@@ -1553,6 +1568,7 @@ const createLLMRequestsDataLayer = (db) => {
1553
1568
  configId: req.configId ?? null,
1554
1569
  variantId: req.variantId ?? null,
1555
1570
  environmentId: req.environmentId ?? null,
1571
+ providerConfigId: req.providerConfigId ?? null,
1556
1572
  provider: req.provider,
1557
1573
  model: req.model,
1558
1574
  promptTokens: req.promptTokens,
@@ -1575,11 +1591,12 @@ const createLLMRequestsDataLayer = (db) => {
1575
1591
  listRequests: async (params) => {
1576
1592
  const result = await listRequestsSchema.safeParseAsync(params || {});
1577
1593
  if (!result.success) throw new LLMOpsError(`Invalid parameters: ${result.error.message}`);
1578
- const { limit, offset, configId, variantId, environmentId, provider, model, startDate, endDate, tags } = result.data;
1594
+ const { limit, offset, configId, variantId, environmentId, providerConfigId, provider, model, startDate, endDate, tags } = result.data;
1579
1595
  let baseQuery = db.selectFrom("llm_requests");
1580
1596
  if (configId) baseQuery = baseQuery.where("configId", "=", configId);
1581
1597
  if (variantId) baseQuery = baseQuery.where("variantId", "=", variantId);
1582
1598
  if (environmentId) baseQuery = baseQuery.where("environmentId", "=", environmentId);
1599
+ if (providerConfigId) baseQuery = baseQuery.where("providerConfigId", "=", providerConfigId);
1583
1600
  if (provider) baseQuery = baseQuery.where("provider", "=", provider);
1584
1601
  if (model) baseQuery = baseQuery.where("model", "=", model);
1585
1602
  if (startDate) baseQuery = baseQuery.where(kysely.sql`${col("createdAt")} >= ${startDate.toISOString()}`);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "./index-8czO0OIS.cjs";
1
+ import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "./index-BiHQ7UWZ.cjs";
2
2
  import { Kysely } from "kysely";
3
3
  import * as zod0 from "zod";
4
4
  import z$1, { z } from "zod";
@@ -1065,6 +1065,7 @@ declare const insertLLMRequestSchema: z$1.ZodObject<{
1065
1065
  configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1066
1066
  variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1067
1067
  environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1068
+ providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1068
1069
  provider: z$1.ZodString;
1069
1070
  model: z$1.ZodString;
1070
1071
  promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
@@ -1091,6 +1092,7 @@ declare const listRequestsSchema: z$1.ZodObject<{
1091
1092
  configId: z$1.ZodOptional<z$1.ZodString>;
1092
1093
  variantId: z$1.ZodOptional<z$1.ZodString>;
1093
1094
  environmentId: z$1.ZodOptional<z$1.ZodString>;
1095
+ providerConfigId: z$1.ZodOptional<z$1.ZodString>;
1094
1096
  provider: z$1.ZodOptional<z$1.ZodString>;
1095
1097
  model: z$1.ZodOptional<z$1.ZodString>;
1096
1098
  startDate: z$1.ZodOptional<z$1.ZodDate>;
@@ -1146,6 +1148,7 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1146
1148
  environmentId: string | null;
1147
1149
  configId: string | null;
1148
1150
  requestId: string;
1151
+ providerConfigId: string | null;
1149
1152
  model: string;
1150
1153
  promptTokens: number;
1151
1154
  completionTokens: number;
@@ -1175,6 +1178,7 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1175
1178
  environmentId: string | null;
1176
1179
  configId: string | null;
1177
1180
  requestId: string;
1181
+ providerConfigId: string | null;
1178
1182
  model: string;
1179
1183
  promptTokens: number;
1180
1184
  completionTokens: number;
@@ -1206,6 +1210,7 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1206
1210
  environmentId: string | null;
1207
1211
  configId: string | null;
1208
1212
  requestId: string;
1213
+ providerConfigId: string | null;
1209
1214
  model: string;
1210
1215
  promptTokens: number;
1211
1216
  completionTokens: number;
@@ -2004,6 +2009,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2004
2009
  environmentId: string | null;
2005
2010
  configId: string | null;
2006
2011
  requestId: string;
2012
+ providerConfigId: string | null;
2007
2013
  model: string;
2008
2014
  promptTokens: number;
2009
2015
  completionTokens: number;
@@ -2025,6 +2031,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2025
2031
  configId: zod0.ZodOptional<zod0.ZodString>;
2026
2032
  variantId: zod0.ZodOptional<zod0.ZodString>;
2027
2033
  environmentId: zod0.ZodOptional<zod0.ZodString>;
2034
+ providerConfigId: zod0.ZodOptional<zod0.ZodString>;
2028
2035
  provider: zod0.ZodOptional<zod0.ZodString>;
2029
2036
  model: zod0.ZodOptional<zod0.ZodString>;
2030
2037
  startDate: zod0.ZodOptional<zod0.ZodDate>;
@@ -2040,6 +2047,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2040
2047
  environmentId: string | null;
2041
2048
  configId: string | null;
2042
2049
  requestId: string;
2050
+ providerConfigId: string | null;
2043
2051
  model: string;
2044
2052
  promptTokens: number;
2045
2053
  completionTokens: number;
@@ -2068,6 +2076,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2068
2076
  environmentId: string | null;
2069
2077
  configId: string | null;
2070
2078
  requestId: string;
2079
+ providerConfigId: string | null;
2071
2080
  model: string;
2072
2081
  promptTokens: number;
2073
2082
  completionTokens: number;
@@ -2496,11 +2505,12 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2496
2505
  configId: zod0.ZodString;
2497
2506
  envSecret: zod0.ZodOptional<zod0.ZodString>;
2498
2507
  }, better_auth0.$strip>>) => Promise<{
2508
+ provider: string;
2509
+ providerConfigId: string | null;
2499
2510
  configId: string;
2500
2511
  variantId: string;
2501
2512
  environmentId: string;
2502
2513
  version: number;
2503
- provider: string;
2504
2514
  modelName: string;
2505
2515
  jsonData: Record<string, unknown>;
2506
2516
  }>;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "./index-BEoqwM0H.mjs";
1
+ import { A as SCHEMA_METADATA, B as WorkspaceSettings, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as Updateable, G as environmentsSchema, H as configVariantsSchema, I as Variant, J as schemas, K as llmRequestsSchema, L as VariantVersion, M as TableName, N as TargetingRule, O as ProviderConfig, P as TargetingRulesTable, Q as workspaceSettingsSchema, R as VariantVersionsTable, S as EnvironmentSecret, T as Insertable, U as configsSchema, V as WorkspaceSettingsTable, W as environmentSecretsSchema, X as variantVersionsSchema, Y as targetingRulesSchema, Z as variantsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Selectable, k as ProviderConfigsTable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as providerConfigsSchema, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as VariantsTable } from "./index-CVGG0zoD.mjs";
2
2
  import gateway from "@llmops/gateway";
3
3
  import { Kysely } from "kysely";
4
4
  import pino from "pino";
@@ -1065,6 +1065,7 @@ declare const insertLLMRequestSchema: z$1.ZodObject<{
1065
1065
  configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1066
1066
  variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1067
1067
  environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1068
+ providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1068
1069
  provider: z$1.ZodString;
1069
1070
  model: z$1.ZodString;
1070
1071
  promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
@@ -1091,6 +1092,7 @@ declare const listRequestsSchema: z$1.ZodObject<{
1091
1092
  configId: z$1.ZodOptional<z$1.ZodString>;
1092
1093
  variantId: z$1.ZodOptional<z$1.ZodString>;
1093
1094
  environmentId: z$1.ZodOptional<z$1.ZodString>;
1095
+ providerConfigId: z$1.ZodOptional<z$1.ZodString>;
1094
1096
  provider: z$1.ZodOptional<z$1.ZodString>;
1095
1097
  model: z$1.ZodOptional<z$1.ZodString>;
1096
1098
  startDate: z$1.ZodOptional<z$1.ZodDate>;
@@ -1146,6 +1148,7 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1146
1148
  environmentId: string | null;
1147
1149
  configId: string | null;
1148
1150
  requestId: string;
1151
+ providerConfigId: string | null;
1149
1152
  model: string;
1150
1153
  promptTokens: number;
1151
1154
  completionTokens: number;
@@ -1175,6 +1178,7 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1175
1178
  environmentId: string | null;
1176
1179
  configId: string | null;
1177
1180
  requestId: string;
1181
+ providerConfigId: string | null;
1178
1182
  model: string;
1179
1183
  promptTokens: number;
1180
1184
  completionTokens: number;
@@ -1206,6 +1210,7 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1206
1210
  environmentId: string | null;
1207
1211
  configId: string | null;
1208
1212
  requestId: string;
1213
+ providerConfigId: string | null;
1209
1214
  model: string;
1210
1215
  promptTokens: number;
1211
1216
  completionTokens: number;
@@ -2004,6 +2009,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2004
2009
  environmentId: string | null;
2005
2010
  configId: string | null;
2006
2011
  requestId: string;
2012
+ providerConfigId: string | null;
2007
2013
  model: string;
2008
2014
  promptTokens: number;
2009
2015
  completionTokens: number;
@@ -2025,6 +2031,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2025
2031
  configId: zod33.ZodOptional<zod33.ZodString>;
2026
2032
  variantId: zod33.ZodOptional<zod33.ZodString>;
2027
2033
  environmentId: zod33.ZodOptional<zod33.ZodString>;
2034
+ providerConfigId: zod33.ZodOptional<zod33.ZodString>;
2028
2035
  provider: zod33.ZodOptional<zod33.ZodString>;
2029
2036
  model: zod33.ZodOptional<zod33.ZodString>;
2030
2037
  startDate: zod33.ZodOptional<zod33.ZodDate>;
@@ -2040,6 +2047,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2040
2047
  environmentId: string | null;
2041
2048
  configId: string | null;
2042
2049
  requestId: string;
2050
+ providerConfigId: string | null;
2043
2051
  model: string;
2044
2052
  promptTokens: number;
2045
2053
  completionTokens: number;
@@ -2068,6 +2076,7 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2068
2076
  environmentId: string | null;
2069
2077
  configId: string | null;
2070
2078
  requestId: string;
2079
+ providerConfigId: string | null;
2071
2080
  model: string;
2072
2081
  promptTokens: number;
2073
2082
  completionTokens: number;
@@ -2496,11 +2505,12 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
2496
2505
  configId: zod33.ZodString;
2497
2506
  envSecret: zod33.ZodOptional<zod33.ZodString>;
2498
2507
  }, better_auth0.$strip>>) => Promise<{
2508
+ provider: string;
2509
+ providerConfigId: string | null;
2499
2510
  configId: string;
2500
2511
  variantId: string;
2501
2512
  environmentId: string;
2502
2513
  version: number;
2503
- provider: string;
2504
2514
  modelName: string;
2505
2515
  jsonData: Record<string, unknown>;
2506
2516
  }>;
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { A as literal, C as variantsSchema, D as any, E as _enum, F as union, I as unknown, M as object, N as record, O as array, P as string, S as variantVersionsSchema, T as zod_default, _ as environmentsSchema, a as matchType, b as schemas, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as number, k as boolean, 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 llmRequestsSchema, w as workspaceSettingsSchema, x as targetingRulesSchema, y as providerConfigsSchema } from "./db-DA8xIZ3w.mjs";
1
+ "use node";
2
+ import { A as literal, C as variantsSchema, D as any, E as _enum, F as union, I as unknown, M as object, N as record, O as array, P as string, S as variantVersionsSchema, T as zod_default, _ as environmentsSchema, a as matchType, b as schemas, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as number, k as boolean, 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 llmRequestsSchema, w as workspaceSettingsSchema, x as targetingRulesSchema, y as providerConfigsSchema } from "./db-SQ9IcEvp.mjs";
2
3
  import gateway from "@llmops/gateway";
3
4
  import { sql } from "kysely";
4
5
  import * as fs from "node:fs/promises";
@@ -1261,8 +1262,19 @@ const createConfigVariantDataLayer = (db) => {
1261
1262
  "version"
1262
1263
  ]).where("variantId", "=", configVariant.variantId).orderBy("version", "desc").limit(1).executeTakeFirst();
1263
1264
  if (!versionData) throw new LLMOpsError(`No variant version found for variant ${configVariant.variantId}`);
1265
+ let finalProvider = versionData.provider;
1266
+ let providerConfigId = null;
1267
+ if (UUID_REGEX.test(versionData.provider)) {
1268
+ const providerConfig = await db.selectFrom("provider_configs").select(["id", "providerId"]).where("id", "=", versionData.provider).executeTakeFirst();
1269
+ if (providerConfig) {
1270
+ finalProvider = providerConfig.providerId;
1271
+ providerConfigId = providerConfig.id;
1272
+ }
1273
+ }
1264
1274
  return {
1265
1275
  ...versionData,
1276
+ provider: finalProvider,
1277
+ providerConfigId,
1266
1278
  configId: resolvedConfigId,
1267
1279
  variantId: configVariant.variantId,
1268
1280
  environmentId
@@ -1436,6 +1448,7 @@ const insertLLMRequestSchema = zod_default.object({
1436
1448
  configId: zod_default.string().uuid().nullable().optional(),
1437
1449
  variantId: zod_default.string().uuid().nullable().optional(),
1438
1450
  environmentId: zod_default.string().uuid().nullable().optional(),
1451
+ providerConfigId: zod_default.string().uuid().nullable().optional(),
1439
1452
  provider: zod_default.string(),
1440
1453
  model: zod_default.string(),
1441
1454
  promptTokens: zod_default.number().int().default(0),
@@ -1461,6 +1474,7 @@ const listRequestsSchema = zod_default.object({
1461
1474
  configId: zod_default.string().uuid().optional(),
1462
1475
  variantId: zod_default.string().uuid().optional(),
1463
1476
  environmentId: zod_default.string().uuid().optional(),
1477
+ providerConfigId: zod_default.string().uuid().optional(),
1464
1478
  provider: zod_default.string().optional(),
1465
1479
  model: zod_default.string().optional(),
1466
1480
  startDate: zod_default.date().optional(),
@@ -1518,6 +1532,7 @@ const createLLMRequestsDataLayer = (db) => {
1518
1532
  configId: req.configId ?? null,
1519
1533
  variantId: req.variantId ?? null,
1520
1534
  environmentId: req.environmentId ?? null,
1535
+ providerConfigId: req.providerConfigId ?? null,
1521
1536
  provider: req.provider,
1522
1537
  model: req.model,
1523
1538
  promptTokens: req.promptTokens,
@@ -1550,6 +1565,7 @@ const createLLMRequestsDataLayer = (db) => {
1550
1565
  configId: req.configId ?? null,
1551
1566
  variantId: req.variantId ?? null,
1552
1567
  environmentId: req.environmentId ?? null,
1568
+ providerConfigId: req.providerConfigId ?? null,
1553
1569
  provider: req.provider,
1554
1570
  model: req.model,
1555
1571
  promptTokens: req.promptTokens,
@@ -1572,11 +1588,12 @@ const createLLMRequestsDataLayer = (db) => {
1572
1588
  listRequests: async (params) => {
1573
1589
  const result = await listRequestsSchema.safeParseAsync(params || {});
1574
1590
  if (!result.success) throw new LLMOpsError(`Invalid parameters: ${result.error.message}`);
1575
- const { limit, offset, configId, variantId, environmentId, provider, model, startDate, endDate, tags } = result.data;
1591
+ const { limit, offset, configId, variantId, environmentId, providerConfigId, provider, model, startDate, endDate, tags } = result.data;
1576
1592
  let baseQuery = db.selectFrom("llm_requests");
1577
1593
  if (configId) baseQuery = baseQuery.where("configId", "=", configId);
1578
1594
  if (variantId) baseQuery = baseQuery.where("variantId", "=", variantId);
1579
1595
  if (environmentId) baseQuery = baseQuery.where("environmentId", "=", environmentId);
1596
+ if (providerConfigId) baseQuery = baseQuery.where("providerConfigId", "=", providerConfigId);
1580
1597
  if (provider) baseQuery = baseQuery.where("provider", "=", provider);
1581
1598
  if (model) baseQuery = baseQuery.where("model", "=", model);
1582
1599
  if (startDate) baseQuery = baseQuery.where(sql`${col("createdAt")} >= ${startDate.toISOString()}`);
@@ -1,3 +1,4 @@
1
+ "use node";
1
2
  import { CompiledQuery, DEFAULT_MIGRATION_LOCK_TABLE, DEFAULT_MIGRATION_TABLE, DefaultQueryCompiler, sql } from "kysely";
2
3
 
3
4
  //#region src/db/node-sqlite-dialect.ts
@@ -1,4 +1,5 @@
1
- const require_db = require('./db-CzLvkATK.cjs');
1
+ "use node";
2
+ const require_db = require('./db-CGuiUiaR.cjs');
2
3
  let kysely = require("kysely");
3
4
 
4
5
  //#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.2.11-beta.1",
3
+ "version": "0.2.11-beta.3",
4
4
  "description": "Core LLMOps functionality and utilities",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -52,7 +52,7 @@
52
52
  "hono": "^4.10.7",
53
53
  "kysely": "^0.28.8",
54
54
  "pino": "^10.1.0",
55
- "@llmops/gateway": "^0.2.11-beta.1"
55
+ "@llmops/gateway": "^0.2.11-beta.3"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsdown",