Expand description
§Synth AI SDK
Ergonomic Rust SDK for Synth AI - serverless post-training APIs.
§Quick Start
ⓘ
use synth_ai::Synth;
#[tokio::main]
async fn main() -> Result<(), synth_ai::Error> {
// Create client from SYNTH_API_KEY env var
let synth = Synth::from_env()?;
// Submit a prompt optimization job
let result = synth
.optimize()
.task_app("https://my-task-app.com")
.model("gpt-4o")
.run()
.await?;
println!("Best prompt: {:?}", result.best_prompt);
Ok(())
}Re-exports§
pub use synth_ai_core as core;pub use synth_ai_core_types as types;
Structs§
- Artifact
- An artifact produced during a rollout or evaluation.
- Candidate
Info - Information about a single candidate.
- Context
Override - A context override containing file artifacts, env vars, and scripts.
- Core
Client - Synth API client.
- Criterion
- A single evaluation criterion.
- Eval
Builder - Builder for evaluation jobs.
- Eval
JobRequest - Request to submit an evaluation job.
- GEPA
Progress - Overall GEPA progress state.
- Gepa
JobRequest - Request to submit a GEPA optimization job.
- Graph
Completion Request - Request for a graph completion.
- Graph
Completion Response - Response from a graph completion.
- JobStreamer
- Job streamer that polls endpoints and dispatches to handlers.
- Mipro
JobRequest - Request to submit a MIPRO optimization job.
- Objective
Spec - Specification for an optimization objective.
- Optimize
Builder - Builder for prompt optimization jobs.
- Optimize
Result - Result of a prompt optimization job.
- Progress
Tracker - Progress tracker that aggregates events into state.
- Prompt
Learning Job - High-level prompt learning job orchestration.
- Prompt
Learning Result - Result of a policy optimization job (GEPA/MIPRO).
- Prompt
Results - Extracted prompt results.
- Ranked
Prompt - Ranked prompt from results.
- Rubric
- A rubric containing multiple evaluation criteria.
- Session
Tracer - Session tracer for recording traces.
- Stream
Config - Configuration for stream filtering and behavior.
- Stream
Endpoints - Endpoint configuration for streaming from a job.
- Stream
Message - A message from a job stream.
- Synth
- Main Synth AI client.
- Tunnel
Handle - Verifier
Options - Options for verifier inference.
- Verifier
Response - Response from verifier inference.
Enums§
- Core
Error - Unified error enum for all Synth core errors.
- Error
- SDK error type.
- Eval
JobStatus - Status for evaluation jobs.
- JobType
- Type of optimization/training job.
- Policy
JobStatus - Status for policy optimization jobs (GEPA, MIPRO).
- Stream
Type - Type of stream data.
- Tracing
Event - Unified event type using tagged enum.
- Tunnel
Backend - Tunnel
Error
Constants§
- API_
KEY_ ENV - Environment variable for API key.
- DEFAULT_
BASE_ URL - Default Synth API base URL.
- VERSION
- SDK version.
Traits§
- Stream
Handler - Trait for handling stream messages.
Functions§
- eval
- Create a client from environment and run a quick evaluation.
- open_
tunnel - optimize
- Create a client from environment and run a quick optimization.
Type Aliases§
- Result
- Result type alias.