/ mlflow / protos / prompt_optimization.proto
prompt_optimization.proto
 1  syntax = "proto2";
 2  
 3  package mlflow;
 4  
 5  import "jobs.proto";
 6  import "scalapb/scalapb.proto";
 7  
 8  option java_package = "org.mlflow.api.proto";
 9  option py_generic_services = true;
10  option (scalapb.options) = {flat_package: true};
11  
12  // Type of optimizer algorithm to use.
13  enum OptimizerType {
14    OPTIMIZER_TYPE_UNSPECIFIED = 0;
15  
16    // GEPA (Genetic Pareto) optimizer (https://github.com/gepa-ai/gepa)
17    OPTIMIZER_TYPE_GEPA = 1;
18  
19    // MetaPrompt optimizer - uses metaprompting with LLMs to improve prompts in a single pass.
20    OPTIMIZER_TYPE_METAPROMPT = 2;
21  }
22  
23  // Tag for a prompt optimization job.
24  message PromptOptimizationJobTag {
25    optional string key = 1;
26  
27    optional string value = 2;
28  }
29  
30  // Configuration for a prompt optimization job.
31  // Stored as run parameters in the underlying MLflow run.
32  message PromptOptimizationJobConfig {
33    // The optimizer type to use.
34    optional OptimizerType optimizer_type = 1;
35  
36    // ID of the EvaluationDataset containing training data.
37    optional string dataset_id = 2;
38  
39    // List of scorer names. Can be built-in scorer class names
40    // (e.g., "Correctness", "Safety") or registered scorer names.
41    repeated string scorers = 3;
42  
43    // JSON-serialized optimizer-specific configuration.
44    // Different optimizers accept different parameters:
45    // - GEPA: {"reflection_model": "openai:/gpt-5", "max_metric_calls": 300}
46    // - MetaPrompt: {"reflection_model": "openai:/gpt-5", "guidelines": "...", "lm_kwargs": {...}}
47    optional string optimizer_config_json = 4;
48  }
49  
50  // Represents a prompt optimization job entity.
51  message PromptOptimizationJob {
52    // Unique identifier for the optimization job.
53    // Used to poll job execution status (pending/running/completed/failed).
54    optional string job_id = 1;
55  
56    // MLflow run ID where optimization metrics and results are stored.
57    // Use this to view results in MLflow UI. Only available after job starts running.
58    optional string run_id = 2;
59  
60    // Current state of the job (status + error message + metadata).
61    optional JobState state = 3;
62  
63    // ID of the MLflow experiment where this optimization job is tracked.
64    optional string experiment_id = 4;
65  
66    // URI of the source prompt that optimization started from (e.g., "prompts:/my-prompt/1").
67    optional string source_prompt_uri = 5;
68  
69    // URI of the optimized prompt (e.g., "prompts:/my-prompt/2").
70    // Only set if optimization completed successfully.
71    optional string optimized_prompt_uri = 6;
72  
73    // Configuration for the optimization job.
74    optional PromptOptimizationJobConfig config = 7;
75  
76    // Timestamp when the job was created (milliseconds since epoch).
77    optional int64 creation_timestamp_ms = 8;
78  
79    // Timestamp when the job completed (milliseconds since epoch).
80    // Only set if status is COMPLETED, FAILED, or CANCELED.
81    optional int64 completion_timestamp_ms = 9;
82  
83    // Tags associated with this job.
84    repeated PromptOptimizationJobTag tags = 10;
85  
86    // Initial evaluation scores before optimization, keyed by scorer name.
87    // Example: {"Correctness": 0.65, "Safety": 0.80}
88    map<string, double> initial_eval_scores = 11;
89  
90    // Final evaluation scores after optimization, keyed by scorer name.
91    // Example: {"Correctness": 0.89, "Safety": 0.95}
92    map<string, double> final_eval_scores = 12;
93  }