@llmops/core 0.2.11-beta.1 → 0.2.11-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.
- package/dist/{bun-sqlite-dialect-DxPi9X8H.cjs → bun-sqlite-dialect-t1xHHJDz.cjs} +1 -1
- package/dist/db/index.cjs +1 -1
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/{db-DA8xIZ3w.mjs → db-BGDhJROC.mjs} +9 -0
- package/dist/{db-CzLvkATK.cjs → db-CqDD6Ydv.cjs} +11 -2
- package/dist/{index-BEoqwM0H.d.mts → index-BUlmWTh7.d.cts} +18 -0
- package/dist/{index-8czO0OIS.d.cts → index-CVGG0zoD.d.mts} +53 -35
- package/dist/index.cjs +18 -2
- package/dist/index.d.cts +278 -268
- package/dist/index.d.mts +12 -2
- package/dist/index.mjs +18 -2
- package/dist/{node-sqlite-dialect-Ckt6QTf5.cjs → node-sqlite-dialect-D4V5e49r.cjs} +1 -1
- package/package.json +2 -2
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-
|
|
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,4 @@
|
|
|
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-
|
|
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-BGDhJROC.mjs";
|
|
2
2
|
import gateway from "@llmops/gateway";
|
|
3
3
|
import { sql } from "kysely";
|
|
4
4
|
import * as fs from "node:fs/promises";
|
|
@@ -1261,8 +1261,19 @@ const createConfigVariantDataLayer = (db) => {
|
|
|
1261
1261
|
"version"
|
|
1262
1262
|
]).where("variantId", "=", configVariant.variantId).orderBy("version", "desc").limit(1).executeTakeFirst();
|
|
1263
1263
|
if (!versionData) throw new LLMOpsError(`No variant version found for variant ${configVariant.variantId}`);
|
|
1264
|
+
let finalProvider = versionData.provider;
|
|
1265
|
+
let providerConfigId = null;
|
|
1266
|
+
if (UUID_REGEX.test(versionData.provider)) {
|
|
1267
|
+
const providerConfig = await db.selectFrom("provider_configs").select(["id", "providerId"]).where("id", "=", versionData.provider).executeTakeFirst();
|
|
1268
|
+
if (providerConfig) {
|
|
1269
|
+
finalProvider = providerConfig.providerId;
|
|
1270
|
+
providerConfigId = providerConfig.id;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1264
1273
|
return {
|
|
1265
1274
|
...versionData,
|
|
1275
|
+
provider: finalProvider,
|
|
1276
|
+
providerConfigId,
|
|
1266
1277
|
configId: resolvedConfigId,
|
|
1267
1278
|
variantId: configVariant.variantId,
|
|
1268
1279
|
environmentId
|
|
@@ -1436,6 +1447,7 @@ const insertLLMRequestSchema = zod_default.object({
|
|
|
1436
1447
|
configId: zod_default.string().uuid().nullable().optional(),
|
|
1437
1448
|
variantId: zod_default.string().uuid().nullable().optional(),
|
|
1438
1449
|
environmentId: zod_default.string().uuid().nullable().optional(),
|
|
1450
|
+
providerConfigId: zod_default.string().uuid().nullable().optional(),
|
|
1439
1451
|
provider: zod_default.string(),
|
|
1440
1452
|
model: zod_default.string(),
|
|
1441
1453
|
promptTokens: zod_default.number().int().default(0),
|
|
@@ -1461,6 +1473,7 @@ const listRequestsSchema = zod_default.object({
|
|
|
1461
1473
|
configId: zod_default.string().uuid().optional(),
|
|
1462
1474
|
variantId: zod_default.string().uuid().optional(),
|
|
1463
1475
|
environmentId: zod_default.string().uuid().optional(),
|
|
1476
|
+
providerConfigId: zod_default.string().uuid().optional(),
|
|
1464
1477
|
provider: zod_default.string().optional(),
|
|
1465
1478
|
model: zod_default.string().optional(),
|
|
1466
1479
|
startDate: zod_default.date().optional(),
|
|
@@ -1518,6 +1531,7 @@ const createLLMRequestsDataLayer = (db) => {
|
|
|
1518
1531
|
configId: req.configId ?? null,
|
|
1519
1532
|
variantId: req.variantId ?? null,
|
|
1520
1533
|
environmentId: req.environmentId ?? null,
|
|
1534
|
+
providerConfigId: req.providerConfigId ?? null,
|
|
1521
1535
|
provider: req.provider,
|
|
1522
1536
|
model: req.model,
|
|
1523
1537
|
promptTokens: req.promptTokens,
|
|
@@ -1550,6 +1564,7 @@ const createLLMRequestsDataLayer = (db) => {
|
|
|
1550
1564
|
configId: req.configId ?? null,
|
|
1551
1565
|
variantId: req.variantId ?? null,
|
|
1552
1566
|
environmentId: req.environmentId ?? null,
|
|
1567
|
+
providerConfigId: req.providerConfigId ?? null,
|
|
1553
1568
|
provider: req.provider,
|
|
1554
1569
|
model: req.model,
|
|
1555
1570
|
promptTokens: req.promptTokens,
|
|
@@ -1572,11 +1587,12 @@ const createLLMRequestsDataLayer = (db) => {
|
|
|
1572
1587
|
listRequests: async (params) => {
|
|
1573
1588
|
const result = await listRequestsSchema.safeParseAsync(params || {});
|
|
1574
1589
|
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;
|
|
1590
|
+
const { limit, offset, configId, variantId, environmentId, providerConfigId, provider, model, startDate, endDate, tags } = result.data;
|
|
1576
1591
|
let baseQuery = db.selectFrom("llm_requests");
|
|
1577
1592
|
if (configId) baseQuery = baseQuery.where("configId", "=", configId);
|
|
1578
1593
|
if (variantId) baseQuery = baseQuery.where("variantId", "=", variantId);
|
|
1579
1594
|
if (environmentId) baseQuery = baseQuery.where("environmentId", "=", environmentId);
|
|
1595
|
+
if (providerConfigId) baseQuery = baseQuery.where("providerConfigId", "=", providerConfigId);
|
|
1580
1596
|
if (provider) baseQuery = baseQuery.where("provider", "=", provider);
|
|
1581
1597
|
if (model) baseQuery = baseQuery.where("model", "=", model);
|
|
1582
1598
|
if (startDate) baseQuery = baseQuery.where(sql`${col("createdAt")} >= ${startDate.toISOString()}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/core",
|
|
3
|
-
"version": "0.2.11-beta.
|
|
3
|
+
"version": "0.2.11-beta.2",
|
|
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.
|
|
55
|
+
"@llmops/gateway": "^0.2.11-beta.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|