npm @sanity/client 7.5.0
v7.5.0

latest releases: 7.11.0-cors-check.1, 7.11.0-cors-check.0, 7.11.0-live-cors...
3 months ago

7.5.0 (2025-06-06)

  • agent.action.transform can now transform images to text descriptions (#1096) (609e572)

Image descriptions

Images can be transformed to a textual description by targeting a string, text or Portable Text field (array with block)
with operation: {type: 'image-description'}.

Custom instructions for image description targets will be used to generate the description.

Targeting image fields

If a target is a descendant field of an image object, no sourcePath is required in the operation:

For example:

  • target: {path: ['image', 'description'], operation: {type: 'image-description'} }
  • target: {path: ['array', {_key: 'abc'}, 'alt'], operation: {type: 'image-description'} } //assuming the item in the array on the key-ed path is an image
  • target: {path: ['image'], include: ['portableTextField'], operation: {type: 'image-description'}, instruction: 'Use formatting and headings to describe the image in great detail' }

Targeting non-image fields

If the target image description lives outside an image object, use the sourcePath option to specify the path to the image field.
sourcePath must be an image or image asset field.

For example:

  • target: {path: ['description'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }
  • target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }
  • target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }

This PR was generated with Release Please. See documentation.

Don't miss a new client release

NewReleases is sending notifications on new releases.