jvm-openai
jvm-openai copied to clipboard
HttpRequest Timeout
In the ChatClient (or any client) it would be nice to have a timeout for the HttpRequest:
private HttpRequest createPostRequest(CreateChatCompletionRequest request, Long requestTimeout) {
return newHttpRequestBuilder(
Constants.CONTENT_TYPE_HEADER,
Constants.JSON_MEDIA_TYPE,
Constants.ACCEPT_HEADER,
Constants.JSON_MEDIA_TYPE)
.timeout(Duration.ofMillis(requestTimeout))
.uri(endpoint)
.POST(createBodyPublisher(request))
.build();
}