@sanity/client 7.4.0-agent-actions.0 → 7.4.0-agent-actions.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2114,17 +2114,29 @@ Image transform can have per-path instructions, just like any other target paths
2114
2114
 
2115
2115
  ##### Image descriptions
2116
2116
 
2117
- Images can be transformed to an textual description by targeting a `string`, `text` or Portable Text field (`array` with `block`)
2118
- and with `operation: 'image-description'`.
2117
+ ## Image description
2118
+
2119
+ Images can be transformed to a textual description by targeting a `string`, `text` or Portable Text field (`array` with `block`)
2120
+ with `operation: {type: 'image-description'}`.
2119
2121
 
2120
2122
  Custom instructions for image description targets will be used to generate the description.
2121
2123
 
2122
- Such targets must be a descendant field of an image object.
2124
+ ###### Targeting image fields
2125
+ If a target is a descendant field of an image object, no `sourcePath` is required in the operation:
2126
+
2127
+ For example:
2128
+ - `target: {path: ['image', 'description'], operation: {type: 'image-description'} }`
2129
+ - `target: {path: ['array', {_key: 'abc'}, 'alt'], operation: {type: 'image-description'} } //assuming the item in the array on the key-ed path is an image`
2130
+ - `target: {path: ['image'], include: ['portableTextField'], operation: {type: 'image-description'}, instruction: 'Use formatting and headings to describe the image in great detail' }`
2131
+
2132
+ ###### Targeting non-image fields
2133
+ If the target image description lives outside an image object, use the `sourcePath` option to specify the path to the image field.
2134
+ `sourcePath` must be an image or image asset field.
2123
2135
 
2124
2136
  For example:
2125
- * `target: {path: ['image', 'description'], operation: 'image-description' }`
2126
- * `target: {path: ['array', {_key: 'abc'}, 'alt'], operation: 'image-description' } //assuming the item in the array on the key-ed path is an image`
2127
- * `target: {path: ['image'], include: ['portableTextField'], operation: 'image-description', instruction: 'Use formatting and headings to describe the image in great detail' }`
2137
+ - `target: {path: ['description'], operation: operation: {type: 'image-description', sourcePath: ['image', 'asset'] }`
2138
+ - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
2139
+ - `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
2128
2140
 
2129
2141
  ##### Example: Field-based transformation
2130
2142