1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! The OpenAI Rust library provides convenient access to the OpenAI API from Rust applications.
//!
//! ## Creating client
//!
//! ```ignore
//! use dotenvy::dotenv;
//! use rs_openai::{OpenAI};
//! use std::env::var;
//!
//! dotenv().ok();
//! let api_key = var("OPENAI_API_KEY").unwrap();
//!
//! let client = OpenAI::new(&OpenAI {
//! api_key,
//! org_id: None,
//! });
//! ```
//!
//! ## Making requests
//!
//!```ignore
//! use dotenvy::dotenv;
//! use rs_openai::{
//! chat::{ChatCompletionMessageRequestBuilder, CreateChatRequestBuilder, Role},
//! OpenAI,
//! };
//! use std::env::var;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! dotenv().ok();
//! let api_key = var("OPENAI_API_KEY").unwrap();
//!
//! let client = OpenAI::new(&OpenAI {
//! api_key,
//! org_id: None,
//! });
//!
//! let req = CreateChatRequestBuilder::default()
//! .model("gpt-3.5-turbo")
//! .messages(vec![ChatCompletionMessageRequestBuilder::default()
//! .role(Role::User)
//! .content("To Solve LeetCode's problem 81 in Rust.")
//! .build()?])
//! .build()?;
//!
//! let res = client.chat().create(&req).await?;
//! println!("{:?}", res);
//!
//! Ok(())
//! }
//!```
//!
//! ## Examples
//! For full working examples for all supported features see [examples](https://github.com/YanceyOfficial/rs-openai/tree/master/examples) directory in the repository.
//!
pub use *;
pub use *;