packages feed

openai-1.2.0 / src / OpenAI / V1 / ResponseFormat.hs

-- | The `ResponseFormat` typemodule OpenAI.V1.ResponseFormat    ( -- * Types      ResponseFormat(..)    , JSONSchema(..)    ) whereimport OpenAI.Prelude-- | An object specifying the format that the model must outputdata ResponseFormat    = ResponseFormat_Text    | JSON_Object    | JSON_Schema{ json_schema :: JSONSchema }    deriving stock (Generic, Show)responseFormatOptions :: OptionsresponseFormatOptions = aesonOptions    { sumEncoding =        TaggedObject{ tagFieldName = "type", contentsFieldName = "" }    , tagSingleConstructors = True    , constructorTagModifier = stripPrefix "ResponseFormat_"    }instance FromJSON ResponseFormat where    parseJSON = genericParseJSON responseFormatOptionsinstance ToJSON ResponseFormat where    toJSON = genericToJSON responseFormatOptions-- | Setting to { "type": "json_schema", "json_schema": {...} } enables-- Structured Outputs which ensures the model will match your supplied JSON-- schema. Learn more in the-- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) guidedata JSONSchema = JSONSchema    { description :: Maybe Text    , name :: Text    , schema :: Maybe Value    , strict :: Maybe Bool    } deriving stock (Generic, Show)      deriving anyclass (FromJSON, ToJSON)