Skip to content

Commit 6259798

Browse files
YunKuiLuWillam2004
authored andcommitted
docs: Fix chatclient.adoc responseEntity() documentation (spring-projects#4386)
- Correct inaccurate description of responseEntity() returning HTTP response details - Add complete documentation for all three responseEntity() method overloads - Reorder entity() and responseEntity() methods for logical flow - Ensure consistency with entity() method documentation format Auto-cherry-pick to 1.0.x Fixes spring-projects#4386 Signed-off-by: YunKui Lu <[email protected]> Signed-off-by: 家娃 <[email protected]>
1 parent 9470c2b commit 6259798

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,14 @@ After specifying the `call()` method on `ChatClient`, there are a few different
365365
* `String content()`: returns the String content of the response
366366
* `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.
367367
* `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).
368-
* `ResponseEntity<?> responseEntity()`: returns a `ResponseEntity` containing the full HTTP response, including status code, headers, and body.
369-
This is useful when you need access to low-level HTTP details of the response.
370368
* `entity()` to return a Java type
371369
** `entity(ParameterizedTypeReference<T> type)`: used to return a `Collection` of entity types.
372370
** `entity(Class<T> type)`: used to return a specific entity type.
373371
** `entity(StructuredOutputConverter<T> structuredOutputConverter)`: used to specify an instance of a `StructuredOutputConverter` to convert a `String` to an entity type.
372+
* `responseEntity()` to return both the `ChatResponse` and a Java type. This is useful when you need access to both the complete AI model response (with metadata and generations) and the structured output entity in a single call.
373+
** `responseEntity(Class<T> type)`: used to return a `ResponseEntity` containing both the complete `ChatResponse` object and a specific entity type.
374+
** `responseEntity(ParameterizedTypeReference<T> type)`: used to return a `ResponseEntity` containing both the complete `ChatResponse` object and a `Collection` of entity types.
375+
** `responseEntity(StructuredOutputConverter<T> structuredOutputConverter)`: used to return a `ResponseEntity` containing both the complete `ChatResponse` object and an entity converted using a specified `StructuredOutputConverter`.
374376

375377
You can also invoke the `stream()` method instead of `call()`.
376378

0 commit comments

Comments
 (0)