pub struct ClientBuilder { /* private fields */ }Expand description
Builder for LangfuseClient, mirroring the style of opentelemetry-langfuse.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Start a new builder without credentials. Use ClientBuilder::public_key and
ClientBuilder::secret_key to provide them before calling ClientBuilder::build.
Sourcepub fn public_key(self, value: impl Into<String>) -> Self
pub fn public_key(self, value: impl Into<String>) -> Self
Set the public key used for authentication.
Sourcepub fn secret_key(self, value: impl Into<String>) -> Self
pub fn secret_key(self, value: impl Into<String>) -> Self
Set the secret key used for authentication.
Sourcepub fn base_url(self, value: impl Into<String>) -> Self
pub fn base_url(self, value: impl Into<String>) -> Self
Override the Langfuse base URL (defaults to https://cloud.langfuse.com).
Sourcepub fn timeout(self, value: Duration) -> Self
pub fn timeout(self, value: Duration) -> Self
Override the request timeout (defaults to 60 seconds).
Sourcepub fn connect_timeout(self, value: Duration) -> Self
pub fn connect_timeout(self, value: Duration) -> Self
Override the connection timeout (defaults to 10 seconds).
Sourcepub fn user_agent(self, value: impl Into<String>) -> Self
pub fn user_agent(self, value: impl Into<String>) -> Self
Override the user agent string.
Sourcepub fn http_client(self, client: ClientWithMiddleware) -> Self
pub fn http_client(self, client: ClientWithMiddleware) -> Self
Set a custom HTTP client with middleware.
This allows you to provide a pre-configured ClientWithMiddleware with
custom settings like retry policies, connection pooling, logging, etc.
§Example
use reqwest_middleware::ClientBuilder;
use reqwest_retry::{RetryTransientMiddleware, policies::ExponentialBackoff};
let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3);
let client = ClientBuilder::new(reqwest::Client::new())
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build();
let langfuse_client = langfuse_ergonomic::ClientBuilder::from_env()?
.http_client(client)
.build()?;Sourcepub fn build(self) -> Result<LangfuseClient>
pub fn build(self) -> Result<LangfuseClient>
Build a LangfuseClient using the configured options.
Trait Implementations§
Source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
Source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more