Skip to content

Commit e6e8390

Browse files
committed
fix: improve snake case rendering of structured response keys
Signed-off-by: Nick Mitchell <[email protected]>
1 parent 3c11f87 commit e6e8390

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pdl-live-react/src/view/detail/kind/Model.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { stringify } from "yaml"
22

33
import Group from "../Group"
44
import Result from "../../Result"
5+
import { capitalizeAndUnSnakeCase } from "../../../helpers"
56

67
function tryJson(s: unknown) {
78
if (typeof s === "string") {
@@ -19,6 +20,8 @@ export default function ModelItems({
1920
}: {
2021
block: import("../../../pdl_ast").LitellmModelBlock
2122
}) {
23+
// All of this JSON stuff is to handle structured responses from the
24+
// model
2225
const json = tryJson(result)
2326
const resultForDisplay = Array.isArray(json)
2427
? json.map(({ sentence }) => sentence).join("\n")
@@ -37,7 +40,7 @@ export default function ModelItems({
3740
Object.entries(meta).map(([k, v]) => (
3841
<Result
3942
key={k + "." + idx}
40-
term={k}
43+
term={capitalizeAndUnSnakeCase(k)}
4144
result={typeof v === "object" ? stringify(v) : v}
4245
lang={typeof v === "object" ? "yaml" : undefined}
4346
/>

0 commit comments

Comments
 (0)