Skip to content

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

fix(ui-jump-to-playground): allow response format in modelParams (#6955)

Hassieb Pakzad71dde233c53b
diff --git a/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx b/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx
index 221ea6ea35..0986411a0c 100644
--- a/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx
+++ b/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx
@@ -423,6 +423,29 @@ function parseStructuredOutputSchema(
schema: parseStructuredOutputSchema.data.json_schema.schema,
};
}
+
+ // LiteLLM records response_format in model params
+ const modelParams = generation.modelParameters;
+
+ if (
+ modelParams &&
+ typeof modelParams === "object" &&
+ "response_format" in modelParams &&
+ typeof modelParams["response_format"] === "string"
+ ) {
+ const parsedResponseFormat = JSON.parse(modelParams["response_format"]);
+
+ const parseStructuredOutputSchema =
+ OpenAIResponseFormatSchema.safeParse(parsedResponseFormat);
+
+ if (parseStructuredOutputSchema.success)
+ return {
+ id: Math.random().toString(36).substring(2),
+ name: parseStructuredOutputSchema.data.json_schema.name,
+ description: "Schema parsed from generation",
+ schema: parseStructuredOutputSchema.data.json_schema.schema,
+ };
+ }
} catch {}
return null;
}