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 environment_pools::EnvironmentPoolsClient;pub use synth_ai_core as core;pub use synth_ai_core_types as types;
Modules§
Structs§
- Artifact
- An artifact produced during a rollout or evaluation.
- Buffered
Handler - A handler that buffers messages in memory.
- Calibration
Example - Calibration example for verifier evaluation.
- Callback
Handler - A handler that calls a callback function.
- Candidate
Info - Information about a single candidate.
- Context
Override - A context override containing file artifacts, env vars, and scripts.
- Context
Override Status - Result of applying a context override.
- Core
Client - Synth API client.
- Criterion
- A single evaluation criterion.
- Criterion
Score Data - Score data for a single criterion.
- Eval
Builder - Builder for evaluation jobs.
- Eval
JobRequest - Request to submit an evaluation job.
- Event
Objective Assignment - Assignment of objectives to an event.
- Event
Reward Record - Event-level reward annotation.
- GEPA
Progress - Overall GEPA progress state.
- Gepa
JobRequest - Request to submit a GEPA optimization job.
- Gold
Example - Gold-standard example for contrastive evaluation.
- Graph
Completion Request - Request for a graph completion.
- Graph
Completion Response - Response from a graph completion.
- Graph
Evolve Client - Graph Evolve API client.
- Graph
Evolve Job - High-level Graph Evolve job orchestration.
- Instance
Objective Assignment - Assignment of objectives to a specific instance (dataset example).
- JobStreamer
- Job streamer that polls endpoints and dispatches to handlers.
- Json
Handler - A handler that outputs JSON lines.
- Judgement
- A complete judgement including rubric assignment and annotations.
- LLMCall
Record - Normalized LLM call record.
- LLMChunk
- Optional streaming chunk representation.
- LLMContent
Part - LLM message content part.
- LLMMessage
- LLM message.
- LLMRequest
Params - Provider request parameters.
- LLMUsage
- Token usage statistics.
- Libsql
Trace Storage - libsql-based trace storage.
- Local
ApiDeploy Response - Response for a LocalAPI deployment request.
- Local
ApiDeploy Spec - Deployment specification for managed LocalAPI builds.
- Local
ApiDeploy Status - Status response for LocalAPI deployments.
- Local
ApiDeployment Info - Deployment list entry for LocalAPI deployments.
- Local
ApiLimits - Resource limits for managed LocalAPI deployments.
- Markov
Blanket Message - Inter-system message (Markov blanket).
- Message
Content - Content for messages, supporting text or JSON.
- 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.
- Outcome
Objective Assignment - Assignment of objectives to an outcome (session-level).
- Outcome
Reward Record - Episode-level reward summary.
- 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.
- Reward
Aggregates - Aggregated statistics for rewards.
- Reward
Observation - A single reward observation.
- RlmOptions
- Options for RLM (Retrieval-augmented LM) inference.
- Rubric
- A rubric containing multiple evaluation criteria.
- Rubric
Assignment - Assignment of scores to a rubric’s criteria.
- Session
Time Step - A timestep within a session.
- Session
Trace - A complete session trace.
- 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.
- Task
AppClient - Client for communicating with task apps.
- Time
Record - Time record for events and messages.
- Tool
Call Result - Tool call result.
- Tool
Call Spec - Tool call specification.
- Trace
Upload Client - Client for trace upload endpoints.
- Tunnel
Handle - Upload
UrlResponse - Response from creating an upload URL.
- Verifier
Options - Options for verifier inference.
- Verifier
Response - Response from verifier inference.
Enums§
- Application
Error Type - Type of error during override application.
- Application
Status - Status of a context override application.
- 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.
- Synth
Model Name - Synth-hosted model names.
- 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.