Class MistralAiStreamFunctionCallingHelper
java.lang.Object
org.springframework.ai.mistralai.api.MistralAiStreamFunctionCallingHelper
Helper class to support Streaming function calling.
It can merge the streamed ChatCompletionChunk in case of function calling message.
- Since:
- 0.8.1
- Author:
- Christian Tzolov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isStreamingToolFunctionCall
(MistralAiApi.ChatCompletionChunk chatCompletion) boolean
isStreamingToolFunctionCallFinish
(MistralAiApi.ChatCompletionChunk chatCompletion) merge
(MistralAiApi.ChatCompletionChunk previous, MistralAiApi.ChatCompletionChunk current) Merge the previous and current ChatCompletionChunk into a single one.
-
Constructor Details
-
MistralAiStreamFunctionCallingHelper
public MistralAiStreamFunctionCallingHelper()
-
-
Method Details
-
merge
public MistralAiApi.ChatCompletionChunk merge(MistralAiApi.ChatCompletionChunk previous, MistralAiApi.ChatCompletionChunk current) Merge the previous and current ChatCompletionChunk into a single one.- Parameters:
previous
- the previous ChatCompletionChunkcurrent
- the current ChatCompletionChunk- Returns:
- the merged ChatCompletionChunk
-
isStreamingToolFunctionCall
- Parameters:
chatCompletion
- the ChatCompletionChunk to check- Returns:
- true if the ChatCompletionChunk is a streaming tool function call.
-
isStreamingToolFunctionCallFinish
- Parameters:
chatCompletion
- the ChatCompletionChunk to check- Returns:
- true if the ChatCompletionChunk is a streaming tool function call and it is the last one.
-