Package de.espirit.firstspirit.ai
Interface GenerativeAIFunctionRequest.EvaluatedResponseStream
- All Superinterfaces:
AutoCloseable
,Closeable
,GenerativeAIFunctionRequest.EvaluatedResponse
,Iterator<Response>
,ResponseStream
- Enclosing interface:
- GenerativeAIFunctionRequest
public static interface GenerativeAIFunctionRequest.EvaluatedResponseStream
extends GenerativeAIFunctionRequest.EvaluatedResponse, ResponseStream
Evaluated response stream of the generative AI, potentially containing function call requests.
- Since:
- 5.2.250908
-
Method Summary
Modifier and TypeMethodDescription@NotNull Response
The response object returned by the generative AI.@NotNull Optional<TokenUsage>
Returns information about the combined token usage for the current function calling chain.Methods inherited from interface de.espirit.firstspirit.ai.GenerativeAIFunctionRequest.EvaluatedResponse
createRequest, getFunctionCallHandles
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
Methods inherited from interface de.espirit.firstspirit.ai.dto.ResponseStream
stream
-
Method Details
-
getResponse
The response object returned by the generative AI.NOTE: To retrieve a combined token usage of all preceding requests use
This method will preload all chunks from the stream without consuming them in order to return an accumulated response.GenerativeAIFunctionRequest.EvaluatedResponse.getTokenUsage()
instead of retrieving it from the returned response usingResponse.getTokenUsage()
.- Specified by:
getResponse
in interfaceGenerativeAIFunctionRequest.EvaluatedResponse
- Returns:
- The response object.
-
getTokenUsage
Returns information about the combined token usage for the current function calling chain. This method will preload all chunks from the stream without consuming them in order to calculate the total token usages.- Specified by:
getTokenUsage
in interfaceGenerativeAIFunctionRequest.EvaluatedResponse
- Returns:
- The combined token usage information, if available.
-