async_llm/completions/
mod.rs1use crate::{error::Error, http::HttpClient, Client, Provider};
2
3pub mod request;
4pub mod response;
5
6pub use request::*;
7pub use response::*;
8
9#[derive(Debug, Clone)]
10pub struct Completions<'c, P: Provider, H: HttpClient> {
11 pub(crate) client: &'c Client<P, H>,
12}
13
14impl<'c, P: Provider, H: HttpClient> Completions<'c, P, H> {
15 pub fn new(client: &'c Client<P, H>) -> Self {
16 Self { client }
17 }
18
19 pub async fn create(&self, request: CompletionRequest) -> Result<CompletionResponse, Error> {
20 self.client
21 .provider
22 .completions(&self.client.http_client, request)
23 .await
24 }
25}