Skip to main content
Note: This page is auto-generated from SDK validation code. Parameters and types are extracted automatically and will update when the code changes.

MIPRO Offline (Multi-prompt Instruction Proposal Optimizer) is an algorithm for optimizing prompts through systematic instruction proposal and evaluation in offline mode, where the backend orchestrates all rollouts by calling your task app. Endpoint: POST /api/policy-optimization/online/jobs Authentication: Bearer token via Authorization: Bearer $SYNTH_API_KEY

Overview

In offline mode:
  • Backend orchestrates: Backend calls your task app for all rollouts
  • Tunneling required: Task app must be publicly accessible
  • Automatic evaluation: Backend handles all rollout execution and reward collection
  • No local code needed: Just provide task app URL and configuration

Request

{
  "policy_optimization": {
    "algorithm": "mipro",
    "task_app_url": "https://your-task-app.example.com",
    "policy": {
      "model": "gpt-4o-mini",
      "provider": "openai",
      "temperature": 0.0,
      "max_completion_tokens": 256
    },
    "mipro": {
      "mode": "offline",
      "bootstrap_train_seeds": [0, 1, 2, 3, 4],
      "val_seeds": [100, 101, 102],
      "proposer": {
        "mode": "instruction_only",
        "model": "gpt-4o-mini",
        "provider": "openai",
        "temperature": 0.7,
        "max_tokens": 512
      }
    }
  }
}

Parameters

ParameterTypeRequiredDescription
mipro.modestringYesMust be "offline"
mipro.bootstrap_train_seedsarray[int]YesInitial training seeds for bootstrap phase
mipro.val_seedsarray[int]YesValidation seeds for evaluation
mipro.proposerobjectYesProposer configuration for generating prompt proposals
mipro.proposer.max_tokensintNoMaximum tokens for proposer output (default: 512)
mipro.proposer.modestringYesProposer generation mode: ‘instruction_only’
mipro.proposer.modelstringYesModel for generating proposals
mipro.proposer.providerstringYesProvider for proposer model
mipro.proposer.temperaturefloatNoTemperature for proposer generation (default: 0.7)
task_app_urlstringYesPublicly accessible URL of your task app

Workflow

  1. Set up task app: Ensure your task app is publicly accessible (use Cloudflare tunnel for local development)
  2. Register API key: Register ENVIRONMENT_API_KEY with the backend
  3. Create job: Submit MIPRO job with mode: "offline" and task_app_url
  4. Backend orchestrates: Backend automatically:
    • Calls your task app for rollouts
    • Collects rewards
    • Generates new prompt proposals
    • Evaluates candidates
  5. Poll for results: Check job status until completion

Response

{
  "job_id": "pl_abc123",
  "status": "running"
}

Polling for Completion

Use GET /api/policy-optimization/online/jobs/{job_id} to check status:
{
  "job_id": "pl_abc123",
  "status": "succeeded",
  "best_score": 0.875
}

Notes

  • Tunneling required: Task app must be publicly accessible (use Cloudflare tunnel for local development)
  • Environment API key: ENVIRONMENT_API_KEY must be registered with the backend
  • Backend orchestrates: Backend handles all rollout execution and reward collection automatically
  • No local rollout code: You don’t need to write rollout loops - backend handles everything
  • Proposer API key: Automatically resolved from backend environment (OPENAI_API_KEY or PROD_OPENAI_API_KEY)

See Also