Skip to content

Conversation

HyunSangHan
Copy link
Contributor

@HyunSangHan HyunSangHan commented Oct 10, 2025

Implemented timeout support for the ChatClient API.

// Option 1: Per-request timeout (highest priority)
ChatResponse response = chatClient
    .prompt("Hello, world!")
    .options(chatOptions)
    .timeout(Duration.ofSeconds(30))
    .call();

// Option 2: ChatOptions integration (medium priority)
ChatOptions options = ChatOptions.builder()
    .temperature(0.7)
    .timeout(Duration.ofSeconds(10))
    .build();

// Option 3: Builder-level default timeout (lowest priority)
ChatClient client = ChatClient.builder(chatModel)
    .defaultTimeout(Duration.ofSeconds(30))
    .build();

The implementation introduces three levels of timeout configuration with proper priority handling:

  1. Request-level timeout
    Added timeout(Duration) method to ChatClientRequestSpec for per-request configuration (highest priority).

  2. ChatOptions-level timeout
    Added getTimeout() accessor and timeout(Duration) builder method to the ChatOptions interface (medium priority).

  3. Builder-level default timeout
    Added defaultTimeout(Duration) method to the ChatClient.Builder for global default configuration (lowest priority).

I confirmed relevant tests are passed like below:

image image

Closes: #4103

Add timeout configuration at request, builder, and ChatOptions levels.

Signed-off-by: Hyunsang Han <gustkd3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add timeout support for ChatClient API

2 participants