Skip to content

Commit 61c32ae

Browse files
authored
Update anthropic-chat.adoc (#2723)
AnthropicChatModel does not provide a constructor with two parameters. If there are two parameters, use the Builder to construct an AnthropicChatModel. The current document misleads users and needs to be updated. Fixes #2723 Auto-cherry-pick to 1.0.x Signed-off-by: Lpepsi <846179345@qq.com>
1 parent a775095 commit 61c32ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/anthropic-chat.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,13 @@ Next, create a `AnthropicChatModel` and use it for text generations:
484484
[source,java]
485485
----
486486
var anthropicApi = new AnthropicApi(System.getenv("ANTHROPIC_API_KEY"));
487-
488-
var chatModel = new AnthropicChatModel(this.anthropicApi,
489-
AnthropicChatOptions.builder()
490-
.model("claude-3-opus-20240229")
487+
var anthropicChatOptions = AnthropicChatOptions.builder()
488+
.model("claude-3-7-sonnet-20250219")
491489
.temperature(0.4)
492490
.maxTokens(200)
493-
.build());
491+
.build()
492+
var chatModel = AnthropicChatModel.builder().anthropicApi(anthropicApi)
493+
.defaultOptions(anthropicChatOptions).build();
494494
495495
ChatResponse response = this.chatModel.call(
496496
new Prompt("Generate the names of 5 famous pirates."));

0 commit comments

Comments
 (0)