Overview

A PromptType consists of the following main components:

config
ConfigType

Provider and runtime configuration.

Constraints: Required configuration object.

messages
Array<MessageType>

Array of conversation messages.

Constraints: Required, at least one message.

tools
Array<ToolType>

Available tools for the LLM.

Constraints: Required array (can be empty)

variables
Array<VariableType>

Dynamic content variables.

Constraints: Optional, unique names required.

Field Details

config

For complete configuration details, see the Config Reference

messages

For complete message structure details, see the MessageType Reference

tools

For complete tool structure details, see the ToolType Reference

variables

Optional array of dynamic variables that can be substituted into prompt content.

name
string

Variable identifier.

Constraints: 1-200 characters, must be unique within prompt.

value
ContentType

The variable’s content.

Constraints: Any valid content type (text, image, etc.)

description
string

Optional variable description.

Constraints: Optional, 1-200 characters.

For complete ContentType details, see the ContentType Reference

Name Constraints

  • Length: 1-200 characters
  • Uniqueness: Must be unique within the same prompt
  • Usage: Can be referenced in message content for dynamic substitution

Complete Examples

Basic Prompt

const prompt = {
  config: {
    providerName: "openai",
    providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
    model: "gpt-4o",
    settings: {
      temperature: 0.7,
      maxTokens: 500,
    },
  },
  messages: [
    {
      role: "system",
      content: [
        {
          modality: "text",
          value: "You are a helpful assistant.",
        },
      ],
    },
    {
      role: "user",
      content: [
        {
          modality: "text",
          value: "What is the weather like?",
        },
      ],
    },
  ],
  tools: [],
  variables: [],
};

Prompt with Tools and Variables

const prompt = {
  config: {
    providerName: "anthropic",
    providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
    model: "claude-3-sonnet-20240229",
    settings: {
      temperature: 0.3,
      maxTokens: 2000,
    },
  },
  messages: [
    {
      role: "system",
      content: [
        {
          modality: "text",
          value:
            "You are an AI assistant that helps users with weather information. Always use the get_weather tool to provide accurate data.",
        },
      ],
    },
    {
      role: "user",
      content: [
        {
          modality: "text",
          value: "What's the weather like in {{location}}? I'm planning activities for {{activity_type}}.",
        },
      ],
    },
  ],
  tools: [
    {
      type: "function",
      definition: {
        schema: {
          name: "get_weather",
          description: "Get current weather information for a specific location",
          parameters: {
            type: "object",
            properties: {
              location: {
                type: "string",
                description: "City and state or city and country",
              },
              units: {
                type: "string",
                enum: ["celsius", "fahrenheit"],
                default: "fahrenheit",
              },
            },
            required: ["location"],
          },
        },
      },
    },
  ],
  variables: [
    {
      name: "location",
      value: {
        modality: "text",
        value: "San Francisco, CA",
      },
      description: "The location to get weather for",
    },
    {
      name: "activity_type",
      value: {
        modality: "text",
        value: "outdoor activities",
      },
      description: "Type of activities the user is planning",
    },
  ],
};

Prompt with Image Variable

const prompt = {
  config: {
    providerName: "openai",
    providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
    model: "gpt-4o",
    settings: {
      temperature: 0.5,
      maxTokens: 1000,
    },
  },
  messages: [
    {
      role: "system",
      content: [
        {
          modality: "text",
          value: "You are an expert at analyzing images. Describe what you see in detail.",
        },
      ],
    },
    {
      role: "user",
      content: [
        {
          modality: "text",
          value: "Please analyze this image and tell me about {{subject}}:",
        },
        {
          modality: "image",
          detail: "high",
          value: {
            type: "url",
            url: "{{image_url}}",
          },
        },
      ],
    },
  ],
  tools: [],
  variables: [
    {
      name: "subject",
      value: {
        modality: "text",
        value: "the architectural style",
      },
      description: "What aspect to focus on in the analysis",
    },
    {
      name: "image_url",
      value: {
        modality: "text",
        value: "https://example.com/building.jpg",
      },
      description: "URL of the image to analyze",
    },
  ],
};

Multi-Variable Prompt

const prompt = {
  config: {
    providerName: "google",
    providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
    model: "gemini-2.5-flash-exp",
    settings: {
      temperature: 0.4,
      maxTokens: 1500,
    },
  },
  messages: [
    {
      role: "system",
      content: [
        {
          modality: "text",
          value: "You are {{assistant_role}}. Always be {{personality_trait}} and provide {{response_style}} responses.",
        },
      ],
    },
    {
      role: "user",
      content: [
        {
          modality: "text",
          value: "Hello! I'm {{user_name}} and I need help with {{task_description}}. I have {{time_constraint}} to complete this.",
        },
      ],
    },
  ],
  tools: [
    {
      type: "function",
      definition: {
        schema: {
          name: "schedule_task",
          description: "Schedule a task with deadline",
          parameters: {
            type: "object",
            properties: {
              task: { type: "string" },
              deadline: { type: "string" },
              priority: {
                type: "string",
                enum: ["low", "medium", "high"],
              },
            },
            required: ["task", "deadline"],
          },
        },
      },
    },
  ],
  variables: [
    {
      name: "assistant_role",
      value: {
        modality: "text",
        value: "a productivity expert",
      },
      description: "The role the assistant should take",
    },
    {
      name: "personality_trait",
      value: {
        modality: "text",
        value: "encouraging and supportive",
      },
      description: "The personality the assistant should exhibit",
    },
    {
      name: "response_style",
      value: {
        modality: "text",
        value: "actionable and concise",
      },
      description: "The style of responses to provide",
    },
    {
      name: "user_name",
      value: {
        modality: "text",
        value: "Alex",
      },
      description: "The user's name",
    },
    {
      name: "task_description",
      value: {
        modality: "text",
        value: "organizing my project timeline",
      },
      description: "Description of what the user needs help with",
    },
    {
      name: "time_constraint",
      value: {
        modality: "text",
        value: "3 days",
      },
      description: "How much time the user has",
    },
  ],
};