-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add agent actions #654
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Not sure if you want a second pair of eyes from someone more familiar with our existing code and patterns but, if not, everything looks good to me!
I did one into an issue testing generating a document in Kitchen Sink but it could be one of the permissions errors I occasionally hit (the message was Not Found - Schema for schemaId '_.schemas.default' could not be not found.).
Description
Added Agent Actions API to the Sanity SDK, exposing five key agent functions:
agentGenerate: Generates content for documents or specific fieldsagentTransform: Transforms existing documents or fieldsagentTranslate: Translates documents or fields between languagesagentPrompt: Prompts the LLM using instruction templatesagentPatch: Performs schema-aware document patchingThese functions are exposed both in the core package and as React hooks in the React package, allowing developers to leverage AI capabilities within Sanity applications.
What to review
packages/core/src/agent/agentActions.tspackages/react/src/hooks/agent/agentActions.tsTesting
Added comprehensive unit tests for all agent actions in
agentActions.test.ts, covering:Fun gif