Skip to main content

Overview

Deployment types represent deployed prompts with their complete configuration, messages, tools, and variables.

Deployment

A specific instance of a prompt that has been deployed to an environment.
interface Deployment {
  id: string;
  createdAt: UnixTimestamp;
  updatedAt: UnixTimestamp;
  createdByUserId: string;
  updatedByUserId: string;
  projectId: string;
  promptId: string;
  deploymentEnvironmentId: string;
  prompt: PromptSnapshot;
}
Properties:
  • id - Deployment identifier
  • createdAt - Creation timestamp
  • updatedAt - Last update timestamp
  • createdByUserId - Creator user ID
  • updatedByUserId - Last updater user ID
  • projectId - Associated project ID
  • promptId - Associated prompt ID
  • deploymentEnvironmentId - Target environment ID
  • prompt - Complete deployed prompt snapshot
Example:
import { Adaline } from '@adaline/client';
import type { Deployment } from '@adaline/api';

const adaline = new Adaline();

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

console.log(`ID: ${deployment.id}`);
console.log(`Model: ${deployment.prompt.config.model}`);
console.log(`Provider: ${deployment.prompt.config.providerName}`);
console.log(`Messages: ${deployment.prompt.messages.length}`);
console.log(`Tools: ${deployment.prompt.tools.length}`);
console.log(`Created: ${new Date(deployment.createdAt).toISOString()}`);
JSON:
{
  "id": "deploy_abc123",
  "createdAt": 1704067200000,
  "updatedAt": 1704153600000,
  "createdByUserId": "user_456",
  "updatedByUserId": "user_456",
  "projectId": "proj_789",
  "promptId": "prompt_abc123",
  "deploymentEnvironmentId": "production",
  "prompt": {
    "config": {...},
    "messages": [...],
    "tools": [],
    "variables": []
  }
}

PromptSnapshot

See the dedicated PromptSnapshot page for full documentation. Prompt snapshot with messages, tools, config, and variables.
interface PromptSnapshot {
  config: PromptSnapshotConfig;
  messages: PromptMessage[];
  tools: ToolFunction[];
  variables: PromptVariable[];
}
Properties:
  • config - Model provider and settings
  • messages - Array of prompt messages
  • tools - Array of tool function definitions
  • variables - Array of prompt variable definitions
JSON:
{
  "config": {
    "providerName": "openai",
    "providerId": "provider_123",
    "model": "gpt-4o",
    "settings": { "temperature": 0.7 }
  },
  "messages": [
    {
      "role": "system",
      "content": [{ "modality": "text", "value": "You are helpful." }]
    }
  ],
  "tools": [],
  "variables": []
}

PromptSnapshotConfig

See the dedicated PromptSnapshotConfig page for full documentation. Model provider and settings configuration. All fields are optional because a deployment snapshot may have an incomplete configuration.
interface PromptSnapshotConfig {
  providerName?: string;
  providerId?: string;
  model?: string;
  settings?: any;
}
Properties:
  • providerName - Provider name (e.g., ‘openai’, ‘anthropic’, ‘google’)
  • providerId - Adaline internal provider UUID
  • model - Model identifier (e.g., ‘gpt-4o’, ‘claude-3-opus’)
  • settings - Provider-specific runtime configuration
JSON:
{
  "providerName": "openai",
  "providerId": "provider_abc123",
  "model": "gpt-4o",
  "settings": {
    "temperature": 0.7,
    "maxTokens": 1000
  }
}

Complete Example

import { Adaline } from '@adaline/client';
import type {
  Deployment,
  PromptSnapshot,
  PromptSnapshotConfig,
  PromptVariable
} 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();

async function useDeployment() {
  // Get deployment from Adaline
  const deployment: Deployment = await adaline.getLatestDeployment({
    promptId: 'prompt_abc123',
    deploymentEnvironmentId: 'environment_abc123'
  });

  // Access deployed prompt configuration
  const prompt: PromptSnapshot = deployment.prompt;
  const config: PromptSnapshotConfig = prompt.config;
  const variables: PromptVariable[] = prompt.variables;

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

  // Call LLM using Adaline Gateway
  const model = openaiProvider.chatModel({
    modelName: config.model,
    apiKey: process.env.OPENAI_API_KEY!
  });

  const gatewayResponse = await gateway.completeChat({
    model,
    config: config.settings,
    messages: prompt.messages,
    tools: prompt.tools
  });

  // Log response details
  console.log('Gateway Response:');
  console.log(JSON.stringify(gatewayResponse.response, null, 2));

  // Return the first message content
  return gatewayResponse.response.messages[0].content[0].value;
}