Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,16 @@ public static DeepSeekChatOptions fromOptions(DeepSeekChatOptions fromOptions) {
.topP(fromOptions.getTopP())
.tools(fromOptions.getTools())
.toolChoice(fromOptions.getToolChoice())
.toolCallbacks(
fromOptions.getToolCallbacks() != null ? new ArrayList<>(fromOptions.getToolCallbacks()) : null)
.toolNames(fromOptions.getToolNames() != null ? new HashSet<>(fromOptions.getToolNames()) : null)
.toolCallbacks(new ArrayList<>(fromOptions.getToolCallbacks()))
.toolNames(new HashSet<>(fromOptions.getToolNames()))
.internalToolExecutionEnabled(fromOptions.getInternalToolExecutionEnabled())
.toolContext(fromOptions.getToolContext() != null ? new HashMap<>(fromOptions.getToolContext()) : null)
.toolContext(new HashMap<>(fromOptions.getToolContext()))
.build();
}

public static final class Builder {

protected DeepSeekChatOptions options;
private final DeepSeekChatOptions options;

public Builder() {
this.options = new DeepSeekChatOptions();
Expand Down Expand Up @@ -488,12 +487,8 @@ public Builder internalToolExecutionEnabled(@Nullable Boolean internalToolExecut
}

public Builder toolContext(Map<String, Object> toolContext) {
if (this.options.toolContext == null) {
this.options.toolContext = toolContext;
}
else {
this.options.toolContext.putAll(toolContext);
}
Assert.notNull(toolContext, "toolContext cannot be null");
this.options.toolContext.putAll(toolContext);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

/**
* Single class implementation of the DeepSeek Chat Completion API:
* https://platform.deepseek.com/api-docs/api/create-chat-completion
* <a href="https://platform.deepseek.com/api-docs/api/create-chat-completion">...</a>
*
* @author Geng Rong
*/
Expand Down Expand Up @@ -201,7 +201,7 @@ public Flux<ChatCompletionChunk> chatCompletionStream(ChatCompletionRequest chat
.concatMapIterable(window -> {
Mono<ChatCompletionChunk> monoChunk = window.reduce(
new ChatCompletionChunk(null, null, null, null, null, null, null, null),
(previous, current) -> this.chunkMerger.merge(previous, current));
this.chunkMerger::merge);
return List.of(monoChunk);
})
// Flux<Mono<ChatCompletionChunk>> -> Flux<ChatCompletionChunk>
Expand Down