packages feed

agentic-anthropic 0.2.0.2 → 0.2.0.3

raw patch · 4 files changed

+15/−11 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Agentic.Anthropic: Anthropic :: Text -> Maybe Text -> Int -> Maybe Effort -> Bool -> Maybe Text -> String -> Int -> Anthropic
+ Agentic.Anthropic: Anthropic :: Text -> Maybe Text -> Int -> Maybe Effort -> Bool -> Maybe Text -> Text -> Int -> Anthropic
- Agentic.Anthropic: [endpoint] :: Anthropic -> String
+ Agentic.Anthropic: [endpoint] :: Anthropic -> Text

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog for agentic-anthropic +## 0.2.0.3 - 2026-10-06++* Follows agentic's renames: `endpoint` is `Text`.+ ## 0.2.0.2 - 2026-10-01  * No changes; released alongside agentic 0.2.0.2.
agentic-anthropic.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               agentic-anthropic-version:            0.2.0.2+version:            0.2.0.3 synopsis:           Claude as the System Two provider for agentic description:   Runs agentic's draft steps on Claude through the Messages API, with strict structured outputs and tools, and can stand in as System One.
src/Agentic/Anthropic.hs view
@@ -51,7 +51,7 @@     -- ^ Let the API retry a refused request on a fallback model it picks.   , key :: Maybe Text     -- ^ Defaults to the @ANTHROPIC_API_KEY@ environment variable.-  , endpoint :: String+  , endpoint :: Text   , timeout :: Int     -- ^ Seconds.   }@@ -116,7 +116,7 @@   toSystemTwo cfg = do     key' <- maybe (fmap T.pack <$> lookupEnv "ANTHROPIC_API_KEY") (pure . Just) cfg.key >>= maybe (throwIO MissingKey) pure     manager <- newTlsManager-    base <- Http.parseRequest cfg.endpoint+    base <- Http.parseRequest (T.unpack cfg.endpoint)     pure $ SystemTwo $ \conversation -> do       let http =             base@@ -156,7 +156,7 @@       <> [ ("messages", A.Array (task : concatMap exchange (history c)))          , ( "output_config"            , A.Object-               ( ("format", A.Object [("type", A.String "json_schema"), ("schema", objectSchema (output c))])+               ( ("format", A.Object [("type", A.String "json_schema"), ("schema", objectSchema (outputSchema c))])                    : maybe [] (\e -> [("effort", A.String (effortName e))]) cfg.effort                )            )@@ -164,8 +164,8 @@          ]       <> [("fallbacks", A.String "default") | cfg.fallbacks]   where-    task = message "user" (A.String (instructionText (instruction c) <> input))-    input = case state c of+    task = message "user" (A.String (instructionText (instruction c) <> inputText))+    inputText = case input c of       A.Null -> ""       s -> "\n\nInput:\n" <> A.renderJson s     tool spec =@@ -223,7 +223,7 @@     -- A reply that isn't JSON goes back to the core as text; the output     -- contract then rejects it and the model gets another go.     final text = case J.eitherDecode (TL.encodeUtf8 (TL.fromStrict text)) of-      Right v -> unwrap (output c) (fromAeson v)+      Right v -> unwrap (outputSchema c) (fromAeson v)       Left _ -> A.String text     unwrapInput name v = maybe v (`unwrap` v) (inputSchema name)     inputSchema :: Text -> Maybe Schema
test/Spec.hs view
@@ -18,10 +18,10 @@   Conversation     { path = []     , instruction = "Suggest 3 dinosaurs"-    , state = Null-    , stateSchema = schemaOf SNull+    , input = Null+    , inputSchema = schemaOf SNull     , tools = [ToolSpec "search" "Search the fossil database" (codecSchema (contract @Text))]-    , output = codecSchema (contract @[Text])+    , outputSchema = codecSchema (contract @[Text])     , history = []     } @@ -48,7 +48,7 @@         )    it "keeps a record's field order in its schema" $ do-    let body = renderJson (requestBody anthropic conversation {output = codecSchema (contract @(Text, Text, Text))})+    let body = renderJson (requestBody anthropic conversation {outputSchema = codecSchema (contract @(Text, Text, Text))})         at' k = T.length (fst (T.breakOn k body))     (at' "\"_1\"" < at' "\"_2\"", at' "\"_2\"" < at' "\"_3\"") `shouldBe` (True, True)