Skip to content

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

chore: ensure model parameters are cast correctly in clickhouse ingestion (#3992)

Steffen Schmitz4685d0b1b62d
diff --git a/packages/shared/src/server/definitions.ts b/packages/shared/src/server/definitions.ts
index c8b6ee84ef..b8a7829af9 100644
--- a/packages/shared/src/server/definitions.ts
+++ b/packages/shared/src/server/definitions.ts
@@ -244,7 +244,9 @@ export const convertPostgresObservationToInsert = (
output: observation.output ? JSON.stringify(observation.output) : null,
provided_model_name: observation.model,
internal_model_id: observation.internal_model_id,
- model_parameters: observation.model_parameters,
+ model_parameters: observation.model_parameters
+ ? JSON.stringify(observation.model_parameters)
+ : null,
provided_usage_details: {},
usage_details: {
input: observation.prompt_tokens,
diff --git a/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts b/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
index 72d625a4d5..e09dfccc7b 100644
--- a/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
+++ b/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
@@ -1071,6 +1071,7 @@ describe("Ingestion end-to-end tests", () => {
startTime: new Date(oldEvent),
// Validates that numbers are parsed correctly. Since there is no usage, no effect on result
calculatedTotalCost: "0.273330000000000000000000000000",
+ modelParameters: { hello: "world" },
},
});
@@ -1082,7 +1083,6 @@ describe("Ingestion end-to-end tests", () => {
body: {
id: observationId,
traceId: traceId,
- modelParameters: { someKey: ["user-1", "user-2"] },
output: "overwritten",
usage: null,
},
@@ -1105,6 +1105,7 @@ describe("Ingestion end-to-end tests", () => {
expect(observation.name).toBe("generation-name");
expect(observation.input).toBe(JSON.stringify({ key: "value" }));
expect(observation.output).toBe("overwritten");
+ expect(observation.model_parameters).toBe('{"hello":"world"}');
expect(observation.project_id).toBe("7a88fb47-b4e2-43b8-a06c-a5ce950dc53a");
});