pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn new(adapter: impl ProviderAdapter + 'static) -> Result<Self>
pub fn with_http(adapter: impl ProviderAdapter + 'static, http: Client) -> Self
pub fn with_fallback(self, config: FallbackConfig) -> Self
pub fn with_resilience(self, config: ResilienceConfig) -> Self
pub fn resilience(&self) -> Option<&Arc<Resilience>>
pub fn builder() -> ClientBuilder
pub async fn query(&self, prompt: &str) -> Result<String>
pub async fn query_with_model( &self, prompt: &str, model_type: ModelType, ) -> Result<String>
pub async fn send(&self, request: CreateMessageRequest) -> Result<ApiResponse>
pub async fn send_no_fallback( &self, request: CreateMessageRequest, ) -> Result<ApiResponse>
pub fn fallback_config(&self) -> Option<&FallbackConfig>
pub async fn stream( &self, prompt: &str, ) -> Result<impl Stream<Item = Result<String>> + Send + 'static + use<>>
pub async fn stream_request( &self, request: CreateMessageRequest, ) -> Result<impl Stream<Item = Result<StreamItem>> + Send + 'static + use<>>
pub async fn stream_recoverable( &self, request: CreateMessageRequest, ) -> Result<RecoverableStream<impl Stream<Item = Result<Bytes, Error>> + Send + 'static + use<>>>
pub async fn stream_with_recovery( &self, request: CreateMessageRequest, recovery_state: Option<StreamRecoveryState>, ) -> Result<RecoverableStream<impl Stream<Item = Result<Bytes, Error>> + Send + 'static + use<>>>
pub fn batch(&self) -> BatchClient<'_>
pub fn files(&self) -> FilesClient<'_>
pub fn adapter(&self) -> &dyn ProviderAdapter
pub fn config(&self) -> &ProviderConfig
pub async fn refresh_credentials(&self) -> Result<()>
pub async fn send_with_auth_retry( &self, request: CreateMessageRequest, ) -> Result<ApiResponse>
pub async fn send_stream_with_auth_retry( &self, request: CreateMessageRequest, ) -> Result<Response>
pub async fn count_tokens( &self, request: CountTokensRequest, ) -> Result<CountTokensResponse>
pub async fn count_tokens_for_request( &self, request: &CreateMessageRequest, ) -> Result<CountTokensResponse>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreCreates a shared type from an unshared type.