packages feed

baikai-claude 0.3.0.1 → 0.3.0.2

raw patch · 5 files changed

+74/−4 lines, 5 filesdep ~baikaiPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: baikai

API changes (from Hackage documentation)

Files

baikai-claude.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.4 name:          baikai-claude-version:       0.3.0.1+version:       0.3.0.2 synopsis:      Anthropic Claude providers for the baikai abstraction description:   Wraps the claude Haskell package as a Baikai Provider for both the Anthropic API and the@@ -43,7 +43,7 @@    build-depends:     , aeson              ^>=2.2-    , baikai             ^>=0.3.0+    , baikai             ^>=0.4.0     , base               >=4.20   && <5     , base64-bytestring  ^>=1.2     , bytestring         ^>=0.12@@ -80,7 +80,7 @@   ghc-options:    -threaded -with-rtsopts=-N   build-depends:     , aeson-    , baikai            ^>=0.3.0+    , baikai            ^>=0.4.0     , baikai-claude     , base              >=4.20   && <5     , bytestring
src/Baikai/Provider/Claude/Interactive.hs view
@@ -23,6 +23,7 @@     interactiveLaunchResult,   ) import Baikai.Prelude+import Baikai.ThinkingLevel (ThinkingLevel (..), renderThinkingLevel) import Cradle (addArgs, cmd, run, setWorkingDir) import Data.Generics.Labels () import Data.Text qualified as Text@@ -50,6 +51,7 @@ claudeInteractiveCommand cfg req =   ( cfg ^. #executable,     modelArgs req+      <> effortArgs req       <> systemPromptArgs req       <> extraDirArgs req       <> safetyArgs req@@ -76,6 +78,17 @@   Nothing -> []   Just "" -> []   Just mid -> ["--model", Text.unpack mid]++-- | Claude's @--effort@ accepts @low|medium|high|xhigh|max@, but+-- not @minimal@, so the lowest Baikai level maps up to @low@.+effortArgs :: InteractiveLaunchRequest -> [String]+effortArgs req = case req ^. #effort of+  Nothing -> []+  Just lvl -> ["--effort", Text.unpack (claudeEffortValue lvl)]++claudeEffortValue :: ThinkingLevel -> Text+claudeEffortValue ThinkingMinimal = "low"+claudeEffortValue lvl = renderThinkingLevel lvl  systemPromptArgs :: InteractiveLaunchRequest -> [String] systemPromptArgs req = case Text.strip <$> req ^. #systemPrompt of
src/Baikai/Provider/Claude/Internal/Request.hs view
@@ -184,6 +184,8 @@   ThinkingLow -> Just "low"   ThinkingMedium -> Just "medium"   ThinkingHigh -> Nothing+  ThinkingXHigh -> Just "xhigh"+  ThinkingMax -> Just "max"  -- | Map a baikai 'Tool.Tool' into the upstream Anthropic -- 'ClaudeTool.ToolDefinition'. The SDK helper is used to populate
test/Main.hs view
@@ -32,6 +32,7 @@     testGroup       "Baikai.Provider.Claude"       [ commandRenderingTest,+        effortRenderingTests,         batchCommandRenderingTest,         stderrFloodTest,         compatDetectionTest,@@ -137,6 +138,24 @@               "inspect the repo"             ]           )++effortRenderingTests :: TestTree+effortRenderingTests =+  testGroup+    "renders interactive reasoning effort"+    [ testCase name $ do+        let req = interactiveLaunchRequest "prompt" & #effort .~ Just level+        claudeInteractiveCommand defaultClaudeInteractiveConfig req+          @?= ("claude", ["--effort", expected, "--", "prompt"])+    | (name, level, expected) <-+        [ ("minimal as low", ThinkingMinimal, "low"),+          ("low", ThinkingLow, "low"),+          ("medium", ThinkingMedium, "medium"),+          ("high", ThinkingHigh, "high"),+          ("xhigh", ThinkingXHigh, "xhigh"),+          ("max", ThinkingMax, "max")+        ]+    ]  batchCommandRenderingTest :: TestTree batchCommandRenderingTest =
test/ThinkingSpec.hs view
@@ -23,6 +23,8 @@   testGroup     "ThinkingSpec"     [ testGroup "mapRequest max_tokens" (neverExceedsCapTests <> styleTests),+      adaptiveHigherEffortTests,+      maxBudgetTest,       explicitMaxTokensTest,       handRolledUnclampedTest,       tooSmallCapDropsThinkingTest,@@ -48,7 +50,9 @@   [ ("minimal", ThinkingMinimal),     ("low", ThinkingLow),     ("medium", ThinkingMedium),-    ("high", ThinkingHigh)+    ("high", ThinkingHigh),+    ("xhigh", ThinkingXHigh),+    ("max", ThinkingMax)   ]  neverExceedsCapTests :: [TestTree]@@ -82,6 +86,36 @@     (levelName, level) <- thinkingLevels   ] +adaptiveHigherEffortTests :: TestTree+adaptiveHigherEffortTests =+  testGroup+    "adaptive higher effort"+    [ testCase name $ do+        req <-+          requestFor+            anthropic_claude_opus_4_7+            (emptyOptions & #thinking .~ Just level)+        requestThinking req @?= Just Messages.ThinkingAdaptive+        (Messages.output_config req >>= Messages.effort) @?= Just expected+    | (name, level, expected) <-+        [ ("xhigh is preserved", ThinkingXHigh, "xhigh"),+          ("max is preserved", ThinkingMax, "max")+        ]+    ]++maxBudgetTest :: TestTree+maxBudgetTest =+  testCase "manual max effort uses 32768 tokens with visible-output room" $ do+    req <-+      requestFor+        anthropic_claude_haiku_4_5+        (emptyOptions & #thinking .~ Just ThinkingMax)+    requestThinking req+      @?= Just Messages.ThinkingEnabled {Messages.budget_tokens = 32768}+    assertBool+      "max_tokens leaves visible-output room beyond the max thinking budget"+      (Messages.max_tokens req > 32768)+ explicitMaxTokensTest :: TestTree explicitMaxTokensTest =   testCase "explicit maxTokens participates as visible output plus budget, then clamps" $ do@@ -167,6 +201,8 @@   ThinkingLow -> Just "low"   ThinkingMedium -> Just "medium"   ThinkingHigh -> Nothing+  ThinkingXHigh -> Just "xhigh"+  ThinkingMax -> Just "max"  streamFidelityTests :: TestTree streamFidelityTests =