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>
Sourcepub async fn list_models_for_display(&self) -> Vec<String>
pub async fn list_models_for_display(&self) -> Vec<String>
Returns display-annotated model strings for the TUI picker. Format: “model-id (annotation)” for known models, bare id otherwise.
pub async fn create_embeddings( &self, model: &str, input: &[String], ) -> Result<Vec<Vec<f32>>, ApiError>
pub async fn exchange_oauth_code( &self, _config: OAuthConfig, _request: &OAuthTokenExchangeRequest, ) -> Result<RuntimeTokenSet, ApiError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TernlangClient
impl !UnwindSafe for TernlangClient
impl Forget for TernlangClient
impl Freeze for TernlangClientwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<ClientRef> is !null: Freeze,
PhantomData<ArcInner<ClientRef>>: Freeze,
impl Move for TernlangClient
impl Send for TernlangClient
impl Sync for TernlangClient
impl Unpin for TernlangClient
impl UnsafeUnpin for TernlangClientwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<ClientRef> is !null: UnsafeUnpin,
PhantomData<ArcInner<ClientRef>>: UnsafeUnpin,
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