pub struct DeepSeekClient { /* private fields */ }Expand description
Async DeepSeek API client.
Holds a pre-configured reqwest::Client and base URL. Construct via
DeepSeekClient::builder() or DeepSeekClient::new().
Implementations§
Source§impl DeepSeekClient
impl DeepSeekClient
Sourcepub fn new(http: Client, base_url: String) -> Self
pub fn new(http: Client, base_url: String) -> Self
Creates a new client from pre-built components.
The HTTP client should already have auth headers set (e.g. via
just_common::transport::http::build_client).
Sourcepub fn builder() -> DeepSeekClientBuilder
pub fn builder() -> DeepSeekClientBuilder
Returns a builder for constructing a new client.
Sourcepub fn http_client(&self) -> &Client
pub fn http_client(&self) -> &Client
Returns the underlying HTTP client.
Sourcepub fn prepare(&self, request: ChatCompletionRequest) -> Result<Request, Error>
pub fn prepare(&self, request: ChatCompletionRequest) -> Result<Request, Error>
Prepares a non-streaming chat completion request for later execution.
Serializes the request body and builds a complete reqwest::Request.
This is a synchronous operation (no IO).
Sourcepub fn prepare_streaming(
&self,
request: ChatCompletionRequest,
) -> Result<Request, Error>
pub fn prepare_streaming( &self, request: ChatCompletionRequest, ) -> Result<Request, Error>
Prepares a streaming chat completion request for later execution.
Forces stream = true on the request, then serializes and builds.
This is a synchronous operation (no IO).
Sourcepub async fn send(&self, request: Request) -> Result<Response, Error>
pub async fn send(&self, request: Request) -> Result<Response, Error>
Sends a prepared request and returns the raw HTTP response without checking status.
Callers must handle non-success statuses themselves. For automatic status checking and
deserialization, use chat_completion or
stream_chat_completion.
Source§impl DeepSeekClient
impl DeepSeekClient
Sourcepub async fn parse_streaming(
&self,
response: Response,
) -> Result<ChatCompletionStream, Error>
pub async fn parse_streaming( &self, response: Response, ) -> Result<ChatCompletionStream, Error>
Parses a raw HTTP response into a provider-native streaming chunk stream.
Checks the HTTP status first (the SSE stream parser assumes a 2xx event stream).
Sourcepub async fn chat_completion(
&self,
request: ChatCompletionRequest,
) -> Result<ChatCompletion, Error>
pub async fn chat_completion( &self, request: ChatCompletionRequest, ) -> Result<ChatCompletion, Error>
Executes a non-streaming chat completion request.
Sourcepub async fn stream_chat_completion(
&self,
request: ChatCompletionRequest,
) -> Result<ChatCompletionStream, Error>
pub async fn stream_chat_completion( &self, request: ChatCompletionRequest, ) -> Result<ChatCompletionStream, Error>
Starts a streaming chat completion request.
Sourcepub async fn list_models(&self) -> Result<ListModelsResponse, Error>
pub async fn list_models(&self) -> Result<ListModelsResponse, Error>
Lists models currently exposed by the configured endpoint.
Sourcepub async fn get_user_balance(&self) -> Result<GetUserBalanceResponse, Error>
pub async fn get_user_balance(&self) -> Result<GetUserBalanceResponse, Error>
Returns the current user balance state.
Trait Implementations§
Source§impl Clone for DeepSeekClient
impl Clone for DeepSeekClient
Source§fn clone(&self) -> DeepSeekClient
fn clone(&self) -> DeepSeekClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more