pub struct CoreClient { /* private fields */ }Expand description
Synth API client.
This is the main entry point for interacting with the Synth API. It provides access to sub-clients for different API endpoints.
§Example
ⓘ
use synth_ai_core::api::SynthClient;
// Create from environment variable
let client = SynthClient::from_env()?;
// Or with explicit API key
let client = SynthClient::new("sk_live_...", None)?;
// Access sub-clients
let jobs = client.jobs();
let eval = client.eval();
let graphs = client.graphs();Implementations§
Source§impl SynthClient
impl SynthClient
Sourcepub fn with_timeout(
api_key: &str,
base_url: Option<&str>,
timeout_secs: u64,
) -> Result<SynthClient, CoreError>
pub fn with_timeout( api_key: &str, base_url: Option<&str>, timeout_secs: u64, ) -> Result<SynthClient, CoreError>
Create a new Synth client with custom timeout.
§Arguments
api_key- Your Synth API keybase_url- Optional base URLtimeout_secs- Request timeout in seconds
Sourcepub fn from_env() -> Result<SynthClient, CoreError>
pub fn from_env() -> Result<SynthClient, CoreError>
Sourcepub async fn from_env_or_mint(
allow_mint: bool,
base_url: Option<&str>,
) -> Result<SynthClient, CoreError>
pub async fn from_env_or_mint( allow_mint: bool, base_url: Option<&str>, ) -> Result<SynthClient, CoreError>
Create a client, minting a demo key if needed.
This will:
- Try to get an API key from environment
- If not found and
allow_mintis true, mint a demo key
§Arguments
allow_mint- Whether to mint a demo key if no key is foundbase_url- Optional base URL
Sourcepub fn http(&self) -> &HttpClient
pub fn http(&self) -> &HttpClient
Get a reference to the HTTP client.
Sourcepub fn jobs(&self) -> JobsClient<'_>
pub fn jobs(&self) -> JobsClient<'_>
Sourcepub fn eval(&self) -> EvalClient<'_>
pub fn eval(&self) -> EvalClient<'_>
Sourcepub fn graphs(&self) -> GraphsClient<'_>
pub fn graphs(&self) -> GraphsClient<'_>
Sourcepub fn graph_evolve(&self) -> GraphEvolveClient<'_>
pub fn graph_evolve(&self) -> GraphEvolveClient<'_>
Get a Graph Evolve API client.
Use this for Graph Evolve / GraphGen optimization endpoints.
Sourcepub fn inference(&self) -> InferenceClient<'_>
pub fn inference(&self) -> InferenceClient<'_>
Get an Inference API client.
Use this for chat completions via the inference proxy.
Sourcepub fn localapi(&self) -> LocalApiDeployClient<'_>
pub fn localapi(&self) -> LocalApiDeployClient<'_>
Get a LocalAPI Deployments client.
Use this to deploy and manage managed LocalAPI deployments.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SynthClient
impl !RefUnwindSafe for SynthClient
impl Send for SynthClient
impl Sync for SynthClient
impl Unpin for SynthClient
impl !UnwindSafe for SynthClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request