Skip to content

Commit b4ba9e3

Browse files
illumeskoeva
authored andcommitted
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 e2975e0 commit b4ba9e3

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-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: 3 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,7 @@ 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.record(z.string(), z.any()).describe('Parameters for the tool call'),
132132
description: z.string().describe('What this tool action accomplishes'),
133133
})
134134
)
@@ -155,7 +155,7 @@ export async function safeParseResponse<T extends z.ZodTypeAny>(
155155
): Promise<{ success: boolean; data?: z.infer<T>; error?: string }> {
156156
try {
157157
const parsed = await parser.parse(response);
158-
return { success: true, data: parsed };
158+
return { success: true, data: parsed as z.infer<T> };
159159
} catch (error) {
160160
console.error('Error parsing structured response:', error);
161161
return {

0 commit comments

Comments
 (0)