pub struct BraintrustClient { /* private fields */ }Implementations§
Source§impl BraintrustClient
impl BraintrustClient
Sourcepub fn builder() -> BraintrustClientBuilder
pub fn builder() -> BraintrustClientBuilder
Create a new builder for configuring the client.
§Example
use braintrust_sdk_rust::BraintrustClient;
let client = BraintrustClient::builder()
.api_key("sk-...")
.build()
.await?;Sourcepub async fn is_logged_in(&self) -> bool
pub async fn is_logged_in(&self) -> bool
Check if the client is logged in.
Sourcepub async fn wait_for_login(&self) -> Result<LoginState>
pub async fn wait_for_login(&self) -> Result<LoginState>
Wait for login to complete (useful if using background login).
Returns the login state once available, or an error if login times out.
Sourcepub async fn login_state(&self) -> Option<LoginState>
pub async fn login_state(&self) -> Option<LoginState>
Get the current login state, if logged in.
Sourcepub async fn span_builder(&self) -> Result<SpanBuilder<Self>>
pub async fn span_builder(&self) -> Result<SpanBuilder<Self>>
Create a span builder using the logged-in state and default project.
This waits for login to complete if it hasn’t already.
§Example
use braintrust_sdk_rust::BraintrustClient;
let client = BraintrustClient::builder()
.api_key("sk-...")
.default_project("my-project")
.build()
.await?;
let span = client.span_builder().await?.build();Sourcepub fn span_builder_with_credentials(
&self,
token: impl Into<String>,
org_id: impl Into<String>,
) -> SpanBuilder<Self>
pub fn span_builder_with_credentials( &self, token: impl Into<String>, org_id: impl Into<String>, ) -> SpanBuilder<Self>
Create a span builder with explicit token and org_id.
Use this if you already have the org_id and don’t want to use the login state.
Trait Implementations§
Source§impl Clone for BraintrustClient
impl Clone for BraintrustClient
Source§fn clone(&self) -> BraintrustClient
fn clone(&self) -> BraintrustClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for BraintrustClient
impl !UnwindSafe for BraintrustClient
impl Freeze for BraintrustClient
impl Send for BraintrustClient
impl Sync for BraintrustClient
impl Unpin for BraintrustClient
impl UnsafeUnpin for BraintrustClient
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