Skip to content

Commit 9f289ad

Browse files
committed
ai-assistant: Upgrade zod to 4.1.12
Also fix some issues related to the upgrade found with ts. Signed-off-by: René Dudfield <renedudfield@microsoft.com>
1 parent a8f03f1 commit 9f289ad

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

ai-assistant/package-lock.json

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ai-assistant/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"remark-gfm": "^4.0.1",
5555
"sanitize-html": "^2.17.0",
5656
"use-between": "^1.3.5",
57-
"zod": "^3.24.2"
57+
"zod": "^4.1.12"
5858
},
5959
"overrides": {
6060
"typescript": "5.6.2"

ai-assistant/src/langchain/OutputParsers.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const resourceListParser = StructuredOutputParser.fromZodSchema(
7373
status: z.string().describe('Current status'),
7474
age: z.string().describe('Age of the resource'),
7575
additionalInfo: z
76-
.record(z.string())
76+
.record(z.string(), z.string())
7777
.optional()
7878
.describe('Additional resource-specific information'),
7979
})
@@ -128,7 +128,9 @@ export const actionSuggestionParser = StructuredOutputParser.fromZodSchema(
128128
.array(
129129
z.object({
130130
toolName: z.string().describe('Name of the tool to use'),
131-
parameters: z.record(z.any()).describe('Parameters for the tool call'),
131+
parameters: z
132+
.record(z.string(), z.any())
133+
.describe('Parameters for the tool call'),
132134
description: z.string().describe('What this tool action accomplishes'),
133135
})
134136
)
@@ -155,7 +157,7 @@ export async function safeParseResponse<T extends z.ZodTypeAny>(
155157
): Promise<{ success: boolean; data?: z.infer<T>; error?: string }> {
156158
try {
157159
const parsed = await parser.parse(response);
158-
return { success: true, data: parsed };
160+
return { success: true, data: parsed as z.infer<T> };
159161
} catch (error) {
160162
console.error('Error parsing structured response:', error);
161163
return {

0 commit comments

Comments
 (0)