Skip to content

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

fix(chatml): render pretty view more restricted (#9746)

Nimar0dc66d99b380
diff --git a/web/src/components/ui/PrettyJsonView.tsx b/web/src/components/ui/PrettyJsonView.tsx
index 2a5504a0f2..27220ceae2 100644
--- a/web/src/components/ui/PrettyJsonView.tsx
+++ b/web/src/components/ui/PrettyJsonView.tsx
@@ -135,14 +135,15 @@ function isChatMLFormat(json: unknown): boolean {
if (Array.isArray(json)) {
const directArray = ChatMlArraySchema.safeParse(json);
if (directArray.success) {
- // had some false positives, so we really check for role/content to validate ChatML
- const hasRoleOrContent = json.some(
+ // had some false positives, so we really check for role AND content to validate ChatML
+ const hasRoleAndContent = json.some(
(item) =>
typeof item === "object" &&
item !== null &&
- ("role" in item || "content" in item),
+ "role" in item &&
+ "content" in item,
);
- return hasRoleOrContent;
+ return hasRoleAndContent;
}
}