@@ -21,13 +21,15 @@ package com.xemantic.ai.claudine
2121import com.xemantic.ai.anthropic.Anthropic
2222import com.xemantic.ai.anthropic.AnthropicConfigException
2323import com.xemantic.ai.anthropic.cache.CacheControl
24+ import com.xemantic.ai.anthropic.content.ThinkingBlock
2425import com.xemantic.ai.anthropic.cost.CostWithUsage
2526import com.xemantic.ai.anthropic.cost.costReport
2627import com.xemantic.ai.anthropic.message.Message
2728import com.xemantic.ai.anthropic.message.StopReason
2829import com.xemantic.ai.anthropic.message.System
2930import com.xemantic.ai.anthropic.message.addCacheBreakpoint
3031import com.xemantic.ai.anthropic.message.plusAssign
32+ import com.xemantic.ai.anthropic.thinking.ThinkingConfigEnabled
3133import com.xemantic.ai.anthropic.tool.Toolbox
3234import com.xemantic.ai.claudine.tool.CreateFile
3335import com.xemantic.ai.claudine.tool.ExecuteShellCommand
@@ -140,6 +142,9 @@ suspend fun claudine(): Int {
140142 ttl = CacheControl .Ephemeral .TTL .ONE_HOUR
141143 )
142144 tools = toolbox.tools
145+ thinking = ThinkingConfigEnabled {
146+ budgetTokens = 2048
147+ }
143148 }
144149 if (response.stopReason == StopReason .MAX_TOKENS ) {
145150 println (" [Claudine]> Error: max number of output tokens reached" )
@@ -151,6 +156,13 @@ suspend fun claudine(): Int {
151156
152157 conversation + = response
153158
159+ // Display thinking process if available
160+ response.content.filterIsInstance<ThinkingBlock >().firstOrNull()?.let { thinkingBlock ->
161+ print (" [Claudine - Thinking]> " )
162+ println (thinkingBlock.thinking)
163+ println ()
164+ }
165+
154166 response.text?.run {
155167 println (" [Claudine]> ${response.text} " )
156168 }
0 commit comments