Skip to main content

Crate synth_ai

Crate synth_ai 

Source
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§

environment_pools

Structs§

Artifact
An artifact produced during a rollout or evaluation.
BufferedHandler
A handler that buffers messages in memory.
CalibrationExample
Calibration example for verifier evaluation.
CallbackHandler
A handler that calls a callback function.
CandidateInfo
Information about a single candidate.
ContextOverride
A context override containing file artifacts, env vars, and scripts.
ContextOverrideStatus
Result of applying a context override.
CoreClient
Synth API client.
Criterion
A single evaluation criterion.
CriterionScoreData
Score data for a single criterion.
EvalBuilder
Builder for evaluation jobs.
EvalJobRequest
Request to submit an evaluation job.
EventObjectiveAssignment
Assignment of objectives to an event.
EventRewardRecord
Event-level reward annotation.
GEPAProgress
Overall GEPA progress state.
GepaJobRequest
Request to submit a GEPA optimization job.
GoldExample
Gold-standard example for contrastive evaluation.
GraphCompletionRequest
Request for a graph completion.
GraphCompletionResponse
Response from a graph completion.
GraphEvolveClient
Graph Evolve API client.
GraphEvolveJob
High-level Graph Evolve job orchestration.
InstanceObjectiveAssignment
Assignment of objectives to a specific instance (dataset example).
JobStreamer
Job streamer that polls endpoints and dispatches to handlers.
JsonHandler
A handler that outputs JSON lines.
Judgement
A complete judgement including rubric assignment and annotations.
LLMCallRecord
Normalized LLM call record.
LLMChunk
Optional streaming chunk representation.
LLMContentPart
LLM message content part.
LLMMessage
LLM message.
LLMRequestParams
Provider request parameters.
LLMUsage
Token usage statistics.
LibsqlTraceStorage
libsql-based trace storage.
LocalApiDeployResponse
Response for a LocalAPI deployment request.
LocalApiDeploySpec
Deployment specification for managed LocalAPI builds.
LocalApiDeployStatus
Status response for LocalAPI deployments.
LocalApiDeploymentInfo
Deployment list entry for LocalAPI deployments.
LocalApiLimits
Resource limits for managed LocalAPI deployments.
MarkovBlanketMessage
Inter-system message (Markov blanket).
MessageContent
Content for messages, supporting text or JSON.
MiproJobRequest
Request to submit a MIPRO optimization job.
ObjectiveSpec
Specification for an optimization objective.
OptimizeBuilder
Builder for prompt optimization jobs.
OptimizeResult
Result of a prompt optimization job.
OutcomeObjectiveAssignment
Assignment of objectives to an outcome (session-level).
OutcomeRewardRecord
Episode-level reward summary.
ProgressTracker
Progress tracker that aggregates events into state.
PromptLearningJob
High-level prompt learning job orchestration.
PromptLearningResult
Result of a policy optimization job (GEPA/MIPRO).
PromptResults
Extracted prompt results.
RankedPrompt
Ranked prompt from results.
RewardAggregates
Aggregated statistics for rewards.
RewardObservation
A single reward observation.
RlmOptions
Options for RLM (Retrieval-augmented LM) inference.
Rubric
A rubric containing multiple evaluation criteria.
RubricAssignment
Assignment of scores to a rubric’s criteria.
SessionTimeStep
A timestep within a session.
SessionTrace
A complete session trace.
SessionTracer
Session tracer for recording traces.
StreamConfig
Configuration for stream filtering and behavior.
StreamEndpoints
Endpoint configuration for streaming from a job.
StreamMessage
A message from a job stream.
Synth
Main Synth AI client.
TaskAppClient
Client for communicating with task apps.
TimeRecord
Time record for events and messages.
ToolCallResult
Tool call result.
ToolCallSpec
Tool call specification.
TraceUploadClient
Client for trace upload endpoints.
TunnelHandle
UploadUrlResponse
Response from creating an upload URL.
VerifierOptions
Options for verifier inference.
VerifierResponse
Response from verifier inference.

Enums§

ApplicationErrorType
Type of error during override application.
ApplicationStatus
Status of a context override application.
CoreError
Unified error enum for all Synth core errors.
Error
SDK error type.
EvalJobStatus
Status for evaluation jobs.
JobType
Type of optimization/training job.
PolicyJobStatus
Status for policy optimization jobs (GEPA, MIPRO).
StreamType
Type of stream data.
SynthModelName
Synth-hosted model names.
TracingEvent
Unified event type using tagged enum.
TunnelBackend
TunnelError

Constants§

API_KEY_ENV
Environment variable for API key.
DEFAULT_BASE_URL
Default Synth API base URL.
VERSION
SDK version.

Traits§

StreamHandler
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.