Class MiniMaxStreamFunctionCallingHelper
java.lang.Object
org.springframework.ai.minimax.api.MiniMaxStreamFunctionCallingHelper
Helper class to support Streaming function calling. It can merge the streamed
ChatCompletionChunk in case of function calling message.
- Since:
- 1.0.0 M1
- Author:
- Geng Rong
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConvert the ChatCompletionChunk into a ChatCompletion.boolean
isStreamingToolFunctionCall
(MiniMaxApi.ChatCompletionChunk chatCompletion) boolean
isStreamingToolFunctionCallFinish
(MiniMaxApi.ChatCompletionChunk chatCompletion) merge
(MiniMaxApi.ChatCompletionChunk previous, MiniMaxApi.ChatCompletionChunk current)
-
Constructor Details
-
MiniMaxStreamFunctionCallingHelper
public MiniMaxStreamFunctionCallingHelper()
-
-
Method Details
-
merge
public MiniMaxApi.ChatCompletionChunk merge(MiniMaxApi.ChatCompletionChunk previous, MiniMaxApi.ChatCompletionChunk current) -
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.
-
chunkToChatCompletion
Convert the ChatCompletionChunk into a ChatCompletion. The Usage is set to null.- Parameters:
chunk
- the ChatCompletionChunk to convert- Returns:
- the ChatCompletion
-