Skip to content

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

Add event types

Marc Klingenf1faac046b8f
diff --git a/prisma/migrations/20230522094431_endtime_optional/migration.sql b/prisma/migrations/20230522094431_endtime_optional/migration.sql
new file mode 100644
index 0000000000..4b1945fb80
--- /dev/null
+++ b/prisma/migrations/20230522094431_endtime_optional/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "observations" ALTER COLUMN "end_time" DROP NOT NULL;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index e252d5c6d1..0f9898386e 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -71,7 +71,7 @@ model Trace {
status String
statusMessage String? @map("status_message")
Observations Observation[]
- Metric Metric[]
+ metrics Metric[]
@@map("traces")
}
@@ -88,7 +88,7 @@ model Observation {
parentObservationId String? @map("parent_observation_id")
parent Observation? @relation("ParentChilds", fields: [parentObservationId], references: [id])
childs Observation[] @relation("ParentChilds")
- Metric Metric[]
+ metrics Metric[]
@@map("observations")
}
diff --git a/prisma/seed.ts b/prisma/seed.ts
index 8bfc1e51ca..452db13a5a 100644
--- a/prisma/seed.ts
+++ b/prisma/seed.ts
@@ -29,6 +29,24 @@ async function main() {
},
});
+ const event = await prisma.observation.create({
+ data: {
+ id: "57a266de-df34-4cea-b4e4-78vcdhuv6",
+ type: "EVENT",
+ startTime: new Date(),
+ trace: { connect: { id: trace.id } },
+ parent: {
+ connect: {
+ id: span.id,
+ },
+ },
+ name: "sales-pilot-vector-db-response",
+ attributes: {
+ docs: ["Doc 1", "Doc 2", "Doc 3"],
+ },
+ },
+ });
+
const llmCall = await prisma.observation.create({
data: {
id: "57a266de-df34-4cea-b4e4-678fdshj3678",
@@ -88,7 +106,7 @@ async function main() {
},
});
- console.log({ trace, span, llmCall, metric1, metric2 });
+ console.log({ trace, span, event, llmCall, metric1, metric2 });
}
main()
diff --git a/src/pages/traces/[traceId].tsx b/src/pages/traces/[traceId].tsx
index 7282c12195..b50eaee6d5 100644
--- a/src/pages/traces/[traceId].tsx
+++ b/src/pages/traces/[traceId].tsx
@@ -52,11 +52,7 @@ export default function TracePage() {
},
{
label: "Attributes",
- value: (
- <span className="font-mono">
- {JSON.stringify(trace.data.attributes, null, 2)}
- </span>
- ),
+ value: <JSONview json={trace.data.attributes} />,
},
{
label: "Detailed trace",