agentic-openai 0.2.0.2 → 0.2.0.3
raw patch · 5 files changed
+17/−13 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Agentic.OpenAI: OpenAI :: Text -> Maybe Text -> Maybe Int -> Maybe Effort -> Maybe Text -> String -> Int -> OpenAI
+ Agentic.OpenAI: OpenAI :: Text -> Maybe Text -> Maybe Int -> Maybe Effort -> Maybe Text -> Text -> Int -> OpenAI
- Agentic.OpenAI: [endpoint] :: OpenAI -> String
+ Agentic.OpenAI: [endpoint] :: OpenAI -> Text
Files
- CHANGELOG.md +4/−0
- agentic-openai.cabal +1/−1
- src/Agentic/OpenAI.hs +7/−7
- test-live/Live.hs +1/−1
- test/Spec.hs +4/−4
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog for agentic-openai +## 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-openai.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: agentic-openai-version: 0.2.0.2+version: 0.2.0.3 synopsis: OpenAI as the System Two provider for agentic description: Runs agentic's draft steps on OpenAI models through the Responses API, with strict structured outputs and tools, and can stand in as System One.
src/Agentic/OpenAI.hs view
@@ -48,7 +48,7 @@ -- ^ The model's default if unset. , key :: Maybe Text -- ^ Defaults to the @OPENAI_API_KEY@ environment variable.- , endpoint :: String+ , endpoint :: Text , timeout :: Int -- ^ Seconds. }@@ -108,7 +108,7 @@ toSystemTwo cfg = do key' <- maybe (fmap T.pack <$> lookupEnv "OPENAI_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@@ -148,8 +148,8 @@ [ ( "format" , A.Object [ ("type", A.String "json_schema")- , ("name", A.String (schemaName (output c)))- , ("schema", objectSchema (output c))+ , ("name", A.String (schemaName (outputSchema c)))+ , ("schema", objectSchema (outputSchema c)) , ("strict", A.Bool True) ] )@@ -161,8 +161,8 @@ <> maybe [] (\e -> [("reasoning", A.Object [("effort", A.String (effortName e))])]) cfg.effort <> maybe [] (\n -> [("max_output_tokens", A.Integer (toInteger n))]) cfg.maxTokens where- task = message "user" (instructionText (instruction c) <> input)- input = case state c of+ task = message "user" (instructionText (instruction c) <> inputText)+ inputText = case input c of A.Null -> "" s -> "\n\nInput:\n" <> A.renderJson s tool spec =@@ -235,7 +235,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 decodeJson text of- Just v -> unwrap (output c) v+ Just v -> unwrap (outputSchema c) v Nothing -> A.String text json t = maybe (A.String t) id (decodeJson t) decodeJson t = fromAeson <$> J.decode (TL.encodeUtf8 (TL.fromStrict t))
test-live/Live.hs view
@@ -25,7 +25,7 @@ instance Options Groan where options =- described+ documentedOptions "How much the audience groans" [option Mild "A polite smile", option Solid "An audible groan", option Unbearable "People get up and leave"]
test/Spec.hs view
@@ -27,10 +27,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 = [] } @@ -57,7 +57,7 @@ ) it "names the schema after its type, and shares repeated types through $defs" $ do- let format = at "format" (at "text" (body conversation {output = codecSchema (contract @Board)}))+ let format = at "format" (at "text" (body conversation {outputSchema = codecSchema (contract @Board)})) schema = at "schema" format at "name" format `shouldBe` J.String "Board" at "top" (at "properties" schema) `shouldBe` fromJust (J.decode "{\"$ref\":\"#/$defs/Row\"}")