-
Notifications
You must be signed in to change notification settings - Fork 237
Vercel SDK 5 + Zod 4 + Move from zsa server actions #1746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vercel SDK 5 + Zod 4 + Move from zsa server actions #1746
Conversation
1d68a17
to
47fdb6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 I removed the vercel rules. Please check this file and let me know if something on convertLatitudeMessages
method is not there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix for what was failing yesterday.
Basically I took all the types from Vercel SDK and tried to match with our message types trying to ensure the messages passed to Vercel are in their format
47fdb6c
to
2abea99
Compare
if (result) { | ||
await executeFrontendAction({ | ||
type, | ||
parameters: result as ActionFrontendParameters<T>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this changed, how did the type change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complex generic. I had to force the type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok np I will review it in the future
...nts/[documentUuid]/(withTabs)/evaluations/[evaluationUuid]/_components/EvaluationActions.tsx
Outdated
Show resolved
Hide resolved
* This can be improved by passing specific schemas per type/metric | ||
* But I'm fed up of fixing zod errors sorry | ||
*/ | ||
type EvaluationV2FormSchema = StandardSchemaV1<{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more automatic action error typying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's automatic It can be improved in this case. Which is a generic form that pass actions
} | ||
|
||
return Result.ok(output) | ||
return Result.ok( | ||
response.object as S extends z.ZodType ? z.infer<S> : unknown, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be just return response.object as unknown as we dont know the schema
...rc/jobs/job-definitions/documents/runDocumentAtCommitWithAutoToolResponses/getCopilotData.ts
Outdated
Show resolved
Hide resolved
bf0ba64
to
78607fa
Compare
rules = applyProviderRules({ providerType, messages, config: rules.config }) | ||
rules = vercelSdkRules(rules, providerType) | ||
|
||
const vercelMessages = convertLatitudeMessagesToVercelFormat({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main fix from last attend.
Now this function try to fully translate our messages to Vercel SDK messages before be sent to the AI
ruleMessage: 'Google requires at least one user message', | ||
}, | ||
], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved from createProvider
here this rule. Makes more sense at this point
78607fa
to
ea72e0e
Compare
ea72e0e
to
071919a
Compare
What?
A more detailed explanation is in the last attend to merge this
This PR will focus on fixing a bug we saw yesterday related with compatibility between our messages and new vercel sdk model message format.
TODO