pub struct TernlangClient {
pub provider: LlmProvider,
pub base_url: String,
pub auth: AuthSource,
pub http: Client,
pub max_retries: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
}Fields§
§provider: LlmProvider§base_url: String§auth: AuthSource§http: Client§max_retries: u32§initial_backoff: Duration§max_backoff: DurationImplementations§
Source§impl TernlangClient
impl TernlangClient
pub fn from_auth(auth: AuthSource) -> Self
pub fn from_env() -> Result<Self, ApiError>
pub fn with_auth_source(self, auth: AuthSource) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_provider(self, provider: LlmProvider) -> Self
pub async fn send_message( &self, request: &MessageRequest, ) -> Result<MessageResponse, ApiError>
pub async fn stream_message( &mut self, request: &MessageRequest, ) -> Result<MessageStream, ApiError>
pub async fn list_remote_models(&self) -> Result<Vec<String>, ApiError>
pub async fn exchange_oauth_code( &self, _config: OAuthConfig, _request: &OAuthTokenExchangeRequest, ) -> Result<RuntimeTokenSet, ApiError>
Trait Implementations§
Source§impl Clone for TernlangClient
impl Clone for TernlangClient
Source§fn clone(&self) -> TernlangClient
fn clone(&self) -> TernlangClient
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for TernlangClient
impl !RefUnwindSafe for TernlangClient
impl Send for TernlangClient
impl Sync for TernlangClient
impl Unpin for TernlangClient
impl UnsafeUnpin for TernlangClient
impl !UnwindSafe for TernlangClient
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