pub struct AsyncGroqClient { /* private fields */ }Expand description
An asynchronous client for interacting with the Groq API.
§Parameters
api_key: The API key for authenticating with the Groq API.endpoint: The URL of the Groq API endpoint. If not provided, it defaults to https://api.groq.com/openai/v1.
§Returns
An instance of AsyncGroqClient configured with the provided API key and endpoint.
§Example
use groq_client::AsyncGroqClient;
let client = AsyncGroqClient::new("my_api_key".to_string(), None).await;Implementations§
Source§impl AsyncGroqClient
impl AsyncGroqClient
Sourcepub async fn new(api_key: String, endpoint: Option<String>) -> Self
pub async fn new(api_key: String, endpoint: Option<String>) -> Self
Creates a new AsyncGroqClient
Sourcepub async fn speech_to_text(
&self,
request: SpeechToTextRequest,
) -> Result<SpeechToTextResponse, GroqError>
pub async fn speech_to_text( &self, request: SpeechToTextRequest, ) -> Result<SpeechToTextResponse, GroqError>
Sourcepub async fn chat_completion(
&self,
request: ChatCompletionRequest,
) -> Result<ChatCompletionResponse, GroqError>
pub async fn chat_completion( &self, request: ChatCompletionRequest, ) -> Result<ChatCompletionResponse, GroqError>
Sourcepub async fn stream(
&self,
request: ChatCompletionRequest,
) -> Result<impl Stream<Item = Result<ChatCompletionDeltaResponse, GroqError>>, GroqError>
pub async fn stream( &self, request: ChatCompletionRequest, ) -> Result<impl Stream<Item = Result<ChatCompletionDeltaResponse, GroqError>>, GroqError>
Auto Trait Implementations§
impl !RefUnwindSafe for AsyncGroqClient
impl !UnwindSafe for AsyncGroqClient
impl Freeze for AsyncGroqClient
impl Send for AsyncGroqClient
impl Sync for AsyncGroqClient
impl Unpin for AsyncGroqClient
impl UnsafeUnpin for AsyncGroqClient
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