@llmops/core 0.6.6 → 0.6.7-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/index.cjs CHANGED
@@ -3178,7 +3178,11 @@ const insertSpanSchema = require_db.zod_default.object({
3178
3178
  environmentId: require_db.zod_default.string().uuid().nullable().optional(),
3179
3179
  providerConfigId: require_db.zod_default.string().uuid().nullable().optional(),
3180
3180
  requestId: require_db.zod_default.string().uuid().nullable().optional(),
3181
- source: require_db.zod_default.enum(["gateway", "otlp"]).default("gateway"),
3181
+ source: require_db.zod_default.enum([
3182
+ "gateway",
3183
+ "otlp",
3184
+ "langsmith"
3185
+ ]).default("gateway"),
3182
3186
  input: require_db.zod_default.unknown().nullable().optional(),
3183
3187
  output: require_db.zod_default.unknown().nullable().optional(),
3184
3188
  attributes: require_db.zod_default.record(require_db.zod_default.string(), require_db.zod_default.unknown()).default({})
@@ -3276,11 +3280,16 @@ const createTracesDataLayer = (db) => {
3276
3280
  },
3277
3281
  batchInsertSpans: async (spans) => {
3278
3282
  if (spans.length === 0) return { count: 0 };
3279
- const validatedSpans = await Promise.all(spans.map(async (span) => {
3283
+ const validatedSpans = [];
3284
+ for (const span of spans) {
3280
3285
  const result = await insertSpanSchema.safeParseAsync(span);
3281
- if (!result.success) throw new LLMOpsError(`Invalid span data: ${result.error.message}`);
3282
- return result.data;
3283
- }));
3286
+ if (!result.success) {
3287
+ require_db.logger.warn(`[batchInsertSpans] Skipping invalid span ${span.spanId}: ${result.error.message}`);
3288
+ continue;
3289
+ }
3290
+ validatedSpans.push(result.data);
3291
+ }
3292
+ if (validatedSpans.length === 0) return { count: 0 };
3284
3293
  const now = (/* @__PURE__ */ new Date()).toISOString();
3285
3294
  const values = validatedSpans.map((span) => ({
3286
3295
  id: (0, node_crypto.randomUUID)(),
@@ -3317,11 +3326,16 @@ const createTracesDataLayer = (db) => {
3317
3326
  },
3318
3327
  batchInsertSpanEvents: async (events) => {
3319
3328
  if (events.length === 0) return { count: 0 };
3320
- const validatedEvents = await Promise.all(events.map(async (event) => {
3329
+ const validatedEvents = [];
3330
+ for (const event of events) {
3321
3331
  const result = await insertSpanEventSchema.safeParseAsync(event);
3322
- if (!result.success) throw new LLMOpsError(`Invalid span event data: ${result.error.message}`);
3323
- return result.data;
3324
- }));
3332
+ if (!result.success) {
3333
+ require_db.logger.warn(`[batchInsertSpanEvents] Skipping invalid event: ${result.error.message}`);
3334
+ continue;
3335
+ }
3336
+ validatedEvents.push(result.data);
3337
+ }
3338
+ if (validatedEvents.length === 0) return { count: 0 };
3325
3339
  const now = (/* @__PURE__ */ new Date()).toISOString();
3326
3340
  const values = validatedEvents.map((event) => ({
3327
3341
  id: (0, node_crypto.randomUUID)(),
package/dist/index.d.cts CHANGED
@@ -3268,6 +3268,7 @@ declare const insertSpanSchema: z$1.ZodObject<{
3268
3268
  source: z$1.ZodDefault<z$1.ZodEnum<{
3269
3269
  gateway: "gateway";
3270
3270
  otlp: "otlp";
3271
+ langsmith: "langsmith";
3271
3272
  }>>;
3272
3273
  input: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
3273
3274
  output: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
package/dist/index.d.mts CHANGED
@@ -3268,6 +3268,7 @@ declare const insertSpanSchema: z$1.ZodObject<{
3268
3268
  source: z$1.ZodDefault<z$1.ZodEnum<{
3269
3269
  gateway: "gateway";
3270
3270
  otlp: "otlp";
3271
+ langsmith: "langsmith";
3271
3272
  }>>;
3272
3273
  input: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
3273
3274
  output: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
package/dist/index.mjs CHANGED
@@ -3174,7 +3174,11 @@ const insertSpanSchema = zod_default.object({
3174
3174
  environmentId: zod_default.string().uuid().nullable().optional(),
3175
3175
  providerConfigId: zod_default.string().uuid().nullable().optional(),
3176
3176
  requestId: zod_default.string().uuid().nullable().optional(),
3177
- source: zod_default.enum(["gateway", "otlp"]).default("gateway"),
3177
+ source: zod_default.enum([
3178
+ "gateway",
3179
+ "otlp",
3180
+ "langsmith"
3181
+ ]).default("gateway"),
3178
3182
  input: zod_default.unknown().nullable().optional(),
3179
3183
  output: zod_default.unknown().nullable().optional(),
3180
3184
  attributes: zod_default.record(zod_default.string(), zod_default.unknown()).default({})
@@ -3272,11 +3276,16 @@ const createTracesDataLayer = (db) => {
3272
3276
  },
3273
3277
  batchInsertSpans: async (spans) => {
3274
3278
  if (spans.length === 0) return { count: 0 };
3275
- const validatedSpans = await Promise.all(spans.map(async (span) => {
3279
+ const validatedSpans = [];
3280
+ for (const span of spans) {
3276
3281
  const result = await insertSpanSchema.safeParseAsync(span);
3277
- if (!result.success) throw new LLMOpsError(`Invalid span data: ${result.error.message}`);
3278
- return result.data;
3279
- }));
3282
+ if (!result.success) {
3283
+ logger.warn(`[batchInsertSpans] Skipping invalid span ${span.spanId}: ${result.error.message}`);
3284
+ continue;
3285
+ }
3286
+ validatedSpans.push(result.data);
3287
+ }
3288
+ if (validatedSpans.length === 0) return { count: 0 };
3280
3289
  const now = (/* @__PURE__ */ new Date()).toISOString();
3281
3290
  const values = validatedSpans.map((span) => ({
3282
3291
  id: randomUUID(),
@@ -3313,11 +3322,16 @@ const createTracesDataLayer = (db) => {
3313
3322
  },
3314
3323
  batchInsertSpanEvents: async (events) => {
3315
3324
  if (events.length === 0) return { count: 0 };
3316
- const validatedEvents = await Promise.all(events.map(async (event) => {
3325
+ const validatedEvents = [];
3326
+ for (const event of events) {
3317
3327
  const result = await insertSpanEventSchema.safeParseAsync(event);
3318
- if (!result.success) throw new LLMOpsError(`Invalid span event data: ${result.error.message}`);
3319
- return result.data;
3320
- }));
3328
+ if (!result.success) {
3329
+ logger.warn(`[batchInsertSpanEvents] Skipping invalid event: ${result.error.message}`);
3330
+ continue;
3331
+ }
3332
+ validatedEvents.push(result.data);
3333
+ }
3334
+ if (validatedEvents.length === 0) return { count: 0 };
3321
3335
  const now = (/* @__PURE__ */ new Date()).toISOString();
3322
3336
  const values = validatedEvents.map((event) => ({
3323
3337
  id: randomUUID(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/core",
3
- "version": "0.6.6",
3
+ "version": "0.6.7-beta.2",
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.6"
58
+ "@llmops/gateway": "^0.6.7-beta.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/json-logic-js": "^2.0.8",