Skip to content

Commit db61203

Browse files
authored
chat client doc improvements (#3963)
1. add a description of the responseEntity() method within the call() return values section 2. add a Note in the documentation to clarify that calling the call() method Fixes #3963 Auto-cherry-pick to 1.0.x Signed-off-by: 李沛谕 <[email protected]>
1 parent 59f2b3b commit db61203

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,16 @@ After specifying the `call()` method on `ChatClient`, there are a few different
361361
* `String content()`: returns the String content of the response
362362
* `ChatResponse chatResponse()`: returns the `ChatResponse` object that contains multiple generations and also metadata about the response, for example how many token were used to create the response.
363363
* `ChatClientResponse chatClientResponse()`: returns a `ChatClientResponse` object that contains the `ChatResponse` object and the ChatClient execution context, giving you access to additional data used during the execution of advisors (e.g. the relevant documents retrieved in a RAG flow).
364+
* `ResponseEntity<?> responseEntity()`: returns a `ResponseEntity` containing the full HTTP response, including status code, headers, and body. This is useful when you need access to low-level HTTP details of the response.
364365
* `entity()` to return a Java type
365366
** `entity(ParameterizedTypeReference<T> type)`: used to return a `Collection` of entity types.
366367
** `entity(Class<T> type)`: used to return a specific entity type.
367368
** `entity(StructuredOutputConverter<T> structuredOutputConverter)`: used to specify an instance of a `StructuredOutputConverter` to convert a `String` to an entity type.
368369

369370
You can also invoke the `stream()` method instead of `call()`.
370371

372+
NOTE: Calling the `call()` method does not actually trigger the AI model execution. Instead, it only instructs Spring AI whether to use synchronous or streaming calls. The actual AI model invocation occurs when methods such as `content()`, `chatResponse()`, and `responseEntity()` are called.
373+
371374
== stream() return values
372375

373376
After specifying the `stream()` method on `ChatClient`, there are a few options for the response type:

0 commit comments

Comments
 (0)