Skip to content

Commit

Permalink
fix: Implemented the doChatCompletionStream abstract method for abstr…
Browse files Browse the repository at this point in the history
…act class AbstractFunctionCallSupport in ZhiPuAiChatClient
  • Loading branch information
mxsl-gr committed May 21, 2024
1 parent 2abf10d commit aee834c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.ai.model.ModelOptionsUtils;
import org.springframework.ai.model.function.AbstractFunctionCallSupport;
import org.springframework.ai.model.function.FunctionCallbackContext;
import org.springframework.ai.retry.RetryUtils;
import org.springframework.ai.zhipuai.api.ZhiPuAiApi;
import org.springframework.ai.zhipuai.api.ZhiPuAiApi.ChatCompletion;
import org.springframework.ai.zhipuai.api.ZhiPuAiApi.ChatCompletion.Choice;
Expand All @@ -36,7 +37,6 @@
import org.springframework.ai.zhipuai.api.ZhiPuAiApi.ChatCompletionMessage.Role;
import org.springframework.ai.zhipuai.api.ZhiPuAiApi.ChatCompletionMessage.ToolCall;
import org.springframework.ai.zhipuai.api.ZhiPuAiApi.ChatCompletionRequest;
import org.springframework.ai.retry.RetryUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.Assert;
Expand Down Expand Up @@ -359,7 +359,10 @@ protected ResponseEntity<ChatCompletion> doChatCompletion(ChatCompletionRequest

@Override
protected Flux<ResponseEntity<ChatCompletion>> doChatCompletionStream(ChatCompletionRequest request) {
throw new RuntimeException("Streaming Function calling is not supported");
return this.zhiPuAiApi.chatCompletionStream(request)
.map(this::chunkToChatCompletion)
.map(Optional::ofNullable)
.map(ResponseEntity::of);
}

@Override
Expand Down

0 comments on commit aee834c

Please sign in to comment.