Skip to content

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

fix(IO-ui): render additional input in pretty view (#4524)

Hassieb Pakzadfe4299d30d6a
diff --git a/web/src/components/trace/IOPreview.tsx b/web/src/components/trace/IOPreview.tsx
index b07958d6f4..7754a23639 100644
--- a/web/src/components/trace/IOPreview.tsx
+++ b/web/src/components/trace/IOPreview.tsx
@@ -150,6 +150,14 @@ export const IOPreview: React.FC<{
const isPrettyViewAvailable =
inChatMlArray.success || inMarkdown.success || outMarkdown.success;
+ // If there are additional input fields beyond the messages, render them
+ const additionalInput =
+ typeof input === "object"
+ ? Object.fromEntries(
+ Object.entries(input as object).filter(([key]) => key !== "messages"),
+ )
+ : undefined;
+
// default I/O
return (
<>
@@ -190,6 +198,11 @@ export const IOPreview: React.FC<{
]),
]}
shouldRenderMarkdown
+ additionalInput={
+ Object.keys(additionalInput ?? {}).length > 0
+ ? additionalInput
+ : undefined
+ }
media={media ?? []}
/>
) : (
@@ -245,7 +258,14 @@ export const OpenAiMessageView: React.FC<{
title?: string;
shouldRenderMarkdown?: boolean;
media?: MediaReturnType[];
-}> = ({ title, messages, shouldRenderMarkdown = false, media }) => {
+ additionalInput?: Record<string, unknown>;
+}> = ({
+ title,
+ messages,
+ shouldRenderMarkdown = false,
+ media,
+ additionalInput,
+}) => {
const COLLAPSE_THRESHOLD = 3;
const [isCollapsed, setCollapsed] = useState(
messages.length > COLLAPSE_THRESHOLD ? true : null,
@@ -334,6 +354,11 @@ export const OpenAiMessageView: React.FC<{
</Fragment>
))}
</div>
+ {additionalInput && (
+ <div className="p-3">
+ <JSONView title="Additional Input" json={additionalInput} />
+ </div>
+ )}
{media && media.length > 0 && (
<>
<div className="mx-3 border-t px-2 py-1 text-xs text-muted-foreground">