Skip to content

Commit 5d62b98

Browse files
committed
Anthropic: added missing properties
1 parent ae7cf23 commit 5d62b98

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

langchain4j-anthropic-spring-boot-starter/src/main/java/dev/langchain4j/anthropic/spring/AutoConfig.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@ AnthropicChatModel anthropicChatModel(Properties properties, ObjectProvider<Chat
2323
.baseUrl(chatModelProperties.getBaseUrl())
2424
.apiKey(chatModelProperties.getApiKey())
2525
.version(chatModelProperties.getVersion())
26+
.beta(chatModelProperties.getBeta())
2627
.modelName(chatModelProperties.getModelName())
2728
.temperature(chatModelProperties.getTemperature())
2829
.topP(chatModelProperties.getTopP())
2930
.topK(chatModelProperties.getTopK())
3031
.maxTokens(chatModelProperties.getMaxTokens())
3132
.stopSequences(chatModelProperties.getStopSequences())
33+
.cacheSystemMessages(chatModelProperties.getCacheSystemMessages())
34+
.cacheTools(chatModelProperties.getCacheTools())
35+
.thinkingType(chatModelProperties.getThinkingType())
36+
.thinkingBudgetTokens(chatModelProperties.getThinkingBudgetTokens())
3237
.timeout(chatModelProperties.getTimeout())
3338
.maxRetries(chatModelProperties.getMaxRetries())
3439
.logRequests(chatModelProperties.getLogRequests())
@@ -46,12 +51,17 @@ AnthropicStreamingChatModel anthropicStreamingChatModel(Properties properties,
4651
.baseUrl(chatModelProperties.getBaseUrl())
4752
.apiKey(chatModelProperties.getApiKey())
4853
.version(chatModelProperties.getVersion())
54+
.beta(chatModelProperties.getBeta())
4955
.modelName(chatModelProperties.getModelName())
5056
.temperature(chatModelProperties.getTemperature())
5157
.topP(chatModelProperties.getTopP())
5258
.topK(chatModelProperties.getTopK())
5359
.maxTokens(chatModelProperties.getMaxTokens())
5460
.stopSequences(chatModelProperties.getStopSequences())
61+
.cacheSystemMessages(chatModelProperties.getCacheSystemMessages())
62+
.cacheTools(chatModelProperties.getCacheTools())
63+
.thinkingType(chatModelProperties.getThinkingType())
64+
.thinkingBudgetTokens(chatModelProperties.getThinkingBudgetTokens())
5565
.timeout(chatModelProperties.getTimeout())
5666
.logRequests(chatModelProperties.getLogRequests())
5767
.logResponses(chatModelProperties.getLogResponses())

langchain4j-anthropic-spring-boot-starter/src/main/java/dev/langchain4j/anthropic/spring/ChatModelProperties.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ class ChatModelProperties {
1313
String baseUrl;
1414
String apiKey;
1515
String version;
16+
String beta;
1617
String modelName;
1718
Double temperature;
1819
Double topP;
1920
Integer topK;
2021
Integer maxTokens;
2122
List<String> stopSequences;
23+
Boolean cacheSystemMessages;
24+
Boolean cacheTools;
25+
String thinkingType;
26+
Integer thinkingBudgetTokens;
2227
Duration timeout;
2328
Integer maxRetries;
2429
Boolean logRequests;

langchain4j-anthropic-spring-boot-starter/src/test/java/dev/langchain4j/anthropic/spring/AutoConfigIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void should_provide_chat_model() {
3535
contextRunner
3636
.withPropertyValues(
3737
"langchain4j.anthropic.chat-model.api-key=" + API_KEY,
38+
"langchain4j.anthropic.chat-model.model-name=claude-3-5-haiku-20241022",
3839
"langchain4j.anthropic.chat-model.max-tokens=20"
3940
)
4041
.run(context -> {
@@ -52,6 +53,7 @@ void should_provide_streaming_chat_model() {
5253
contextRunner
5354
.withPropertyValues(
5455
"langchain4j.anthropic.streaming-chat-model.api-key=" + API_KEY,
56+
"langchain4j.anthropic.streaming-chat-model.model-name=claude-3-5-haiku-20241022",
5557
"langchain4j.anthropic.streaming-chat-model.max-tokens=20"
5658
)
5759
.run(context -> {

0 commit comments

Comments
 (0)