Skip to content

Commit

Permalink
update doc: to showcase custom reqwest client
Browse files Browse the repository at this point in the history
  • Loading branch information
64bit committed Mar 18, 2023
1 parent cf7d39c commit 1f3718f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion async-openai/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ impl Client {
self
}

/// Exponential backoff for retrying [rate limited](https://help.openai.com/en/articles/5955598-is-api-usage-subject-to-any-rate-limits) requests. Form submissions are not retried.
/// Exponential backoff for retrying [rate limited](https://platform.openai.com/docs/guides/rate-limits) requests.
/// Form submissions are not retried.
pub fn with_backoff(mut self, backoff: backoff::ExponentialBackoff) -> Self {
self.backoff = backoff;
self
Expand Down
5 changes: 5 additions & 0 deletions async-openai/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
//!
//! // Use organization other than default when making requests
//! let client = Client::new().with_org_id("the-org");
//!
//! // Use custom reqwest client
//! let http_client = reqwest::ClientBuilder::new().user_agent("async-openai").build().unwrap();
//! let client = Client::new().with_http_client(http_client);
//! ```
//!
//! ## Making requests
Expand All @@ -27,6 +31,7 @@
//! let client = Client::new();
//!
//! // Create request using builder pattern
//! // Every request struct has companion builder struct with same name + Args suffix
//! let request = CreateCompletionRequestArgs::default()
//! .model("text-davinci-003")
//! .prompt("Tell me the recipe of alfredo pasta")
Expand Down

0 comments on commit 1f3718f

Please sign in to comment.