Skip to main content

PromptSnapshot

The prompt configuration snapshot embedded in a Deployment. Contains the complete prompt definition including model configuration, messages, tool definitions, and variable declarations.

Import

import type { PromptSnapshot } from '@adaline/api';

Type Definition

interface PromptSnapshot {
  config: PromptSnapshotConfig;
  messages: PromptMessage[];
  tools: ToolFunction[];
  variables: PromptVariable[];
}

Properties

  • config - Model provider and runtime settings (PromptSnapshotConfig)
  • messages - Ordered array of chat messages that form the prompt (PromptMessage)
  • tools - Tool/function definitions available to the model (ToolFunction)
  • variables - Dynamic variable declarations used in the prompt template (PromptVariable)

Examples

Accessing from a Deployment

import { Adaline } from '@adaline/client';
import type { Deployment, PromptSnapshot } from '@adaline/api';

const adaline = new Adaline();

const deployment: Deployment = await adaline.getLatestDeployment({
  promptId: 'prompt_abc123',
  deploymentEnvironmentId: 'environment_abc123'
});

const prompt: PromptSnapshot = deployment.prompt;

console.log(`Provider: ${prompt.config.providerName}`);
console.log(`Model: ${prompt.config.model}`);
console.log(`Messages: ${prompt.messages.length}`);
console.log(`Tools: ${prompt.tools.length}`);
console.log(`Variables: ${prompt.variables.map(v => v.name).join(', ')}`);

Using with Adaline Gateway

import { Adaline } from '@adaline/client';
import type { PromptSnapshot } from '@adaline/api';
import { Gateway } from '@adaline/gateway';
import { OpenAI } from '@adaline/openai';

const adaline = new Adaline();
const gateway = new Gateway();
const openaiProvider = new OpenAI();

const deployment = await adaline.getLatestDeployment({
  promptId: 'prompt_abc123',
  deploymentEnvironmentId: 'environment_abc123'
});

const prompt: PromptSnapshot = deployment.prompt;

const model = openaiProvider.chatModel({
  modelName: prompt.config.model,
  apiKey: process.env.OPENAI_API_KEY!
});

const response = await gateway.completeChat({
  model,
  config: prompt.config.settings,
  messages: [
    ...prompt.messages,
    {
      role: 'user',
      content: [{ modality: 'text', value: 'Hello!' }]
    }
  ],
  tools: prompt.tools
});

Inspecting Prompt Structure

function inspectPrompt(prompt: PromptSnapshot) {
  // Check model configuration
  if (prompt.config.providerName) {
    console.log(`Using ${prompt.config.providerName}/${prompt.config.model}`);
  }

  // List system messages
  const systemMessages = prompt.messages.filter(m => m.role === 'system');
  console.log(`System messages: ${systemMessages.length}`);

  // List available tools
  prompt.tools.forEach(tool => {
    console.log(`Tool: ${tool.definition.schema.name}`);
  });

  // List required variables
  prompt.variables.forEach(v => {
    console.log(`Variable: {{${v.name}}} (${v.modality})`);
  });
}

JSON

{
  "config": {
    "providerName": "openai",
    "providerId": "provider_abc123",
    "model": "gpt-4o",
    "settings": { "temperature": 0.7 }
  },
  "messages": [
    {
      "role": "system",
      "content": [{ "modality": "text", "value": "You are a helpful assistant." }]
    }
  ],
  "tools": [
    {
      "type": "function",
      "definition": {
        "schema": {
          "name": "get_weather",
          "description": "Get current weather",
          "parameters": {
            "type": "object",
            "properties": { "city": { "type": "string" } },
            "required": ["city"]
          }
        }
      }
    }
  ],
  "variables": [
    { "name": "user_name", "modality": "text" }
  ]
}