From 829f790ba4870305f2d2606f1e7438a692146753 Mon Sep 17 00:00:00 2001 From: shabanshaame Date: Tue, 12 May 2026 09:43:07 +0200 Subject: [PATCH] fix(zep): normalize bare YYYY-MM-DD createdAt to ISO 8601 Zep Cloud's /api/v2/graph-batch endpoint rejects bare date strings (e.g. "2025-01-03") with a misleading "400 invalid json" error, even though the payload is valid JSON. Datasets that store dates without a time component (common for daily-bucketed corpora) cannot be ingested as a result. Normalize bare YYYY-MM-DD values to midnight UTC before building the episode; full ISO strings pass through unchanged. Discovered while running Structured Recall Bench (github.com/everdreamsoft/structured-recall-bench), whose dataset sessions carry metadata.date = "YYYY-MM-DD". With this fix, the full 130-question benchmark runs cleanly against Zep Cloud (composite 0.332, ingestion ~15 min, no API errors). Repro (minimal): import { ZepClient } from "@getzep/zep-cloud" const client = new ZepClient({ apiKey: process.env.ZEP_API_KEY! }) await client.graph.create({ graphId: "repro", name: "repro" }) await client.graph.addBatch({ graphId: "repro", episodes: [{ type: "message", data: "user: hi", createdAt: "2025-01-03" }], }) // throws BadRequestError: invalid json Behavior table (Zep Cloud, SDK @getzep/zep-cloud, 2026-04-20): createdAt value | Result -------------------------|--------------------------- "2025-01-03" | 400 invalid json "2025-01-03T00:00:00Z" | 200 OK omitted | 200 OK (server fills now) --- src/providers/zep/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/providers/zep/index.ts b/src/providers/zep/index.ts index a1fee64..083b3db 100644 --- a/src/providers/zep/index.ts +++ b/src/providers/zep/index.ts @@ -125,7 +125,9 @@ export class ZepProvider implements Provider { const episodes: Zep.EpisodeData[] = [] for (const session of sessions) { - const isoDate = session.metadata?.date as string | undefined + const rawDate = session.metadata?.date as string | undefined + const isoDate = + rawDate && /^\d{4}-\d{2}-\d{2}$/.test(rawDate) ? `${rawDate}T00:00:00Z` : rawDate for (const message of session.messages) { const speaker = message.speaker || message.role