spring-projects / spring-projects/spring-ai

Add timeout support for ChatClient API

Open
#4,103 1 comment 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 10h
Merged PRs (30d)
5

Description

Hi team 👋

I have a suggestion for using ChatClient API.

Expected Behavior

I believe it's going to be great if the ChatClient API support timeout configuration at both global and per-request levels. Here's what I envision:

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

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

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

If you agree with this feature request, I'll try to contribute it.
Thank you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ChatClient API entry point and compare the proposed per-request, builder-level, and ChatOptions timeout scopes. The issue names no files or tests; done means the timeout behavior and precedence are defined and covered across the requested configuration levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.