Install and configure Sanity AI Assist
Additional data types and optional configuration in AI Assist v4.0.0
v4.0.0
Support for additional types
AI Assist now also supports these previously ignored types:
boolean
number
boolean
arraysnumber
arraysslug
– Assist will not do uniqueness checksurl
– Assist will try to skip url fields if the instruction does not contain details about what the URL should bedate
datetime
This means users can attach instructions to these fields, and they will be written to by default (when in scope of the instruction).
About date and time
Since language about date and time is time-zone and locale dependent, Assist will now send the browsers timezone and locale as part of the request by default. This allows instructions to use language like "today at noon", and "next year" and still get dates and datetimes as expected.
See the updated README.md and new reference docs on plugin config for details on how to override the default timezone for the current user (assist.localeSettings
)
New optional config
assist({
//Showing defaults
assist: {
localeSettings: () => Intl.DateTimeFormat().resolvedOptions(),
maxPathDepth: 4,
temperature: 0.3
},
})
localeSettings
: See section on date and datetime in the READMEmaxPathDepth
: The max depth for document paths AI Assist will write to.temperature
: Influences how much the output of an instruction will vary between runs.
BREAKING CHANGE
This is a breaking change of the plugin, since it will now visit perviously ignored fields.
Previous versions of the plugin will continue to work with the backend; these new features are enabled through a apiClient api version bump.
Migration guide
Other than bumping the plugin version to 4.0.0 no code changes are strictly needed. However, do note the following changes in behavior:
- fields of the types mentioned above can now have instructions, and will be written to.
- temperature is now 0.3 by default, up from 0. This means that re-runs of the same instruction could see a bit more variance in outcome than before. If this is not wanted, configure the plugin to use temperature 0.
Sanity AI Assist: New Features and Breaking Changes Including Content Translation, Image Generation, and Improved Field Support
v2.0.0
✨ Highlights
Sanity AI Assist 2.0 comes with new features and breaking changes that bring consistency to the plugin's configuration.
Paid feature
This article is about a feature currently available for all projects on the Growth plan and up.
To upgrade to the latest version of AI Assist:
npm i sanity@latest @sanity/assist@latest
Content translation
Sanity AI Assist can now translate localized content with a simple action. Built to support the localization models used by the Document Internationalization and Internationalized Array plugins.
Image generation
You can now instruct AI Assist to generate images for image fields. It also supports a two-step process where you instruct AI Assist to generate an instruction for image generation for better results.
Image description support
AI Assist can now add image descriptions to an image field. This is useful for generating alternative text and image captions. AI Assist will automatically run when an image is uploaded and replaced.
Reference field support
AI Assist can now work with reference fields to pull in content that's described in an instruction. Requires setting up an Embeddings Index for documents you wish to refer to.
Other improvements
- You can now explicitly filter what fields an instruction is allowed to interact with
- Support for conditionally
hidden
andreadOnly
fields - Image generation instruction will always show when enabled
- Translation actions will be disabled if AI Assist is not initialized
- AI context blocks are now always visible in the instruction editor
Migrating breaking changes
AI Assist's schema option properties have changed and been moved into a common namespace (aiAssist
). Some configuration properties have been renamed for clarity.
All AI Assist schema options now live under options.aiAssist
:
options.aiWritingAssistance.exclude
->options.aiAssist.exclude
options.aiWritingAssistance.embeddingsIndex options.aiAssist.embeddingsIndex
options.aiWritingAssistance.translateAction
->options.aiAssist.translateAction
options.imagePromptField
->options.aiAssist.imageInstructionField
options.captionField