Sanity Library Reference Docs
    Preparing search index...

    Interface PromptRequestBaseBeta

    interface PromptRequestBase {
        instruction: string;
        instructionParams?: AgentActionParams<{ docIdRequired: true }>;
        temperature?: number;
    }
    Index

    Properties

    instruction: string

    Instruct the LLM how it should generate content. Be as specific and detailed as needed.

    The LLM only has access to information in the instruction, plus the target schema.

    String template with support for $variable from instructionParams.

    instructionParams?: AgentActionParams<{ docIdRequired: true }>

    param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable"

    client.agent.action.prompt({
    instruction: 'Give the following topic:\n $topic \n ---\nReturns some facts about it',
    instructionParams: {
    topic: 'Grapefruit'
    },
    })
    client.agent.action.prompt({
    instruction: 'Give the following topic:\n $topic \n ---\nReturns some facts about it.',
    instructionParams: {
    topic: {
    type: 'constant',
    value: 'Grapefruit'
    },
    },
    })
    client.agent.action.prompt({
    instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
    instructionParams: {
    pte: {
    type: 'field',
    path: ['pteField'],
    documentId: 'someSanityDocId'
    },
    },
    })
    client.agent.action.prompt({
    json: true,
    instruction: 'Given the following document:$document\nCreate a JSON string[] array with keywords describing it.',
    instructionParams: {
    document: {
    type: 'document',
    documentId: 'someSanityDocId'
    },
    },
    })
    client.agent.action.prompt({
    instruction: 'Return the best title amongst these: $titles.',
    instructionParams: {
    titles: {
    type: 'groq',
    query: '* [_type==$type].title',
    params: {type: 'article'}
    },
    },
    })
    temperature?: number

    Controls how much variance the instructions will run with.

    Value must be in the range [0, 1] (inclusive).

    Default: 0.3