Skip to content

Commit

Permalink
Add example for setting a request timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Feb 15, 2024
1 parent 28bb9c9 commit 113f6a3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ OpenAI openAI = OpenAI.newBuilder(System.getenv("OPENAI_API_KEY"))
.httpClient(httpClient)
.build();
```
- Configure a timeout for all requests
```java
OpenAI openAI = OpenAI.newBuilder(System.getenv("OPENAI_API_KEY"))
.requestTimeout(Duration.ofSeconds(10))
.build();
```
- Create chat completion async
```java
ChatClient chatClient = openAI.chatClient();
Expand Down

0 comments on commit 113f6a3

Please sign in to comment.