🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
add id to traces API
Max Deichmann1f6dd75cc6ae
diff --git a/fern/fern.config.json b/fern/fern.config.jsonindex 8f90f7fdb5..a955f6899d 100644--- a/fern/fern.config.json+++ b/fern/fern.config.json@@ -1,4 +1,4 @@{"organization": "finto",- "version": "0.11.9"+ "version": "0.12.0"}\ No newline at end of filediff --git a/fern/server/definition/trace.yml b/fern/server/definition/trace.ymlindex 2518d2c280..32d8eba3fc 100644--- a/fern/server/definition/trace.yml+++ b/fern/server/definition/trace.yml@@ -37,6 +37,7 @@ service:types:CreateTraceRequest:properties:+ id: optional<string>name: optional<string>userId: optional<string>externalId: optional<string>diff --git a/generated/openapi-server/openapi.yml b/generated/openapi-server/openapi.ymlindex 079cd83a53..2400bff746 100644--- a/generated/openapi-server/openapi.yml+++ b/generated/openapi-server/openapi.yml@@ -965,6 +965,9 @@ components:title: CreateTraceRequesttype: objectproperties:+ id:+ type: string+ nullable: truename:type: stringnullable: truediff --git a/prisma/schema.prisma b/prisma/schema.prismaindex 54f4a109ce..b8f542ae00 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -3,7 +3,7 @@generator client {provider = "prisma-client-js"- previewFeatures = ["jsonProtocol", "tracing"]+ previewFeatures = ["tracing"]}datasource db {diff --git a/src/pages/api/public/traces.ts b/src/pages/api/public/traces.tsindex 5aa80f285c..9aaa340e63 100644--- a/src/pages/api/public/traces.ts+++ b/src/pages/api/public/traces.ts@@ -5,6 +5,7 @@ import { prisma } from "@/src/server/db";import { verifyAuthHeaderAndReturnScope } from "@/src/features/publicApi/server/apiAuth";const CreateTraceSchema = z.object({+ id: z.string().nullish(),name: z.string().nullish(),externalId: z.string().nullish(),userId: z.string().nullish(),@@ -39,9 +40,8 @@ export default async function handler(if (req.method === "POST") {console.log("Trying to create trace:", req.body);- const { name, metadata, externalId, userId } = CreateTraceSchema.parse(- req.body- );+ const { id, name, metadata, externalId, userId } =+ CreateTraceSchema.parse(req.body);// CHECK ACCESS SCOPEif (authCheck.scope.accessLevel !== "all")@@ -51,6 +51,12 @@ export default async function handler(});// END CHECK ACCESS SCOPE+ if (id && externalId)+ return res.status(400).json({+ success: false,+ message: "Cannot create trace with both id and externalId",+ });+if (externalId) {// For traces created with external ids, allow upsertsconst newTrace = await prisma.trace.upsert({@@ -77,6 +83,7 @@ export default async function handler(} else {const newTrace = await prisma.trace.create({data: {+ id: id ?? undefined,timestamp: new Date(),projectId: authCheck.scope.projectId,name: name ?? undefined,