@llmops/core 0.2.10 → 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-DWVuvIoz.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-BgX8EJ1K.mjs → db-BGDhJROC.mjs} +57 -2
- package/dist/{db-8mMoL2a6.cjs → db-CqDD6Ydv.cjs} +59 -4
- package/dist/{index-zQzOuWsM.d.cts → index-BUlmWTh7.d.cts} +67 -36
- package/dist/{index-5GfBoyiq.d.mts → index-CVGG0zoD.d.mts} +67 -36
- package/dist/index.cjs +27 -5
- package/dist/index.d.cts +516 -487
- package/dist/index.d.mts +516 -487
- package/dist/index.mjs +27 -5
- package/dist/{node-sqlite-dialect-C9LjudrZ.cjs → node-sqlite-dialect-D4V5e49r.cjs} +1 -1
- package/package.json +2 -2
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()}`);
|
|
@@ -1780,11 +1796,13 @@ const createLLMRequestsDataLayer = (db) => {
|
|
|
1780
1796
|
//#region src/datalayer/providerConfigs.ts
|
|
1781
1797
|
const createProviderConfig = zod_default.object({
|
|
1782
1798
|
providerId: zod_default.string().min(1),
|
|
1799
|
+
name: zod_default.string().nullable().optional(),
|
|
1783
1800
|
config: zod_default.record(zod_default.string(), zod_default.unknown()),
|
|
1784
1801
|
enabled: zod_default.boolean().optional().default(true)
|
|
1785
1802
|
});
|
|
1786
1803
|
const updateProviderConfig = zod_default.object({
|
|
1787
1804
|
id: zod_default.uuidv4(),
|
|
1805
|
+
name: zod_default.string().nullable().optional(),
|
|
1788
1806
|
config: zod_default.record(zod_default.string(), zod_default.unknown()).optional(),
|
|
1789
1807
|
enabled: zod_default.boolean().optional()
|
|
1790
1808
|
});
|
|
@@ -1800,10 +1818,11 @@ const createProviderConfigsDataLayer = (db) => {
|
|
|
1800
1818
|
createProviderConfig: async (params) => {
|
|
1801
1819
|
const value = await createProviderConfig.safeParseAsync(params);
|
|
1802
1820
|
if (!value.success) throw new LLMOpsError(`Invalid parameters: ${value.error.message}`);
|
|
1803
|
-
const { providerId, config, enabled } = value.data;
|
|
1821
|
+
const { providerId, name, config, enabled } = value.data;
|
|
1804
1822
|
return db.insertInto("provider_configs").values({
|
|
1805
1823
|
id: randomUUID(),
|
|
1806
1824
|
providerId,
|
|
1825
|
+
name: name ?? null,
|
|
1807
1826
|
config: JSON.stringify(config),
|
|
1808
1827
|
enabled,
|
|
1809
1828
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1813,8 +1832,9 @@ const createProviderConfigsDataLayer = (db) => {
|
|
|
1813
1832
|
updateProviderConfig: async (params) => {
|
|
1814
1833
|
const value = await updateProviderConfig.safeParseAsync(params);
|
|
1815
1834
|
if (!value.success) throw new LLMOpsError(`Invalid parameters: ${value.error.message}`);
|
|
1816
|
-
const { id, config, enabled } = value.data;
|
|
1835
|
+
const { id, name, config, enabled } = value.data;
|
|
1817
1836
|
const updateData = { updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
1837
|
+
if (name !== void 0) updateData.name = name;
|
|
1818
1838
|
if (config !== void 0) updateData.config = JSON.stringify(config);
|
|
1819
1839
|
if (enabled !== void 0) updateData.enabled = enabled;
|
|
1820
1840
|
return db.updateTable("provider_configs").set(updateData).where("id", "=", id).returningAll().executeTakeFirst();
|
|
@@ -1850,9 +1870,10 @@ const createProviderConfigsDataLayer = (db) => {
|
|
|
1850
1870
|
upsertProviderConfig: async (params) => {
|
|
1851
1871
|
const value = await createProviderConfig.safeParseAsync(params);
|
|
1852
1872
|
if (!value.success) throw new LLMOpsError(`Invalid parameters: ${value.error.message}`);
|
|
1853
|
-
const { providerId, config, enabled } = value.data;
|
|
1873
|
+
const { providerId, name, config, enabled } = value.data;
|
|
1854
1874
|
const existing = await db.selectFrom("provider_configs").selectAll().where("providerId", "=", providerId).executeTakeFirst();
|
|
1855
1875
|
if (existing) return db.updateTable("provider_configs").set({
|
|
1876
|
+
name: name ?? existing.name,
|
|
1856
1877
|
config: JSON.stringify(config),
|
|
1857
1878
|
enabled,
|
|
1858
1879
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -1860,6 +1881,7 @@ const createProviderConfigsDataLayer = (db) => {
|
|
|
1860
1881
|
return db.insertInto("provider_configs").values({
|
|
1861
1882
|
id: randomUUID(),
|
|
1862
1883
|
providerId,
|
|
1884
|
+
name: name ?? null,
|
|
1863
1885
|
config: JSON.stringify(config),
|
|
1864
1886
|
enabled,
|
|
1865
1887
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/core",
|
|
3
|
-
"version": "0.2.
|
|
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.
|
|
55
|
+
"@llmops/gateway": "^0.2.11-beta.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|