Class MistralAiStreamFunctionCallingHelper

java.lang.Object
org.springframework.ai.mistralai.api.MistralAiStreamFunctionCallingHelper

public class MistralAiStreamFunctionCallingHelper extends Object
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 Details

    • MistralAiStreamFunctionCallingHelper

      public MistralAiStreamFunctionCallingHelper()
  • Method Details

    • merge

      Merge the previous and current ChatCompletionChunk into a single one.
      Parameters:
      previous - the previous ChatCompletionChunk
      current - the current ChatCompletionChunk
      Returns:
      the merged ChatCompletionChunk
    • isStreamingToolFunctionCall

      public boolean isStreamingToolFunctionCall(MistralAiApi.ChatCompletionChunk chatCompletion)
      Parameters:
      chatCompletion - the ChatCompletionChunk to check
      Returns:
      true if the ChatCompletionChunk is a streaming tool function call.
    • isStreamingToolFunctionCallFinish

      public boolean isStreamingToolFunctionCallFinish(MistralAiApi.ChatCompletionChunk chatCompletion)
      Parameters:
      chatCompletion - the ChatCompletionChunk to check
      Returns:
      true if the ChatCompletionChunk is a streaming tool function call and it is the last one.