pub struct GrokClient { /* private fields */ }Implementations§
Source§impl GrokClient
impl GrokClient
Sourcepub fn with_client(client: Client, api_key: String) -> Self
pub fn with_client(client: Client, api_key: String) -> Self
Create a new GrokClient with a custom HTTP client and API key
Sourcepub async fn get_api_key(&self) -> Result<ApiKey>
pub async fn get_api_key(&self) -> Result<ApiKey>
Get API key information
Sourcepub async fn get_model(&self, id: LanguageModel) -> Result<Model>
pub async fn get_model(&self, id: LanguageModel) -> Result<Model>
Get a specific model by ID
Sourcepub async fn get_language_models(&self) -> Result<Vec<ApiLanguageModel>>
pub async fn get_language_models(&self) -> Result<Vec<ApiLanguageModel>>
Get all available language models
Sourcepub async fn get_language_model(
&self,
id: LanguageModel,
) -> Result<ApiLanguageModel>
pub async fn get_language_model( &self, id: LanguageModel, ) -> Result<ApiLanguageModel>
Get a specific language model by ID
Sourcepub async fn get_image_models(&self) -> Result<Vec<ApiImageModel>>
pub async fn get_image_models(&self) -> Result<Vec<ApiImageModel>>
Get all available image models
Sourcepub async fn get_image_model(&self, id: ImageModel) -> Result<ApiImageModel>
pub async fn get_image_model(&self, id: ImageModel) -> Result<ApiImageModel>
Get a specific image model by ID
Sourcepub async fn tokenize_text(
&self,
model: LanguageModel,
text: String,
) -> Result<TokenizeResponse>
pub async fn tokenize_text( &self, model: LanguageModel, text: String, ) -> Result<TokenizeResponse>
Tokenize text using a specific model
Sourcepub async fn chat_complete(
&self,
request: &ChatCompletionRequest,
) -> Result<ChatCompletionResponse>
pub async fn chat_complete( &self, request: &ChatCompletionRequest, ) -> Result<ChatCompletionResponse>
Send a chat completion request
Sourcepub async fn chat_stream<F1, F2>(
&self,
request: &ChatCompletionRequest,
on_content_token: F1,
on_reason_token: Option<F2>,
) -> Result<ChatCompletionResponse>
pub async fn chat_stream<F1, F2>( &self, request: &ChatCompletionRequest, on_content_token: F1, on_reason_token: Option<F2>, ) -> Result<ChatCompletionResponse>
Send a streaming chat completion request
Sourcepub async fn chat_defer(
&self,
request: &ChatCompletionRequest,
) -> Result<DeferredChatCompletionResponse>
pub async fn chat_defer( &self, request: &ChatCompletionRequest, ) -> Result<DeferredChatCompletionResponse>
Send a deferred chat completion request
Sourcepub async fn get_deferred_completion(
&self,
request_id: String,
) -> Result<ChatCompletionResponse>
pub async fn get_deferred_completion( &self, request_id: String, ) -> Result<ChatCompletionResponse>
Get the result of a deferred chat completion
Sourcepub async fn generate_image(
&self,
request: &ImageRequest,
) -> Result<ImageResponse>
pub async fn generate_image( &self, request: &ImageRequest, ) -> Result<ImageResponse>
Generate images using the specified request
Trait Implementations§
Source§impl Clone for GrokClient
impl Clone for GrokClient
Source§fn clone(&self) -> GrokClient
fn clone(&self) -> GrokClient
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 GrokClient
impl !RefUnwindSafe for GrokClient
impl Send for GrokClient
impl Sync for GrokClient
impl Unpin for GrokClient
impl !UnwindSafe for GrokClient
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