module OpenAI.V1.Chat.Completions
(
CreateChatCompletion(..)
, _CreateChatCompletion
, ChatCompletionObject(..)
, Choice(..)
, Message(..)
, messageToContent
, Content(..)
, ChatCompletionChunk(..)
, ChunkChoice(..)
, Delta(..)
, ChatCompletionStreamEvent
, InputAudio(..)
, ImageURL(..)
, AudioData(..)
, Modality(..)
, Prediction(..)
, Voice(..)
, AudioFormat(..)
, AudioParameters(..)
, ResponseFormat(..)
, ServiceTier
, ReasoningEffort(..)
, SearchContextSize(..)
, UserLocation(..)
, WebSearchOptions(..)
, FinishReason(..)
, Token(..)
, LogProbs(..)
, API
) where
import OpenAI.Prelude
import OpenAI.V1.AutoOr
import OpenAI.V1.Models (Model)
import OpenAI.V1.ResponseFormat
import OpenAI.V1.Tool
import OpenAI.V1.ToolCall
import OpenAI.V1.Usage
import Prelude hiding (id)
data InputAudio = InputAudio{ InputAudio -> Text
data_ :: Text, InputAudio -> AudioFormat
format :: AudioFormat }
deriving stock ((forall x. InputAudio -> Rep InputAudio x)
-> (forall x. Rep InputAudio x -> InputAudio) -> Generic InputAudio
forall x. Rep InputAudio x -> InputAudio
forall x. InputAudio -> Rep InputAudio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InputAudio -> Rep InputAudio x
from :: forall x. InputAudio -> Rep InputAudio x
$cto :: forall x. Rep InputAudio x -> InputAudio
to :: forall x. Rep InputAudio x -> InputAudio
Generic, Int -> InputAudio -> ShowS
[InputAudio] -> ShowS
InputAudio -> String
(Int -> InputAudio -> ShowS)
-> (InputAudio -> String)
-> ([InputAudio] -> ShowS)
-> Show InputAudio
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputAudio -> ShowS
showsPrec :: Int -> InputAudio -> ShowS
$cshow :: InputAudio -> String
show :: InputAudio -> String
$cshowList :: [InputAudio] -> ShowS
showList :: [InputAudio] -> ShowS
Show)
instance FromJSON InputAudio where
parseJSON :: Value -> Parser InputAudio
parseJSON = Options -> Value -> Parser InputAudio
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON InputAudio where
toJSON :: InputAudio -> Value
toJSON = Options -> InputAudio -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data ImageURL = ImageURL{ ImageURL -> Text
url :: Text, ImageURL -> Maybe (AutoOr Text)
detail :: Maybe (AutoOr Text) }
deriving stock ((forall x. ImageURL -> Rep ImageURL x)
-> (forall x. Rep ImageURL x -> ImageURL) -> Generic ImageURL
forall x. Rep ImageURL x -> ImageURL
forall x. ImageURL -> Rep ImageURL x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ImageURL -> Rep ImageURL x
from :: forall x. ImageURL -> Rep ImageURL x
$cto :: forall x. Rep ImageURL x -> ImageURL
to :: forall x. Rep ImageURL x -> ImageURL
Generic, Int -> ImageURL -> ShowS
[ImageURL] -> ShowS
ImageURL -> String
(Int -> ImageURL -> ShowS)
-> (ImageURL -> String) -> ([ImageURL] -> ShowS) -> Show ImageURL
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ImageURL -> ShowS
showsPrec :: Int -> ImageURL -> ShowS
$cshow :: ImageURL -> String
show :: ImageURL -> String
$cshowList :: [ImageURL] -> ShowS
showList :: [ImageURL] -> ShowS
Show)
deriving anyclass (Maybe ImageURL
Value -> Parser [ImageURL]
Value -> Parser ImageURL
(Value -> Parser ImageURL)
-> (Value -> Parser [ImageURL])
-> Maybe ImageURL
-> FromJSON ImageURL
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ImageURL
parseJSON :: Value -> Parser ImageURL
$cparseJSONList :: Value -> Parser [ImageURL]
parseJSONList :: Value -> Parser [ImageURL]
$comittedField :: Maybe ImageURL
omittedField :: Maybe ImageURL
FromJSON, [ImageURL] -> Value
[ImageURL] -> Encoding
ImageURL -> Bool
ImageURL -> Value
ImageURL -> Encoding
(ImageURL -> Value)
-> (ImageURL -> Encoding)
-> ([ImageURL] -> Value)
-> ([ImageURL] -> Encoding)
-> (ImageURL -> Bool)
-> ToJSON ImageURL
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ImageURL -> Value
toJSON :: ImageURL -> Value
$ctoEncoding :: ImageURL -> Encoding
toEncoding :: ImageURL -> Encoding
$ctoJSONList :: [ImageURL] -> Value
toJSONList :: [ImageURL] -> Value
$ctoEncodingList :: [ImageURL] -> Encoding
toEncodingList :: [ImageURL] -> Encoding
$comitField :: ImageURL -> Bool
omitField :: ImageURL -> Bool
ToJSON)
data Content
= Text{ Content -> Text
text :: Text }
| Image_URL{ Content -> ImageURL
image_url :: ImageURL }
| Input_Audio{ Content -> InputAudio
input_audio :: InputAudio }
deriving ((forall x. Content -> Rep Content x)
-> (forall x. Rep Content x -> Content) -> Generic Content
forall x. Rep Content x -> Content
forall x. Content -> Rep Content x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Content -> Rep Content x
from :: forall x. Content -> Rep Content x
$cto :: forall x. Rep Content x -> Content
to :: forall x. Rep Content x -> Content
Generic, Int -> Content -> ShowS
[Content] -> ShowS
Content -> String
(Int -> Content -> ShowS)
-> (Content -> String) -> ([Content] -> ShowS) -> Show Content
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Content -> ShowS
showsPrec :: Int -> Content -> ShowS
$cshow :: Content -> String
show :: Content -> String
$cshowList :: [Content] -> ShowS
showList :: [Content] -> ShowS
Show)
instance IsString Content where
fromString :: String -> Content
fromString String
string = Text{ text :: Text
text = String -> Text
forall a. IsString a => String -> a
fromString String
string }
contentOptions :: Options
contentOptions :: Options
contentOptions =
Options
aesonOptions
{ sumEncoding =
TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
}
instance FromJSON Content where
parseJSON :: Value -> Parser Content
parseJSON = Options -> Value -> Parser Content
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
contentOptions
instance ToJSON Content where
toJSON :: Content -> Value
toJSON = Options -> Content -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
contentOptions
data AudioData = AudioData{ AudioData -> Text
id :: Text }
deriving stock ((forall x. AudioData -> Rep AudioData x)
-> (forall x. Rep AudioData x -> AudioData) -> Generic AudioData
forall x. Rep AudioData x -> AudioData
forall x. AudioData -> Rep AudioData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AudioData -> Rep AudioData x
from :: forall x. AudioData -> Rep AudioData x
$cto :: forall x. Rep AudioData x -> AudioData
to :: forall x. Rep AudioData x -> AudioData
Generic, Int -> AudioData -> ShowS
[AudioData] -> ShowS
AudioData -> String
(Int -> AudioData -> ShowS)
-> (AudioData -> String)
-> ([AudioData] -> ShowS)
-> Show AudioData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AudioData -> ShowS
showsPrec :: Int -> AudioData -> ShowS
$cshow :: AudioData -> String
show :: AudioData -> String
$cshowList :: [AudioData] -> ShowS
showList :: [AudioData] -> ShowS
Show)
deriving anyclass (Maybe AudioData
Value -> Parser [AudioData]
Value -> Parser AudioData
(Value -> Parser AudioData)
-> (Value -> Parser [AudioData])
-> Maybe AudioData
-> FromJSON AudioData
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AudioData
parseJSON :: Value -> Parser AudioData
$cparseJSONList :: Value -> Parser [AudioData]
parseJSONList :: Value -> Parser [AudioData]
$comittedField :: Maybe AudioData
omittedField :: Maybe AudioData
FromJSON, [AudioData] -> Value
[AudioData] -> Encoding
AudioData -> Bool
AudioData -> Value
AudioData -> Encoding
(AudioData -> Value)
-> (AudioData -> Encoding)
-> ([AudioData] -> Value)
-> ([AudioData] -> Encoding)
-> (AudioData -> Bool)
-> ToJSON AudioData
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AudioData -> Value
toJSON :: AudioData -> Value
$ctoEncoding :: AudioData -> Encoding
toEncoding :: AudioData -> Encoding
$ctoJSONList :: [AudioData] -> Value
toJSONList :: [AudioData] -> Value
$ctoEncodingList :: [AudioData] -> Encoding
toEncodingList :: [AudioData] -> Encoding
$comitField :: AudioData -> Bool
omitField :: AudioData -> Bool
ToJSON)
data Message content
= System
{ forall content. Message content -> content
content :: content
, forall content. Message content -> Maybe Text
name :: Maybe Text
}
| User
{ content :: content
, name :: Maybe Text
}
| Assistant
{ forall content. Message content -> Maybe content
assistant_content :: Maybe content
, forall content. Message content -> Maybe Text
refusal :: Maybe Text
, name :: Maybe Text
, forall content. Message content -> Maybe AudioData
assistant_audio :: Maybe AudioData
, forall content. Message content -> Maybe (Vector ToolCall)
tool_calls :: Maybe (Vector ToolCall)
}
| Tool
{ content :: content
, forall content. Message content -> Text
tool_call_id :: Text
}
deriving stock ((forall x. Message content -> Rep (Message content) x)
-> (forall x. Rep (Message content) x -> Message content)
-> Generic (Message content)
forall x. Rep (Message content) x -> Message content
forall x. Message content -> Rep (Message content) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall content x. Rep (Message content) x -> Message content
forall content x. Message content -> Rep (Message content) x
$cfrom :: forall content x. Message content -> Rep (Message content) x
from :: forall x. Message content -> Rep (Message content) x
$cto :: forall content x. Rep (Message content) x -> Message content
to :: forall x. Rep (Message content) x -> Message content
Generic, Int -> Message content -> ShowS
[Message content] -> ShowS
Message content -> String
(Int -> Message content -> ShowS)
-> (Message content -> String)
-> ([Message content] -> ShowS)
-> Show (Message content)
forall content. Show content => Int -> Message content -> ShowS
forall content. Show content => [Message content] -> ShowS
forall content. Show content => Message content -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall content. Show content => Int -> Message content -> ShowS
showsPrec :: Int -> Message content -> ShowS
$cshow :: forall content. Show content => Message content -> String
show :: Message content -> String
$cshowList :: forall content. Show content => [Message content] -> ShowS
showList :: [Message content] -> ShowS
Show)
messageOptions :: Options
messageOptions :: Options
messageOptions = Options
aesonOptions
{ sumEncoding =
TaggedObject{ tagFieldName = "role", contentsFieldName = "" }
, tagSingleConstructors = True
, fieldLabelModifier = stripPrefix "assistant_"
}
instance FromJSON content => FromJSON (Message content) where
parseJSON :: Value -> Parser (Message content)
parseJSON = Options -> Value -> Parser (Message content)
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
messageOptions
instance ToJSON content => ToJSON (Message content) where
toJSON :: Message content -> Value
toJSON = Options -> Message content -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
messageOptions
messageToContent :: Monoid content => Message content -> content
messageToContent :: forall content. Monoid content => Message content -> content
messageToContent System{ content
content :: forall content. Message content -> content
content :: content
content } = content
content
messageToContent User{ content
content :: forall content. Message content -> content
content :: content
content } = content
content
messageToContent Assistant{ assistant_content :: forall content. Message content -> Maybe content
assistant_content = Just content
content } = content
content
messageToContent Assistant{ assistant_content :: forall content. Message content -> Maybe content
assistant_content = Maybe content
Nothing } = content
forall a. Monoid a => a
mempty
messageToContent Tool{ content
content :: forall content. Message content -> content
content :: content
content } = content
content
data Modality = Modality_Text | Modality_Audio
deriving stock ((forall x. Modality -> Rep Modality x)
-> (forall x. Rep Modality x -> Modality) -> Generic Modality
forall x. Rep Modality x -> Modality
forall x. Modality -> Rep Modality x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Modality -> Rep Modality x
from :: forall x. Modality -> Rep Modality x
$cto :: forall x. Rep Modality x -> Modality
to :: forall x. Rep Modality x -> Modality
Generic, Int -> Modality -> ShowS
[Modality] -> ShowS
Modality -> String
(Int -> Modality -> ShowS)
-> (Modality -> String) -> ([Modality] -> ShowS) -> Show Modality
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Modality -> ShowS
showsPrec :: Int -> Modality -> ShowS
$cshow :: Modality -> String
show :: Modality -> String
$cshowList :: [Modality] -> ShowS
showList :: [Modality] -> ShowS
Show)
modalityOptions :: Options
modalityOptions :: Options
modalityOptions =
Options
aesonOptions
{ constructorTagModifier = stripPrefix "Modality_" }
instance FromJSON Modality where
parseJSON :: Value -> Parser Modality
parseJSON = Options -> Value -> Parser Modality
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
modalityOptions
instance ToJSON Modality where
toJSON :: Modality -> Value
toJSON = Options -> Modality -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
modalityOptions
data Prediction = Content{ Prediction -> Text
content :: Text }
deriving stock ((forall x. Prediction -> Rep Prediction x)
-> (forall x. Rep Prediction x -> Prediction) -> Generic Prediction
forall x. Rep Prediction x -> Prediction
forall x. Prediction -> Rep Prediction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Prediction -> Rep Prediction x
from :: forall x. Prediction -> Rep Prediction x
$cto :: forall x. Rep Prediction x -> Prediction
to :: forall x. Rep Prediction x -> Prediction
Generic, Int -> Prediction -> ShowS
[Prediction] -> ShowS
Prediction -> String
(Int -> Prediction -> ShowS)
-> (Prediction -> String)
-> ([Prediction] -> ShowS)
-> Show Prediction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Prediction -> ShowS
showsPrec :: Int -> Prediction -> ShowS
$cshow :: Prediction -> String
show :: Prediction -> String
$cshowList :: [Prediction] -> ShowS
showList :: [Prediction] -> ShowS
Show)
predictionOptions :: Options
predictionOptions :: Options
predictionOptions =
Options
aesonOptions
{ sumEncoding =
TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
}
instance FromJSON Prediction where
parseJSON :: Value -> Parser Prediction
parseJSON = Options -> Value -> Parser Prediction
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
predictionOptions
instance ToJSON Prediction where
toJSON :: Prediction -> Value
toJSON = Options -> Prediction -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
predictionOptions
data Voice = Ash | Ballad | Coral | Sage | Verse
deriving stock ((forall x. Voice -> Rep Voice x)
-> (forall x. Rep Voice x -> Voice) -> Generic Voice
forall x. Rep Voice x -> Voice
forall x. Voice -> Rep Voice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Voice -> Rep Voice x
from :: forall x. Voice -> Rep Voice x
$cto :: forall x. Rep Voice x -> Voice
to :: forall x. Rep Voice x -> Voice
Generic, Int -> Voice -> ShowS
[Voice] -> ShowS
Voice -> String
(Int -> Voice -> ShowS)
-> (Voice -> String) -> ([Voice] -> ShowS) -> Show Voice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Voice -> ShowS
showsPrec :: Int -> Voice -> ShowS
$cshow :: Voice -> String
show :: Voice -> String
$cshowList :: [Voice] -> ShowS
showList :: [Voice] -> ShowS
Show)
instance FromJSON Voice where
parseJSON :: Value -> Parser Voice
parseJSON = Options -> Value -> Parser Voice
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON Voice where
toJSON :: Voice -> Value
toJSON = Options -> Voice -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data AudioFormat = WAV | MP3 | FLAC | Opus | PCM16
deriving stock ((forall x. AudioFormat -> Rep AudioFormat x)
-> (forall x. Rep AudioFormat x -> AudioFormat)
-> Generic AudioFormat
forall x. Rep AudioFormat x -> AudioFormat
forall x. AudioFormat -> Rep AudioFormat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AudioFormat -> Rep AudioFormat x
from :: forall x. AudioFormat -> Rep AudioFormat x
$cto :: forall x. Rep AudioFormat x -> AudioFormat
to :: forall x. Rep AudioFormat x -> AudioFormat
Generic, Int -> AudioFormat -> ShowS
[AudioFormat] -> ShowS
AudioFormat -> String
(Int -> AudioFormat -> ShowS)
-> (AudioFormat -> String)
-> ([AudioFormat] -> ShowS)
-> Show AudioFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AudioFormat -> ShowS
showsPrec :: Int -> AudioFormat -> ShowS
$cshow :: AudioFormat -> String
show :: AudioFormat -> String
$cshowList :: [AudioFormat] -> ShowS
showList :: [AudioFormat] -> ShowS
Show)
instance FromJSON AudioFormat where
parseJSON :: Value -> Parser AudioFormat
parseJSON = Options -> Value -> Parser AudioFormat
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON AudioFormat where
toJSON :: AudioFormat -> Value
toJSON = Options -> AudioFormat -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data AudioParameters = AudioParameters
{ AudioParameters -> Voice
voice :: Voice
, AudioParameters -> AudioFormat
format :: AudioFormat
} deriving stock ((forall x. AudioParameters -> Rep AudioParameters x)
-> (forall x. Rep AudioParameters x -> AudioParameters)
-> Generic AudioParameters
forall x. Rep AudioParameters x -> AudioParameters
forall x. AudioParameters -> Rep AudioParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AudioParameters -> Rep AudioParameters x
from :: forall x. AudioParameters -> Rep AudioParameters x
$cto :: forall x. Rep AudioParameters x -> AudioParameters
to :: forall x. Rep AudioParameters x -> AudioParameters
Generic, Int -> AudioParameters -> ShowS
[AudioParameters] -> ShowS
AudioParameters -> String
(Int -> AudioParameters -> ShowS)
-> (AudioParameters -> String)
-> ([AudioParameters] -> ShowS)
-> Show AudioParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AudioParameters -> ShowS
showsPrec :: Int -> AudioParameters -> ShowS
$cshow :: AudioParameters -> String
show :: AudioParameters -> String
$cshowList :: [AudioParameters] -> ShowS
showList :: [AudioParameters] -> ShowS
Show)
deriving anyclass (Maybe AudioParameters
Value -> Parser [AudioParameters]
Value -> Parser AudioParameters
(Value -> Parser AudioParameters)
-> (Value -> Parser [AudioParameters])
-> Maybe AudioParameters
-> FromJSON AudioParameters
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AudioParameters
parseJSON :: Value -> Parser AudioParameters
$cparseJSONList :: Value -> Parser [AudioParameters]
parseJSONList :: Value -> Parser [AudioParameters]
$comittedField :: Maybe AudioParameters
omittedField :: Maybe AudioParameters
FromJSON, [AudioParameters] -> Value
[AudioParameters] -> Encoding
AudioParameters -> Bool
AudioParameters -> Value
AudioParameters -> Encoding
(AudioParameters -> Value)
-> (AudioParameters -> Encoding)
-> ([AudioParameters] -> Value)
-> ([AudioParameters] -> Encoding)
-> (AudioParameters -> Bool)
-> ToJSON AudioParameters
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AudioParameters -> Value
toJSON :: AudioParameters -> Value
$ctoEncoding :: AudioParameters -> Encoding
toEncoding :: AudioParameters -> Encoding
$ctoJSONList :: [AudioParameters] -> Value
toJSONList :: [AudioParameters] -> Value
$ctoEncodingList :: [AudioParameters] -> Encoding
toEncodingList :: [AudioParameters] -> Encoding
$comitField :: AudioParameters -> Bool
omitField :: AudioParameters -> Bool
ToJSON)
type ServiceTier = Text
data ReasoningEffort
= ReasoningEffort_Minimal
| ReasoningEffort_Low
| ReasoningEffort_Medium
| ReasoningEffort_High
deriving stock ((forall x. ReasoningEffort -> Rep ReasoningEffort x)
-> (forall x. Rep ReasoningEffort x -> ReasoningEffort)
-> Generic ReasoningEffort
forall x. Rep ReasoningEffort x -> ReasoningEffort
forall x. ReasoningEffort -> Rep ReasoningEffort x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReasoningEffort -> Rep ReasoningEffort x
from :: forall x. ReasoningEffort -> Rep ReasoningEffort x
$cto :: forall x. Rep ReasoningEffort x -> ReasoningEffort
to :: forall x. Rep ReasoningEffort x -> ReasoningEffort
Generic, Int -> ReasoningEffort -> ShowS
[ReasoningEffort] -> ShowS
ReasoningEffort -> String
(Int -> ReasoningEffort -> ShowS)
-> (ReasoningEffort -> String)
-> ([ReasoningEffort] -> ShowS)
-> Show ReasoningEffort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReasoningEffort -> ShowS
showsPrec :: Int -> ReasoningEffort -> ShowS
$cshow :: ReasoningEffort -> String
show :: ReasoningEffort -> String
$cshowList :: [ReasoningEffort] -> ShowS
showList :: [ReasoningEffort] -> ShowS
Show)
reasoningEffortOptions :: Options
reasoningEffortOptions :: Options
reasoningEffortOptions =
Options
aesonOptions
{ constructorTagModifier = stripPrefix "ReasoningEffort_" }
instance FromJSON ReasoningEffort where
parseJSON :: Value -> Parser ReasoningEffort
parseJSON = Options -> Value -> Parser ReasoningEffort
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
reasoningEffortOptions
instance ToJSON ReasoningEffort where
toJSON :: ReasoningEffort -> Value
toJSON = Options -> ReasoningEffort -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
reasoningEffortOptions
data SearchContextSize
= SearchContextSize_Low
| SearchContextSize_Medium
| SearchContextSize_High
deriving stock ((forall x. SearchContextSize -> Rep SearchContextSize x)
-> (forall x. Rep SearchContextSize x -> SearchContextSize)
-> Generic SearchContextSize
forall x. Rep SearchContextSize x -> SearchContextSize
forall x. SearchContextSize -> Rep SearchContextSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SearchContextSize -> Rep SearchContextSize x
from :: forall x. SearchContextSize -> Rep SearchContextSize x
$cto :: forall x. Rep SearchContextSize x -> SearchContextSize
to :: forall x. Rep SearchContextSize x -> SearchContextSize
Generic, Int -> SearchContextSize -> ShowS
[SearchContextSize] -> ShowS
SearchContextSize -> String
(Int -> SearchContextSize -> ShowS)
-> (SearchContextSize -> String)
-> ([SearchContextSize] -> ShowS)
-> Show SearchContextSize
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchContextSize -> ShowS
showsPrec :: Int -> SearchContextSize -> ShowS
$cshow :: SearchContextSize -> String
show :: SearchContextSize -> String
$cshowList :: [SearchContextSize] -> ShowS
showList :: [SearchContextSize] -> ShowS
Show)
instance FromJSON SearchContextSize where
parseJSON :: Value -> Parser SearchContextSize
parseJSON = Options -> Value -> Parser SearchContextSize
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
searchContextSizeOptions
instance ToJSON SearchContextSize where
toJSON :: SearchContextSize -> Value
toJSON = Options -> SearchContextSize -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
searchContextSizeOptions
data UserLocation = Approximate
{ UserLocation -> Maybe Text
city :: Maybe Text
, UserLocation -> Maybe Text
country :: Maybe Text
, UserLocation -> Maybe Text
region :: Maybe Text
, UserLocation -> Maybe Text
timezone :: Maybe Text
} deriving stock ((forall x. UserLocation -> Rep UserLocation x)
-> (forall x. Rep UserLocation x -> UserLocation)
-> Generic UserLocation
forall x. Rep UserLocation x -> UserLocation
forall x. UserLocation -> Rep UserLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UserLocation -> Rep UserLocation x
from :: forall x. UserLocation -> Rep UserLocation x
$cto :: forall x. Rep UserLocation x -> UserLocation
to :: forall x. Rep UserLocation x -> UserLocation
Generic, Int -> UserLocation -> ShowS
[UserLocation] -> ShowS
UserLocation -> String
(Int -> UserLocation -> ShowS)
-> (UserLocation -> String)
-> ([UserLocation] -> ShowS)
-> Show UserLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UserLocation -> ShowS
showsPrec :: Int -> UserLocation -> ShowS
$cshow :: UserLocation -> String
show :: UserLocation -> String
$cshowList :: [UserLocation] -> ShowS
showList :: [UserLocation] -> ShowS
Show)
instance FromJSON UserLocation where
parseJSON :: Value -> Parser UserLocation
parseJSON = Options -> Value -> Parser UserLocation
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
userLocationOptions
instance ToJSON UserLocation where
toJSON :: UserLocation -> Value
toJSON = Options -> UserLocation -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
userLocationOptions
userLocationOptions :: Options
userLocationOptions :: Options
userLocationOptions =
Options
aesonOptions
{ sumEncoding =
TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
}
searchContextSizeOptions :: Options
searchContextSizeOptions :: Options
searchContextSizeOptions =
Options
aesonOptions
{ constructorTagModifier = stripPrefix "SearchContextSize_" }
data WebSearchOptions = WebSearchOptions
{ WebSearchOptions -> Maybe SearchContextSize
search_context_size :: Maybe SearchContextSize
, WebSearchOptions -> Maybe UserLocation
user_location :: Maybe UserLocation
} deriving stock ((forall x. WebSearchOptions -> Rep WebSearchOptions x)
-> (forall x. Rep WebSearchOptions x -> WebSearchOptions)
-> Generic WebSearchOptions
forall x. Rep WebSearchOptions x -> WebSearchOptions
forall x. WebSearchOptions -> Rep WebSearchOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WebSearchOptions -> Rep WebSearchOptions x
from :: forall x. WebSearchOptions -> Rep WebSearchOptions x
$cto :: forall x. Rep WebSearchOptions x -> WebSearchOptions
to :: forall x. Rep WebSearchOptions x -> WebSearchOptions
Generic, Int -> WebSearchOptions -> ShowS
[WebSearchOptions] -> ShowS
WebSearchOptions -> String
(Int -> WebSearchOptions -> ShowS)
-> (WebSearchOptions -> String)
-> ([WebSearchOptions] -> ShowS)
-> Show WebSearchOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WebSearchOptions -> ShowS
showsPrec :: Int -> WebSearchOptions -> ShowS
$cshow :: WebSearchOptions -> String
show :: WebSearchOptions -> String
$cshowList :: [WebSearchOptions] -> ShowS
showList :: [WebSearchOptions] -> ShowS
Show)
deriving anyclass (Maybe WebSearchOptions
Value -> Parser [WebSearchOptions]
Value -> Parser WebSearchOptions
(Value -> Parser WebSearchOptions)
-> (Value -> Parser [WebSearchOptions])
-> Maybe WebSearchOptions
-> FromJSON WebSearchOptions
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser WebSearchOptions
parseJSON :: Value -> Parser WebSearchOptions
$cparseJSONList :: Value -> Parser [WebSearchOptions]
parseJSONList :: Value -> Parser [WebSearchOptions]
$comittedField :: Maybe WebSearchOptions
omittedField :: Maybe WebSearchOptions
FromJSON, [WebSearchOptions] -> Value
[WebSearchOptions] -> Encoding
WebSearchOptions -> Bool
WebSearchOptions -> Value
WebSearchOptions -> Encoding
(WebSearchOptions -> Value)
-> (WebSearchOptions -> Encoding)
-> ([WebSearchOptions] -> Value)
-> ([WebSearchOptions] -> Encoding)
-> (WebSearchOptions -> Bool)
-> ToJSON WebSearchOptions
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: WebSearchOptions -> Value
toJSON :: WebSearchOptions -> Value
$ctoEncoding :: WebSearchOptions -> Encoding
toEncoding :: WebSearchOptions -> Encoding
$ctoJSONList :: [WebSearchOptions] -> Value
toJSONList :: [WebSearchOptions] -> Value
$ctoEncodingList :: [WebSearchOptions] -> Encoding
toEncodingList :: [WebSearchOptions] -> Encoding
$comitField :: WebSearchOptions -> Bool
omitField :: WebSearchOptions -> Bool
ToJSON)
data CreateChatCompletion = CreateChatCompletion
{ CreateChatCompletion -> Vector (Message (Vector Content))
messages :: Vector (Message (Vector Content))
, CreateChatCompletion -> Model
model :: Model
, CreateChatCompletion -> Maybe Bool
store :: Maybe Bool
, CreateChatCompletion -> Maybe (Map Text Text)
metadata :: Maybe (Map Text Text)
, CreateChatCompletion -> Maybe Double
frequency_penalty :: Maybe Double
, CreateChatCompletion -> Maybe (Map Word Int)
logit_bias :: Maybe (Map Word Int)
, CreateChatCompletion -> Maybe Bool
logprobs :: Maybe Bool
, CreateChatCompletion -> Maybe Word
top_logprobs :: Maybe Word
, CreateChatCompletion -> Maybe Natural
max_completion_tokens :: Maybe Natural
, CreateChatCompletion -> Maybe Natural
n :: Maybe Natural
, CreateChatCompletion -> Maybe (Vector Modality)
modalities :: Maybe (Vector Modality)
, CreateChatCompletion -> Maybe Prediction
prediction :: Maybe Prediction
, CreateChatCompletion -> Maybe AudioParameters
audio :: Maybe AudioParameters
, CreateChatCompletion -> Maybe Double
presence_penalty :: Maybe Double
, CreateChatCompletion -> Maybe ReasoningEffort
reasoning_effort :: Maybe ReasoningEffort
, CreateChatCompletion -> Maybe ResponseFormat
response_format :: Maybe ResponseFormat
, CreateChatCompletion -> Maybe Integer
seed :: Maybe Integer
, CreateChatCompletion -> Maybe (AutoOr Text)
service_tier :: Maybe (AutoOr ServiceTier)
, CreateChatCompletion -> Maybe (Vector Text)
stop :: Maybe (Vector Text)
, CreateChatCompletion -> Maybe Bool
stream :: Maybe Bool
, CreateChatCompletion -> Maybe Double
temperature :: Maybe Double
, CreateChatCompletion -> Maybe Double
top_p :: Maybe Double
, CreateChatCompletion -> Maybe (Vector Tool)
tools :: Maybe (Vector Tool)
, CreateChatCompletion -> Maybe ToolChoice
tool_choice :: Maybe ToolChoice
, CreateChatCompletion -> Maybe Bool
parallel_tool_calls :: Maybe Bool
, CreateChatCompletion -> Maybe Text
user :: Maybe Text
, CreateChatCompletion -> Maybe WebSearchOptions
web_search_options :: Maybe WebSearchOptions
} deriving stock ((forall x. CreateChatCompletion -> Rep CreateChatCompletion x)
-> (forall x. Rep CreateChatCompletion x -> CreateChatCompletion)
-> Generic CreateChatCompletion
forall x. Rep CreateChatCompletion x -> CreateChatCompletion
forall x. CreateChatCompletion -> Rep CreateChatCompletion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CreateChatCompletion -> Rep CreateChatCompletion x
from :: forall x. CreateChatCompletion -> Rep CreateChatCompletion x
$cto :: forall x. Rep CreateChatCompletion x -> CreateChatCompletion
to :: forall x. Rep CreateChatCompletion x -> CreateChatCompletion
Generic, Int -> CreateChatCompletion -> ShowS
[CreateChatCompletion] -> ShowS
CreateChatCompletion -> String
(Int -> CreateChatCompletion -> ShowS)
-> (CreateChatCompletion -> String)
-> ([CreateChatCompletion] -> ShowS)
-> Show CreateChatCompletion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateChatCompletion -> ShowS
showsPrec :: Int -> CreateChatCompletion -> ShowS
$cshow :: CreateChatCompletion -> String
show :: CreateChatCompletion -> String
$cshowList :: [CreateChatCompletion] -> ShowS
showList :: [CreateChatCompletion] -> ShowS
Show)
instance FromJSON CreateChatCompletion where
parseJSON :: Value -> Parser CreateChatCompletion
parseJSON = Options -> Value -> Parser CreateChatCompletion
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON CreateChatCompletion where
toJSON :: CreateChatCompletion -> Value
toJSON = Options -> CreateChatCompletion -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
_CreateChatCompletion :: CreateChatCompletion
_CreateChatCompletion :: CreateChatCompletion
_CreateChatCompletion = CreateChatCompletion
{ store :: Maybe Bool
store = Maybe Bool
forall a. Maybe a
Nothing
, metadata :: Maybe (Map Text Text)
metadata = Maybe (Map Text Text)
forall a. Maybe a
Nothing
, frequency_penalty :: Maybe Double
frequency_penalty = Maybe Double
forall a. Maybe a
Nothing
, logit_bias :: Maybe (Map Word Int)
logit_bias = Maybe (Map Word Int)
forall a. Maybe a
Nothing
, logprobs :: Maybe Bool
logprobs = Maybe Bool
forall a. Maybe a
Nothing
, top_logprobs :: Maybe Word
top_logprobs = Maybe Word
forall a. Maybe a
Nothing
, max_completion_tokens :: Maybe Natural
max_completion_tokens = Maybe Natural
forall a. Maybe a
Nothing
, n :: Maybe Natural
n = Maybe Natural
forall a. Maybe a
Nothing
, modalities :: Maybe (Vector Modality)
modalities = Maybe (Vector Modality)
forall a. Maybe a
Nothing
, prediction :: Maybe Prediction
prediction = Maybe Prediction
forall a. Maybe a
Nothing
, audio :: Maybe AudioParameters
audio = Maybe AudioParameters
forall a. Maybe a
Nothing
, presence_penalty :: Maybe Double
presence_penalty = Maybe Double
forall a. Maybe a
Nothing
, reasoning_effort :: Maybe ReasoningEffort
reasoning_effort = Maybe ReasoningEffort
forall a. Maybe a
Nothing
, response_format :: Maybe ResponseFormat
response_format = Maybe ResponseFormat
forall a. Maybe a
Nothing
, seed :: Maybe Integer
seed = Maybe Integer
forall a. Maybe a
Nothing
, service_tier :: Maybe (AutoOr Text)
service_tier = Maybe (AutoOr Text)
forall a. Maybe a
Nothing
, stop :: Maybe (Vector Text)
stop = Maybe (Vector Text)
forall a. Maybe a
Nothing
, stream :: Maybe Bool
stream = Maybe Bool
forall a. Maybe a
Nothing
, temperature :: Maybe Double
temperature = Maybe Double
forall a. Maybe a
Nothing
, top_p :: Maybe Double
top_p = Maybe Double
forall a. Maybe a
Nothing
, tools :: Maybe (Vector Tool)
tools = Maybe (Vector Tool)
forall a. Maybe a
Nothing
, tool_choice :: Maybe ToolChoice
tool_choice = Maybe ToolChoice
forall a. Maybe a
Nothing
, parallel_tool_calls :: Maybe Bool
parallel_tool_calls = Maybe Bool
forall a. Maybe a
Nothing
, user :: Maybe Text
user = Maybe Text
forall a. Maybe a
Nothing
, web_search_options :: Maybe WebSearchOptions
web_search_options = Maybe WebSearchOptions
forall a. Maybe a
Nothing
}
data FinishReason
= Stop
| Length
| Content_Filter
| Tool_Calls
deriving stock ((forall x. FinishReason -> Rep FinishReason x)
-> (forall x. Rep FinishReason x -> FinishReason)
-> Generic FinishReason
forall x. Rep FinishReason x -> FinishReason
forall x. FinishReason -> Rep FinishReason x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FinishReason -> Rep FinishReason x
from :: forall x. FinishReason -> Rep FinishReason x
$cto :: forall x. Rep FinishReason x -> FinishReason
to :: forall x. Rep FinishReason x -> FinishReason
Generic, Int -> FinishReason -> ShowS
[FinishReason] -> ShowS
FinishReason -> String
(Int -> FinishReason -> ShowS)
-> (FinishReason -> String)
-> ([FinishReason] -> ShowS)
-> Show FinishReason
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FinishReason -> ShowS
showsPrec :: Int -> FinishReason -> ShowS
$cshow :: FinishReason -> String
show :: FinishReason -> String
$cshowList :: [FinishReason] -> ShowS
showList :: [FinishReason] -> ShowS
Show)
instance FromJSON FinishReason where
parseJSON :: Value -> Parser FinishReason
parseJSON = Options -> Value -> Parser FinishReason
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON FinishReason where
toJSON :: FinishReason -> Value
toJSON = Options -> FinishReason -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data Token = Token
{ Token -> Text
token :: Text
, Token -> Double
logprob :: Double
, Token -> Maybe (Vector Word8)
bytes :: Maybe (Vector Word8)
, Token -> Maybe (Vector Token)
top_logprobs :: Maybe (Vector Token)
} deriving stock ((forall x. Token -> Rep Token x)
-> (forall x. Rep Token x -> Token) -> Generic Token
forall x. Rep Token x -> Token
forall x. Token -> Rep Token x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Token -> Rep Token x
from :: forall x. Token -> Rep Token x
$cto :: forall x. Rep Token x -> Token
to :: forall x. Rep Token x -> Token
Generic, Int -> Token -> ShowS
[Token] -> ShowS
Token -> String
(Int -> Token -> ShowS)
-> (Token -> String) -> ([Token] -> ShowS) -> Show Token
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Token -> ShowS
showsPrec :: Int -> Token -> ShowS
$cshow :: Token -> String
show :: Token -> String
$cshowList :: [Token] -> ShowS
showList :: [Token] -> ShowS
Show)
deriving anyclass (Maybe Token
Value -> Parser [Token]
Value -> Parser Token
(Value -> Parser Token)
-> (Value -> Parser [Token]) -> Maybe Token -> FromJSON Token
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Token
parseJSON :: Value -> Parser Token
$cparseJSONList :: Value -> Parser [Token]
parseJSONList :: Value -> Parser [Token]
$comittedField :: Maybe Token
omittedField :: Maybe Token
FromJSON, [Token] -> Value
[Token] -> Encoding
Token -> Bool
Token -> Value
Token -> Encoding
(Token -> Value)
-> (Token -> Encoding)
-> ([Token] -> Value)
-> ([Token] -> Encoding)
-> (Token -> Bool)
-> ToJSON Token
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: Token -> Value
toJSON :: Token -> Value
$ctoEncoding :: Token -> Encoding
toEncoding :: Token -> Encoding
$ctoJSONList :: [Token] -> Value
toJSONList :: [Token] -> Value
$ctoEncodingList :: [Token] -> Encoding
toEncodingList :: [Token] -> Encoding
$comitField :: Token -> Bool
omitField :: Token -> Bool
ToJSON)
data LogProbs = LogProbs
{ LogProbs -> Maybe (Vector Token)
content :: Maybe (Vector Token)
, LogProbs -> Maybe (Vector Token)
refusal :: Maybe (Vector Token)
} deriving stock ((forall x. LogProbs -> Rep LogProbs x)
-> (forall x. Rep LogProbs x -> LogProbs) -> Generic LogProbs
forall x. Rep LogProbs x -> LogProbs
forall x. LogProbs -> Rep LogProbs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LogProbs -> Rep LogProbs x
from :: forall x. LogProbs -> Rep LogProbs x
$cto :: forall x. Rep LogProbs x -> LogProbs
to :: forall x. Rep LogProbs x -> LogProbs
Generic, Int -> LogProbs -> ShowS
[LogProbs] -> ShowS
LogProbs -> String
(Int -> LogProbs -> ShowS)
-> (LogProbs -> String) -> ([LogProbs] -> ShowS) -> Show LogProbs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LogProbs -> ShowS
showsPrec :: Int -> LogProbs -> ShowS
$cshow :: LogProbs -> String
show :: LogProbs -> String
$cshowList :: [LogProbs] -> ShowS
showList :: [LogProbs] -> ShowS
Show)
deriving anyclass (Maybe LogProbs
Value -> Parser [LogProbs]
Value -> Parser LogProbs
(Value -> Parser LogProbs)
-> (Value -> Parser [LogProbs])
-> Maybe LogProbs
-> FromJSON LogProbs
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser LogProbs
parseJSON :: Value -> Parser LogProbs
$cparseJSONList :: Value -> Parser [LogProbs]
parseJSONList :: Value -> Parser [LogProbs]
$comittedField :: Maybe LogProbs
omittedField :: Maybe LogProbs
FromJSON, [LogProbs] -> Value
[LogProbs] -> Encoding
LogProbs -> Bool
LogProbs -> Value
LogProbs -> Encoding
(LogProbs -> Value)
-> (LogProbs -> Encoding)
-> ([LogProbs] -> Value)
-> ([LogProbs] -> Encoding)
-> (LogProbs -> Bool)
-> ToJSON LogProbs
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: LogProbs -> Value
toJSON :: LogProbs -> Value
$ctoEncoding :: LogProbs -> Encoding
toEncoding :: LogProbs -> Encoding
$ctoJSONList :: [LogProbs] -> Value
toJSONList :: [LogProbs] -> Value
$ctoEncodingList :: [LogProbs] -> Encoding
toEncodingList :: [LogProbs] -> Encoding
$comitField :: LogProbs -> Bool
omitField :: LogProbs -> Bool
ToJSON)
data Choice = Choice
{ Choice -> Text
finish_reason :: Text
, Choice -> Natural
index :: Natural
, Choice -> Message Text
message :: Message Text
, Choice -> Maybe LogProbs
logprobs :: Maybe LogProbs
} deriving stock ((forall x. Choice -> Rep Choice x)
-> (forall x. Rep Choice x -> Choice) -> Generic Choice
forall x. Rep Choice x -> Choice
forall x. Choice -> Rep Choice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Choice -> Rep Choice x
from :: forall x. Choice -> Rep Choice x
$cto :: forall x. Rep Choice x -> Choice
to :: forall x. Rep Choice x -> Choice
Generic, Int -> Choice -> ShowS
[Choice] -> ShowS
Choice -> String
(Int -> Choice -> ShowS)
-> (Choice -> String) -> ([Choice] -> ShowS) -> Show Choice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Choice -> ShowS
showsPrec :: Int -> Choice -> ShowS
$cshow :: Choice -> String
show :: Choice -> String
$cshowList :: [Choice] -> ShowS
showList :: [Choice] -> ShowS
Show)
deriving anyclass (Maybe Choice
Value -> Parser [Choice]
Value -> Parser Choice
(Value -> Parser Choice)
-> (Value -> Parser [Choice]) -> Maybe Choice -> FromJSON Choice
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Choice
parseJSON :: Value -> Parser Choice
$cparseJSONList :: Value -> Parser [Choice]
parseJSONList :: Value -> Parser [Choice]
$comittedField :: Maybe Choice
omittedField :: Maybe Choice
FromJSON, [Choice] -> Value
[Choice] -> Encoding
Choice -> Bool
Choice -> Value
Choice -> Encoding
(Choice -> Value)
-> (Choice -> Encoding)
-> ([Choice] -> Value)
-> ([Choice] -> Encoding)
-> (Choice -> Bool)
-> ToJSON Choice
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: Choice -> Value
toJSON :: Choice -> Value
$ctoEncoding :: Choice -> Encoding
toEncoding :: Choice -> Encoding
$ctoJSONList :: [Choice] -> Value
toJSONList :: [Choice] -> Value
$ctoEncodingList :: [Choice] -> Encoding
toEncodingList :: [Choice] -> Encoding
$comitField :: Choice -> Bool
omitField :: Choice -> Bool
ToJSON)
data ChatCompletionObject = ChatCompletionObject
{ ChatCompletionObject -> Text
id :: Text
, ChatCompletionObject -> Vector Choice
choices :: Vector Choice
, ChatCompletionObject -> POSIXTime
created :: POSIXTime
, ChatCompletionObject -> Model
model :: Model
, ChatCompletionObject -> Maybe ReasoningEffort
reasoning_effort :: Maybe ReasoningEffort
, ChatCompletionObject -> Maybe Text
service_tier :: Maybe ServiceTier
, ChatCompletionObject -> Maybe Text
system_fingerprint :: Maybe Text
, ChatCompletionObject -> Text
object :: Text
, ChatCompletionObject
-> Usage CompletionTokensDetails PromptTokensDetails
usage :: Usage CompletionTokensDetails PromptTokensDetails
} deriving stock ((forall x. ChatCompletionObject -> Rep ChatCompletionObject x)
-> (forall x. Rep ChatCompletionObject x -> ChatCompletionObject)
-> Generic ChatCompletionObject
forall x. Rep ChatCompletionObject x -> ChatCompletionObject
forall x. ChatCompletionObject -> Rep ChatCompletionObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChatCompletionObject -> Rep ChatCompletionObject x
from :: forall x. ChatCompletionObject -> Rep ChatCompletionObject x
$cto :: forall x. Rep ChatCompletionObject x -> ChatCompletionObject
to :: forall x. Rep ChatCompletionObject x -> ChatCompletionObject
Generic, Int -> ChatCompletionObject -> ShowS
[ChatCompletionObject] -> ShowS
ChatCompletionObject -> String
(Int -> ChatCompletionObject -> ShowS)
-> (ChatCompletionObject -> String)
-> ([ChatCompletionObject] -> ShowS)
-> Show ChatCompletionObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatCompletionObject -> ShowS
showsPrec :: Int -> ChatCompletionObject -> ShowS
$cshow :: ChatCompletionObject -> String
show :: ChatCompletionObject -> String
$cshowList :: [ChatCompletionObject] -> ShowS
showList :: [ChatCompletionObject] -> ShowS
Show)
deriving anyclass (Maybe ChatCompletionObject
Value -> Parser [ChatCompletionObject]
Value -> Parser ChatCompletionObject
(Value -> Parser ChatCompletionObject)
-> (Value -> Parser [ChatCompletionObject])
-> Maybe ChatCompletionObject
-> FromJSON ChatCompletionObject
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ChatCompletionObject
parseJSON :: Value -> Parser ChatCompletionObject
$cparseJSONList :: Value -> Parser [ChatCompletionObject]
parseJSONList :: Value -> Parser [ChatCompletionObject]
$comittedField :: Maybe ChatCompletionObject
omittedField :: Maybe ChatCompletionObject
FromJSON, [ChatCompletionObject] -> Value
[ChatCompletionObject] -> Encoding
ChatCompletionObject -> Bool
ChatCompletionObject -> Value
ChatCompletionObject -> Encoding
(ChatCompletionObject -> Value)
-> (ChatCompletionObject -> Encoding)
-> ([ChatCompletionObject] -> Value)
-> ([ChatCompletionObject] -> Encoding)
-> (ChatCompletionObject -> Bool)
-> ToJSON ChatCompletionObject
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ChatCompletionObject -> Value
toJSON :: ChatCompletionObject -> Value
$ctoEncoding :: ChatCompletionObject -> Encoding
toEncoding :: ChatCompletionObject -> Encoding
$ctoJSONList :: [ChatCompletionObject] -> Value
toJSONList :: [ChatCompletionObject] -> Value
$ctoEncodingList :: [ChatCompletionObject] -> Encoding
toEncodingList :: [ChatCompletionObject] -> Encoding
$comitField :: ChatCompletionObject -> Bool
omitField :: ChatCompletionObject -> Bool
ToJSON)
data Delta = Delta
{ Delta -> Maybe Text
delta_content :: Maybe Text
, Delta -> Maybe Text
delta_refusal :: Maybe Text
, Delta -> Maybe Text
delta_role :: Maybe Text
, Delta -> Maybe (Vector ToolCall)
delta_tool_calls :: Maybe (Vector ToolCall)
} deriving stock ((forall x. Delta -> Rep Delta x)
-> (forall x. Rep Delta x -> Delta) -> Generic Delta
forall x. Rep Delta x -> Delta
forall x. Delta -> Rep Delta x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Delta -> Rep Delta x
from :: forall x. Delta -> Rep Delta x
$cto :: forall x. Rep Delta x -> Delta
to :: forall x. Rep Delta x -> Delta
Generic, Int -> Delta -> ShowS
[Delta] -> ShowS
Delta -> String
(Int -> Delta -> ShowS)
-> (Delta -> String) -> ([Delta] -> ShowS) -> Show Delta
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Delta -> ShowS
showsPrec :: Int -> Delta -> ShowS
$cshow :: Delta -> String
show :: Delta -> String
$cshowList :: [Delta] -> ShowS
showList :: [Delta] -> ShowS
Show)
deltaOptions :: Options
deltaOptions :: Options
deltaOptions = Options
aesonOptions
{ fieldLabelModifier = stripPrefix "delta_"
}
instance FromJSON Delta where
parseJSON :: Value -> Parser Delta
parseJSON = Options -> Value -> Parser Delta
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
deltaOptions
instance ToJSON Delta where
toJSON :: Delta -> Value
toJSON = Options -> Delta -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
deltaOptions
data ChunkChoice = ChunkChoice
{ ChunkChoice -> Delta
delta :: Delta
, ChunkChoice -> Maybe Text
finish_reason :: Maybe Text
, ChunkChoice -> Natural
index :: Natural
, ChunkChoice -> Maybe LogProbs
logprobs :: Maybe LogProbs
} deriving stock ((forall x. ChunkChoice -> Rep ChunkChoice x)
-> (forall x. Rep ChunkChoice x -> ChunkChoice)
-> Generic ChunkChoice
forall x. Rep ChunkChoice x -> ChunkChoice
forall x. ChunkChoice -> Rep ChunkChoice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChunkChoice -> Rep ChunkChoice x
from :: forall x. ChunkChoice -> Rep ChunkChoice x
$cto :: forall x. Rep ChunkChoice x -> ChunkChoice
to :: forall x. Rep ChunkChoice x -> ChunkChoice
Generic, Int -> ChunkChoice -> ShowS
[ChunkChoice] -> ShowS
ChunkChoice -> String
(Int -> ChunkChoice -> ShowS)
-> (ChunkChoice -> String)
-> ([ChunkChoice] -> ShowS)
-> Show ChunkChoice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChunkChoice -> ShowS
showsPrec :: Int -> ChunkChoice -> ShowS
$cshow :: ChunkChoice -> String
show :: ChunkChoice -> String
$cshowList :: [ChunkChoice] -> ShowS
showList :: [ChunkChoice] -> ShowS
Show)
deriving anyclass (Maybe ChunkChoice
Value -> Parser [ChunkChoice]
Value -> Parser ChunkChoice
(Value -> Parser ChunkChoice)
-> (Value -> Parser [ChunkChoice])
-> Maybe ChunkChoice
-> FromJSON ChunkChoice
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ChunkChoice
parseJSON :: Value -> Parser ChunkChoice
$cparseJSONList :: Value -> Parser [ChunkChoice]
parseJSONList :: Value -> Parser [ChunkChoice]
$comittedField :: Maybe ChunkChoice
omittedField :: Maybe ChunkChoice
FromJSON, [ChunkChoice] -> Value
[ChunkChoice] -> Encoding
ChunkChoice -> Bool
ChunkChoice -> Value
ChunkChoice -> Encoding
(ChunkChoice -> Value)
-> (ChunkChoice -> Encoding)
-> ([ChunkChoice] -> Value)
-> ([ChunkChoice] -> Encoding)
-> (ChunkChoice -> Bool)
-> ToJSON ChunkChoice
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ChunkChoice -> Value
toJSON :: ChunkChoice -> Value
$ctoEncoding :: ChunkChoice -> Encoding
toEncoding :: ChunkChoice -> Encoding
$ctoJSONList :: [ChunkChoice] -> Value
toJSONList :: [ChunkChoice] -> Value
$ctoEncodingList :: [ChunkChoice] -> Encoding
toEncodingList :: [ChunkChoice] -> Encoding
$comitField :: ChunkChoice -> Bool
omitField :: ChunkChoice -> Bool
ToJSON)
data ChatCompletionChunk = ChatCompletionChunk
{ ChatCompletionChunk -> Text
id :: Text
, ChatCompletionChunk -> Vector ChunkChoice
choices :: Vector ChunkChoice
, ChatCompletionChunk -> POSIXTime
created :: POSIXTime
, ChatCompletionChunk -> Model
model :: Model
, ChatCompletionChunk -> Maybe Text
service_tier :: Maybe ServiceTier
, ChatCompletionChunk -> Maybe Text
system_fingerprint :: Maybe Text
, ChatCompletionChunk -> Text
object :: Text
, ChatCompletionChunk
-> Maybe (Usage CompletionTokensDetails PromptTokensDetails)
usage :: Maybe (Usage CompletionTokensDetails PromptTokensDetails)
} deriving stock ((forall x. ChatCompletionChunk -> Rep ChatCompletionChunk x)
-> (forall x. Rep ChatCompletionChunk x -> ChatCompletionChunk)
-> Generic ChatCompletionChunk
forall x. Rep ChatCompletionChunk x -> ChatCompletionChunk
forall x. ChatCompletionChunk -> Rep ChatCompletionChunk x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChatCompletionChunk -> Rep ChatCompletionChunk x
from :: forall x. ChatCompletionChunk -> Rep ChatCompletionChunk x
$cto :: forall x. Rep ChatCompletionChunk x -> ChatCompletionChunk
to :: forall x. Rep ChatCompletionChunk x -> ChatCompletionChunk
Generic, Int -> ChatCompletionChunk -> ShowS
[ChatCompletionChunk] -> ShowS
ChatCompletionChunk -> String
(Int -> ChatCompletionChunk -> ShowS)
-> (ChatCompletionChunk -> String)
-> ([ChatCompletionChunk] -> ShowS)
-> Show ChatCompletionChunk
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatCompletionChunk -> ShowS
showsPrec :: Int -> ChatCompletionChunk -> ShowS
$cshow :: ChatCompletionChunk -> String
show :: ChatCompletionChunk -> String
$cshowList :: [ChatCompletionChunk] -> ShowS
showList :: [ChatCompletionChunk] -> ShowS
Show)
deriving anyclass (Maybe ChatCompletionChunk
Value -> Parser [ChatCompletionChunk]
Value -> Parser ChatCompletionChunk
(Value -> Parser ChatCompletionChunk)
-> (Value -> Parser [ChatCompletionChunk])
-> Maybe ChatCompletionChunk
-> FromJSON ChatCompletionChunk
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ChatCompletionChunk
parseJSON :: Value -> Parser ChatCompletionChunk
$cparseJSONList :: Value -> Parser [ChatCompletionChunk]
parseJSONList :: Value -> Parser [ChatCompletionChunk]
$comittedField :: Maybe ChatCompletionChunk
omittedField :: Maybe ChatCompletionChunk
FromJSON, [ChatCompletionChunk] -> Value
[ChatCompletionChunk] -> Encoding
ChatCompletionChunk -> Bool
ChatCompletionChunk -> Value
ChatCompletionChunk -> Encoding
(ChatCompletionChunk -> Value)
-> (ChatCompletionChunk -> Encoding)
-> ([ChatCompletionChunk] -> Value)
-> ([ChatCompletionChunk] -> Encoding)
-> (ChatCompletionChunk -> Bool)
-> ToJSON ChatCompletionChunk
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ChatCompletionChunk -> Value
toJSON :: ChatCompletionChunk -> Value
$ctoEncoding :: ChatCompletionChunk -> Encoding
toEncoding :: ChatCompletionChunk -> Encoding
$ctoJSONList :: [ChatCompletionChunk] -> Value
toJSONList :: [ChatCompletionChunk] -> Value
$ctoEncodingList :: [ChatCompletionChunk] -> Encoding
toEncodingList :: [ChatCompletionChunk] -> Encoding
$comitField :: ChatCompletionChunk -> Bool
omitField :: ChatCompletionChunk -> Bool
ToJSON)
type ChatCompletionStreamEvent = ChatCompletionChunk
type API =
"chat"
:> "completions"
:> ReqBody '[JSON] CreateChatCompletion
:> Post '[JSON] ChatCompletionObject