@llmops/core 0.6.7-beta.2 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2070,7 +2070,8 @@ const costSummarySchema = require_db.zod_default.object({
2070
2070
  variantId: require_db.zod_default.string().uuid().optional(),
2071
2071
  environmentId: require_db.zod_default.string().uuid().optional(),
2072
2072
  tags: require_db.zod_default.record(require_db.zod_default.string(), require_db.zod_default.array(require_db.zod_default.string())).optional(),
2073
- groupBy: require_db.zod_default.enum(COST_SUMMARY_GROUP_BY).optional()
2073
+ groupBy: require_db.zod_default.enum(COST_SUMMARY_GROUP_BY).optional(),
2074
+ tagKeys: require_db.zod_default.array(require_db.zod_default.string()).optional()
2074
2075
  });
2075
2076
  /**
2076
2077
  * Helper to create column reference for SQL
@@ -2286,7 +2287,7 @@ const createLLMRequestsDataLayer = (db) => {
2286
2287
  getCostSummary: async (params) => {
2287
2288
  const result = await costSummarySchema.safeParseAsync(params);
2288
2289
  if (!result.success) throw new LLMOpsError(`Invalid parameters: ${result.error.message}`);
2289
- const { startDate, endDate, groupBy, configId, variantId, environmentId, tags } = result.data;
2290
+ const { startDate, endDate, groupBy, configId, variantId, environmentId, tags, tagKeys } = result.data;
2290
2291
  let baseQuery = db.selectFrom("llm_requests").where(kysely.sql`${col$1("createdAt")} >= ${startDate.toISOString()}`).where(kysely.sql`${col$1("createdAt")} <= ${endDate.toISOString()}`);
2291
2292
  if (configId) baseQuery = baseQuery.where("configId", "=", configId);
2292
2293
  if (variantId) baseQuery = baseQuery.where("variantId", "=", variantId);
@@ -2345,6 +2346,10 @@ const createLLMRequestsDataLayer = (db) => {
2345
2346
  conditions.push(kysely.sql`${col$1("tags")}->>${key} IN (${valueList})`);
2346
2347
  }
2347
2348
  }
2349
+ if (tagKeys && tagKeys.length > 0) {
2350
+ const tagKeyList = kysely.sql.join(tagKeys.map((k) => kysely.sql`${k}`), kysely.sql`, `);
2351
+ conditions.push(kysely.sql`t.key IN (${tagKeyList})`);
2352
+ }
2348
2353
  const whereClause = kysely.sql.join(conditions, kysely.sql` AND `);
2349
2354
  return (await kysely.sql`
2350
2355
  SELECT t.key || ':' || t.value as "groupKey",
package/dist/index.d.cts CHANGED
@@ -2042,6 +2042,7 @@ declare const costSummarySchema: z$1.ZodObject<{
2042
2042
  day: "day";
2043
2043
  hour: "hour";
2044
2044
  }>>;
2045
+ tagKeys: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2045
2046
  }, z$1.core.$strip>;
2046
2047
  declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
2047
2048
  /**
package/dist/index.d.mts CHANGED
@@ -2042,6 +2042,7 @@ declare const costSummarySchema: z$1.ZodObject<{
2042
2042
  day: "day";
2043
2043
  hour: "hour";
2044
2044
  }>>;
2045
+ tagKeys: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2045
2046
  }, z$1.core.$strip>;
2046
2047
  declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
2047
2048
  /**
package/dist/index.mjs CHANGED
@@ -2066,7 +2066,8 @@ const costSummarySchema = zod_default.object({
2066
2066
  variantId: zod_default.string().uuid().optional(),
2067
2067
  environmentId: zod_default.string().uuid().optional(),
2068
2068
  tags: zod_default.record(zod_default.string(), zod_default.array(zod_default.string())).optional(),
2069
- groupBy: zod_default.enum(COST_SUMMARY_GROUP_BY).optional()
2069
+ groupBy: zod_default.enum(COST_SUMMARY_GROUP_BY).optional(),
2070
+ tagKeys: zod_default.array(zod_default.string()).optional()
2070
2071
  });
2071
2072
  /**
2072
2073
  * Helper to create column reference for SQL
@@ -2282,7 +2283,7 @@ const createLLMRequestsDataLayer = (db) => {
2282
2283
  getCostSummary: async (params) => {
2283
2284
  const result = await costSummarySchema.safeParseAsync(params);
2284
2285
  if (!result.success) throw new LLMOpsError(`Invalid parameters: ${result.error.message}`);
2285
- const { startDate, endDate, groupBy, configId, variantId, environmentId, tags } = result.data;
2286
+ const { startDate, endDate, groupBy, configId, variantId, environmentId, tags, tagKeys } = result.data;
2286
2287
  let baseQuery = db.selectFrom("llm_requests").where(sql`${col$1("createdAt")} >= ${startDate.toISOString()}`).where(sql`${col$1("createdAt")} <= ${endDate.toISOString()}`);
2287
2288
  if (configId) baseQuery = baseQuery.where("configId", "=", configId);
2288
2289
  if (variantId) baseQuery = baseQuery.where("variantId", "=", variantId);
@@ -2341,6 +2342,10 @@ const createLLMRequestsDataLayer = (db) => {
2341
2342
  conditions.push(sql`${col$1("tags")}->>${key} IN (${valueList})`);
2342
2343
  }
2343
2344
  }
2345
+ if (tagKeys && tagKeys.length > 0) {
2346
+ const tagKeyList = sql.join(tagKeys.map((k) => sql`${k}`), sql`, `);
2347
+ conditions.push(sql`t.key IN (${tagKeyList})`);
2348
+ }
2344
2349
  const whereClause = sql.join(conditions, sql` AND `);
2345
2350
  return (await sql`
2346
2351
  SELECT t.key || ':' || t.value as "groupKey",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/core",
3
- "version": "0.6.7-beta.2",
3
+ "version": "0.6.7",
4
4
  "description": "Core LLMOps functionality and utilities",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -55,7 +55,7 @@
55
55
  "kysely": "^0.28.8",
56
56
  "kysely-neon": "^2.0.2",
57
57
  "pino": "^10.1.0",
58
- "@llmops/gateway": "^0.6.7-beta.2"
58
+ "@llmops/gateway": "^0.6.7"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/json-logic-js": "^2.0.8",