@@ -101,7 +101,7 @@ void shouldCacheSystemMessageOnly() {
101101 String systemPrompt = loadPrompt ("system-only-cache-prompt.txt" );
102102
103103 AnthropicChatOptions options = AnthropicChatOptions .builder ()
104- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
104+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
105105 .cacheOptions (AnthropicCacheOptions .builder ().strategy (AnthropicCacheStrategy .SYSTEM_ONLY ).build ())
106106 .maxTokens (150 )
107107 .temperature (0.3 )
@@ -142,7 +142,7 @@ void shouldCacheSystemAndTools() {
142142 MockWeatherService weatherService = new MockWeatherService ();
143143
144144 AnthropicChatOptions options = AnthropicChatOptions .builder ()
145- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
145+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
146146 .cacheOptions (AnthropicCacheOptions .builder ().strategy (AnthropicCacheStrategy .SYSTEM_AND_TOOLS ).build ())
147147 .maxTokens (200 )
148148 .temperature (0.3 )
@@ -233,7 +233,7 @@ void shouldCacheConversationHistory() {
233233 String response = chatClient .prompt ()
234234 .user ("What career advice would you give me based on our conversation?" )
235235 .options (AnthropicChatOptions .builder ()
236- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
236+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
237237 .cacheOptions (
238238 AnthropicCacheOptions .builder ().strategy (AnthropicCacheStrategy .CONVERSATION_HISTORY ).build ())
239239 .maxTokens (200 )
@@ -258,7 +258,7 @@ void shouldRespectMinLengthForSystemCaching() {
258258 String systemPrompt = loadPrompt ("system-only-cache-prompt.txt" );
259259
260260 AnthropicChatOptions options = AnthropicChatOptions .builder ()
261- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
261+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
262262 .cacheOptions (AnthropicCacheOptions .builder ()
263263 .strategy (AnthropicCacheStrategy .SYSTEM_ONLY )
264264 // Set min length above actual system prompt length to prevent caching
@@ -287,7 +287,7 @@ void shouldRespectMinLengthForUserHistoryCaching() {
287287
288288 // Set USER min length high so caching should not apply
289289 AnthropicChatOptions noCacheOptions = AnthropicChatOptions .builder ()
290- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
290+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
291291 .cacheOptions (AnthropicCacheOptions .builder ()
292292 .strategy (AnthropicCacheStrategy .CONVERSATION_HISTORY )
293293 .messageTypeMinContentLength (MessageType .USER , userMessage .length () + 1 )
@@ -305,7 +305,7 @@ void shouldRespectMinLengthForUserHistoryCaching() {
305305
306306 // Now allow caching by lowering the USER min length
307307 AnthropicChatOptions cacheOptions = AnthropicChatOptions .builder ()
308- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
308+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
309309 .cacheOptions (AnthropicCacheOptions .builder ()
310310 .strategy (AnthropicCacheStrategy .CONVERSATION_HISTORY )
311311 .messageTypeMinContentLength (MessageType .USER , userMessage .length () - 1 )
@@ -334,7 +334,7 @@ void shouldRespectAllButLastUserMessageForUserHistoryCaching() {
334334 // The combined length of the first two USER messages exceeds the min length,
335335 // so caching should apply
336336 AnthropicChatOptions cacheOptions = AnthropicChatOptions .builder ()
337- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
337+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
338338 .cacheOptions (AnthropicCacheOptions .builder ()
339339 .strategy (AnthropicCacheStrategy .CONVERSATION_HISTORY )
340340 .messageTypeMinContentLength (MessageType .USER , userMessage .length ())
@@ -357,7 +357,7 @@ void shouldHandleExtendedTtlCaching() {
357357 String systemPrompt = loadPrompt ("extended-ttl-cache-prompt.txt" );
358358
359359 AnthropicChatOptions options = AnthropicChatOptions .builder ()
360- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
360+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
361361 .cacheOptions (AnthropicCacheOptions .builder ()
362362 .strategy (AnthropicCacheStrategy .SYSTEM_ONLY )
363363 .messageTypeTtl (MessageType .SYSTEM , AnthropicCacheTtl .ONE_HOUR )
@@ -398,7 +398,7 @@ void shouldNotCacheWithNoneStrategy() {
398398 String systemPrompt = "You are a helpful assistant." ;
399399
400400 AnthropicChatOptions options = AnthropicChatOptions .builder ()
401- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
401+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
402402 .cacheOptions (AnthropicCacheOptions .builder ().strategy (AnthropicCacheStrategy .NONE ).build ())
403403 .maxTokens (50 )
404404 .temperature (0.3 )
@@ -428,15 +428,15 @@ void shouldHandleMultipleCacheStrategiesInSession() {
428428 responses .add (this .chatModel .call (new Prompt (
429429 List .of (new SystemMessage ("You are a math tutor." ), new UserMessage ("What is calculus?" )),
430430 AnthropicChatOptions .builder ()
431- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
431+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
432432 .cacheOptions (AnthropicCacheOptions .builder ().strategy (AnthropicCacheStrategy .SYSTEM_ONLY ).build ())
433433 .maxTokens (100 )
434434 .build ())));
435435
436436 // Second: No caching
437437 responses .add (this .chatModel .call (new Prompt (List .of (new UserMessage ("What's 5+5?" )),
438438 AnthropicChatOptions .builder ()
439- .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4 .getValue ())
439+ .model (AnthropicApi .ChatModel .CLAUDE_SONNET_4_0 .getValue ())
440440 .cacheOptions (AnthropicCacheOptions .builder ().strategy (AnthropicCacheStrategy .NONE ).build ())
441441 .maxTokens (50 )
442442 .build ())));
0 commit comments