Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

revert to 200 code (#490)

Max Deichmann9e1dc7acd1e4
diff --git a/src/__tests__/events.servertest.ts b/src/__tests__/events.servertest.ts
index f160bac516..9ce92ec85d 100644
--- a/src/__tests__/events.servertest.ts
+++ b/src/__tests__/events.servertest.ts
@@ -43,7 +43,7 @@ describe("/api/public/events API Endpoint", () => {
version: "2.0.0",
});
- expect(createEvent.status).toBe(201);
+ expect(createEvent.status).toBe(200);
const dbEvent = await prisma.observation.findUnique({
where: {
id: eventId,
@@ -77,7 +77,7 @@ describe("/api/public/events API Endpoint", () => {
version: "2.0.0",
});
- expect(createEvent.status).toBe(201);
+ expect(createEvent.status).toBe(200);
const dbEvent = await prisma.observation.findUnique({
where: {
id: eventId,
@@ -128,7 +128,7 @@ describe("/api/public/events API Endpoint", () => {
version: "2.0.0",
});
- expect(response.status).toBe(201);
+ expect(response.status).toBe(200);
const dbTrace = await prisma.trace.findMany({
where: {
@@ -153,7 +153,7 @@ describe("/api/public/events API Endpoint", () => {
version: "2.0.0",
});
- expect(createEvent.status).toBe(201);
+ expect(createEvent.status).toBe(200);
const dbEvent = await prisma.observation.findUnique({
where: {
id: eventId,
@@ -194,7 +194,7 @@ describe("/api/public/events API Endpoint", () => {
expect(dbTrace.length).toBe(1);
expect(dbTrace[0]?.name).toBe(eventName);
- expect(createEvent.status).toBe(201);
+ expect(createEvent.status).toBe(200);
const dbEvent = await prisma.observation.findUnique({
where: {
id: spanId,
@@ -239,7 +239,7 @@ describe("/api/public/events API Endpoint", () => {
expect(dbTrace.length).toBe(1);
expect(dbTrace[0]?.name).toBe(generationName);
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
expect(dbEvent?.id).toBe(spanId);
expect(dbEvent?.traceId).toBe(dbTrace[0]?.id);
diff --git a/src/__tests__/generations.servertest.ts b/src/__tests__/generations.servertest.ts
index 734eca0eb3..809c0f08d2 100644
--- a/src/__tests__/generations.servertest.ts
+++ b/src/__tests__/generations.servertest.ts
@@ -50,7 +50,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
id: generationId,
@@ -94,7 +94,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
id: generationId,
@@ -147,7 +147,7 @@ describe("/api/public/generations API Endpoint", () => {
version: "2.0.0",
});
- expect(response.status).toBe(201);
+ expect(response.status).toBe(200);
const dbTrace = await prisma.trace.findMany({
where: {
@@ -178,7 +178,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
id: generationId,
@@ -228,7 +228,7 @@ describe("/api/public/generations API Endpoint", () => {
expect(dbTrace.length).toBe(1);
expect(dbTrace[0]?.name).toBe(generationName);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
id: generationId,
@@ -269,7 +269,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
id: generationId,
@@ -297,7 +297,7 @@ describe("/api/public/generations API Endpoint", () => {
parentObservationId: generationId,
},
);
- expect(createGeneration2.status).toBe(201);
+ expect(createGeneration2.status).toBe(200);
const dbGeneration2 = await prisma.observation.findUnique({
where: {
@@ -332,7 +332,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findFirstOrThrow({
where: {
@@ -381,7 +381,7 @@ describe("/api/public/generations API Endpoint", () => {
expect(dbTrace.length).toBe(1);
expect(dbTrace[0]?.name).toBe(generationName);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
expect(dbGeneration?.id).toBe(generationId);
expect(dbGeneration?.traceId).toBe(dbTrace[0]?.id);
@@ -417,7 +417,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const updateGeneration = await makeAPICall(
"PATCH",
@@ -427,7 +427,7 @@ describe("/api/public/generations API Endpoint", () => {
completion: "this is a great gpt response",
},
);
- expect(updateGeneration.status).toBe(201);
+ expect(updateGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
@@ -473,7 +473,7 @@ describe("/api/public/generations API Endpoint", () => {
},
);
- expect(createGeneration.status).toBe(201);
+ expect(createGeneration.status).toBe(200);
const dbGeneration = await prisma.observation.findUnique({
where: {
diff --git a/src/__tests__/scores.servertest.ts b/src/__tests__/scores.servertest.ts
index 3cc88f92fe..99335e7a96 100644
--- a/src/__tests__/scores.servertest.ts
+++ b/src/__tests__/scores.servertest.ts
@@ -40,7 +40,7 @@ describe("/api/public/scores API Endpoint", () => {
traceId: traceId,
});
- expect(createScore.status).toBe(201);
+ expect(createScore.status).toBe(200);
const dbScore = await prisma.score.findUnique({
where: {
id: scoreId,
@@ -86,7 +86,7 @@ describe("/api/public/scores API Endpoint", () => {
traceId: traceId,
});
- expect(createScore.status).toBe(201);
+ expect(createScore.status).toBe(200);
const dbScore = await prisma.score.findUnique({
where: {
id: scoreId,
@@ -135,7 +135,7 @@ describe("/api/public/scores API Endpoint", () => {
observationId: dbGeneration[0]!.id,
});
- expect(createScore.status).toBe(201);
+ expect(createScore.status).toBe(200);
const dbScore = await prisma.score.findUnique({
where: {
id: scoreId,
diff --git a/src/__tests__/spans.servertest.ts b/src/__tests__/spans.servertest.ts
index de32ac4cb0..4fd2436723 100644
--- a/src/__tests__/spans.servertest.ts
+++ b/src/__tests__/spans.servertest.ts
@@ -44,7 +44,7 @@ describe("/api/public/spans API Endpoint", () => {
version: "2.0.0",
});
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
const dbSpan = await prisma.observation.findUnique({
where: {
id: spanId,
@@ -78,7 +78,7 @@ describe("/api/public/spans API Endpoint", () => {
version: "2.0.0",
});
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
const dbSpan = await prisma.observation.findUnique({
where: {
id: spanId,
@@ -125,7 +125,7 @@ describe("/api/public/spans API Endpoint", () => {
userId: "user-1",
projectId: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",
});
- expect(response.status).toBe(201);
+ expect(response.status).toBe(200);
const createSpan = await makeAPICall("POST", "/api/public/spans", {
id: spanId,
name: "spanName",
@@ -133,7 +133,7 @@ describe("/api/public/spans API Endpoint", () => {
traceId: traceId,
externalTraceIdType: "EXTERNAL",
});
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
const dbSpan = await prisma.observation.findFirstOrThrow({
where: {
@@ -167,7 +167,7 @@ describe("/api/public/spans API Endpoint", () => {
expect(dbTrace.length).toBe(1);
expect(dbTrace[0]?.name).toBe(spanName);
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
const dbSpan = await prisma.observation.findUnique({
where: {
id: spanId,
@@ -201,7 +201,7 @@ describe("/api/public/spans API Endpoint", () => {
version: "2.0.0",
});
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
const dbSpan = await prisma.observation.findMany({
where: {
@@ -246,7 +246,7 @@ describe("/api/public/spans API Endpoint", () => {
expect(dbTrace.length).toBe(1);
expect(dbTrace[0]?.name).toBe(generationName);
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
expect(dbSpan?.id).toBe(spanId);
expect(dbSpan?.traceId).toBe(dbTrace[0]?.id);
@@ -272,13 +272,13 @@ describe("/api/public/spans API Endpoint", () => {
version: "2.0.0",
});
- expect(createSpan.status).toBe(201);
+ expect(createSpan.status).toBe(200);
const updatedSpan = await makeAPICall("PATCH", "/api/public/spans", {
spanId: spanId,
output: { key: "this is a great gpt output" },
});
- expect(updatedSpan.status).toBe(201);
+ expect(updatedSpan.status).toBe(200);
const dbSpan = await prisma.observation.findUnique({
where: {
diff --git a/src/pages/api/public/ingestion.ts b/src/pages/api/public/ingestion.ts
index 499637582b..60f56b0577 100644
--- a/src/pages/api/public/ingestion.ts
+++ b/src/pages/api/public/ingestion.ts
@@ -304,5 +304,5 @@ export const handleBatchResultLegacy = (
errors: ["Internal Server Error"],
});
}
- return res.status(201).send(results.length > 0 ? results[0]?.result : {});
+ return res.status(200).send(results.length > 0 ? results[0]?.result : {});
};