Struct openai_rust::Client
source · pub struct Client { /* private fields */ }
Expand description
This is the main interface to interact with the api.
Implementations§
source§impl Client
impl Client
sourcepub fn new(api_key: &str) -> Client
pub fn new(api_key: &str) -> Client
Create a new client. This will automatically build a reqwest::Client used internally.
sourcepub async fn list_models(&self) -> Result<ListModelsResponse, Error>
pub async fn list_models(&self) -> Result<ListModelsResponse, Error>
Lists the currently available models, and provides basic information about each one such as the owner and availability. See https://platform.openai.com/docs/api-reference/models/list
sourcepub async fn create_chat(
&self,
args: ChatArguments
) -> Result<ChatResponse, Error>
pub async fn create_chat( &self, args: ChatArguments ) -> Result<ChatResponse, Error>
Given a chat conversation, the model will return a chat completion response. See https://platform.openai.com/docs/api-reference/chat