Azure / Azure/azure-sdk-for-java

[FEATURE REQ] `azure-core-http-<netty/okhttp>` support for more granular request/response timeouts.

Open
#47,552 2 comments 0 reactions 1 assignee Claimed by @alzimmermsft View on GitHub
Azure.Core HttpClient
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

**Is your feature request related to a problem? Please describe.**

In the `azure-ai-agents` and `azure-ai-projects` packages, we have the need to wrap OpenAI's official Java SDK. Their SDK provides a type called [RequestOptions](https://github.com/openai/openai-java/blob/b855c3b32eafc14470b450d96f93f4c0dc4df4f6/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt#L4) which provides the means to override timeout values per request for users of the SDK.

`RequestOptions` contains a [Timeout](https://github.com/openai/openai-java/blob/b855c3b32eafc14470b450d96f93f4c0dc4df4f6/openai-java-core/src/main/kotlin/com/openai/core/Timeout.kt#L4) instance with 4 different timeouts:
- `read`
- `write`
- `connect`
- `request`

**Describe the solution you'd like**

In our [current implementation](https://github.com/Azure/azure-sdk-for-java/pull/47416#discussion_r2612099167) we are using `read` timeout as it's the functionally closest to the one that can be set via `Context` by the key `"azure-response-timeout"`. We would like to have the means to map all the values in the `Timeout` class from OpenAI to the request in the HttpClients from `azure-core`.

**Describe alternatives you've considered**

There doesn't seem to be an API surface that would allow us to forward these values. We are currently using `"read"` as the `"azure_response_timeout"` as it's the functionally closest timeout judging by OpenAI's documentation of the `Timeout` class (linked above).

**Additional context**

This feature request stems from this [PR](https://github.com/Azure/azure-sdk-for-java/pull/47416#discussion_r2612099167).

**Information Checklist**

Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x] Description Added
- [x] Expected solution specified

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.