🪢 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
fix(json-view): tighter ChatML validation (#8225)
Nimar683aae0069fc
diff --git a/web/src/components/ui/PrettyJsonView.tsx b/web/src/components/ui/PrettyJsonView.tsxindex 6b873ad752..f93aab7dc7 100644--- a/web/src/components/ui/PrettyJsonView.tsx+++ b/web/src/components/ui/PrettyJsonView.tsx@@ -146,7 +146,16 @@ function isChatMLFormat(json: unknown): boolean {if (Array.isArray(json)) {const directArray = ChatMlArraySchema.safeParse(json);- if (directArray.success) return true;+ if (directArray.success) {+ // had some false positives, so we really check for role/content to validate ChatML+ const hasRoleOrContent = json.some(+ (item) =>+ typeof item === "object" &&+ item !== null &&+ ("role" in item || "content" in item),+ );+ return hasRoleOrContent;+ }}if ("messages" in json && Array.isArray((json as any).messages)) {