Sanity Library Reference Docs
    Preparing search index...

    Interface TransformTargetBeta

    interface TransformTarget {
        exclude?: AgentActionPathSegment[];
        include?: (AgentActionPathSegment | TransformTargetInclude)[];
        instruction?: string;
        maxPathDepth?: number;
        path?: AgentActionPathSegment | AgentActionPath;
        types?: AgentActionTypeConfig;
    }

    Hierarchy (View Summary)

    Index

    Properties

    By default, all children up to target.maxPathDepth are included. Fields or array items not on the exclude list, are implicitly included.

    By default, all children up to target.maxPathDepth are included.

    When include is specified, only segments explicitly listed will be included.

    Fields or array items not on the include list, are implicitly excluded.

    instruction?: string

    Specifies a tailored instruction of this target.

    String template with support for $variable from instructionParams.

    maxPathDepth?: number

    maxPathDepth controls how deep into the schema from the target root the instruction will affect.

    Depth is based on path segments:

    • title has depth 1
    • array[_key="no"].title has depth 3

    Be careful not to set this too high in studios with recursive document schemas, as it could have negative impact on performance; both for runtime and quality of responses.

    Default: 4

    Root target path.

    Use this to have the instruction only affect a part of the document.

    To further control the behavior of individual paths under the root, use include, exclude, types.include and types.exclude.

    Example:

    path: ['body', {_key: 'someKey'}, 'nestedObject']

    Here, the instruction will only write to fields under the nestedObject.

    Default: [] = the document itself

    • #AgentActionPathSegment
    • #AgentActionPath

    Types can be used to exclude array item types or all fields directly under the target path of a certain type. If you do exclude: ['string'] all string fields under the target will be excluded, for instance.

    types.include and types.exclude are mutually exclusive.