Skip to content

Commit

Permalink
Fix Custom GPT API
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Sep 6, 2024
1 parent ed8ee78 commit f83198b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/haskell/web-service/src/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,21 @@ instance ToParamSchema FnLiteral where
toParamSchema _ =
mempty
& title ?~ "Function argument"
-- Even though this is strictly speaking not *only* a string, custom GPT seem
-- to need this, otherwise they will fail to send any requests to any endpoint with
-- this query parameter.
& type_ ?~ OpenApiString
& example ?~ Aeson.String "true"
& description ?~ "A Function argument which can be either 'true' or 'false', or a floating point number. Additionally accepts 'yes' and 'no' as synonyms for 'true' and 'false' respectively."

instance ToSchema FnLiteral where
declareNamedSchema p = do
pure $ NamedSchema (Just "Literal") $ toParamSchema p
-- We overwrite this, as the schema itself may be one of
-- string, int, double or bool... And I don't think we can express that
-- here?
-- Schema validation doesn't like this set to 'OpenApiString', likely for good reason.
& type_ .~ Nothing

instance ToParamSchema EvalBackends where
toParamSchema _ =
Expand Down

0 comments on commit f83198b

Please sign in to comment.