Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
/v1/chat/completions
Streaming results are not yet supported
Synopsis
- data CreateChatCompletion = CreateChatCompletion {
- messages :: Vector (Message (Vector Content))
- model :: Model
- store :: Maybe Bool
- metadata :: Maybe (Map Text Text)
- frequency_penalty :: Maybe Double
- logit_bias :: Maybe (Map Word Int)
- logprobs :: Maybe Bool
- top_logprobs :: Maybe Word
- max_completion_tokens :: Maybe Natural
- n :: Maybe Natural
- modalities :: Maybe (Vector Modality)
- prediction :: Maybe Prediction
- audio :: Maybe AudioParameters
- presence_penalty :: Maybe Double
- response_format :: Maybe ResponseFormat
- seed :: Maybe Integer
- service_tier :: Maybe (AutoOr ServiceTier)
- stop :: Maybe (Vector Text)
- temperature :: Maybe Double
- top_p :: Maybe Double
- tools :: Maybe (Vector Tool)
- tool_choice :: Maybe ToolChoice
- parallel_tool_calls :: Maybe Bool
- user :: Maybe Text
- _CreateChatCompletion :: CreateChatCompletion
- data ChatCompletionObject = ChatCompletionObject {
- id :: Text
- choices :: Vector Choice
- created :: POSIXTime
- model :: Model
- service_tier :: Maybe ServiceTier
- system_fingerprint :: Text
- object :: Text
- usage :: Usage CompletionTokensDetails PromptTokensDetails
- data Choice = Choice {}
- data Message content
- messageToContent :: Monoid content => Message content -> content
- data Content
- = Text { }
- | Image_URL { }
- | Input_Audio { }
- data InputAudio = InputAudio {
- data_ :: Text
- format :: AudioFormat
- data ImageURL = ImageURL {}
- data AudioData = AudioData {}
- data Modality
- data Prediction = Content {}
- data Voice
- data AudioFormat
- data AudioParameters = AudioParameters {
- voice :: Voice
- format :: AudioFormat
- data ResponseFormat
- data ServiceTier = Default
- data FinishReason
- data Token = Token {}
- data LogProbs = LogProbs {}
- type API = "chat" :> ("completions" :> (ReqBody '[JSON] CreateChatCompletion :> Post '[JSON] ChatCompletionObject))
Main types
data CreateChatCompletion Source #
Request body for /v1/chat/completions
CreateChatCompletion | |
|
Instances
data ChatCompletionObject Source #
ChatCompletion body
ChatCompletionObject | |
|
Instances
A chat completion choice
Instances
FromJSON Choice Source # | |
Defined in OpenAI.V1.Chat.Completions | |
Generic Choice Source # | |
Show Choice Source # | |
type Rep Choice Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep Choice = D1 ('MetaData "Choice" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) (C1 ('MetaCons "Choice" 'PrefixI 'True) ((S1 ('MetaSel ('Just "finish_reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "index") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)) :*: (S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Message Text)) :*: S1 ('MetaSel ('Just "logprobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe LogProbs))))) |
A message from the conversation so far
System | |
User | |
Assistant | |
| |
Tool | |
|
Instances
messageToContent :: Monoid content => Message content -> content Source #
Extract the message body from a Message
Normally this would just be the content
field selector, but the problem
is that the content field for the Assistant
constructor is not required
to be present, so we provide a utility function to default to extract the
content
field for all constructors, defaulting to mempty
for the special
case where the Message
is an Assistant
constructor with a missing
content
field
A content part
Instances
ToJSON Content Source # | |
IsString Content Source # | |
Defined in OpenAI.V1.Chat.Completions fromString :: String -> Content # | |
Generic Content Source # | |
Show Content Source # | |
type Rep Content Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep Content = D1 ('MetaData "Content" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) (C1 ('MetaCons "Text" 'PrefixI 'True) (S1 ('MetaSel ('Just "text") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: (C1 ('MetaCons "Image_URL" 'PrefixI 'True) (S1 ('MetaSel ('Just "image_url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImageURL)) :+: C1 ('MetaCons "Input_Audio" 'PrefixI 'True) (S1 ('MetaSel ('Just "input_audio") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 InputAudio)))) |
Other types
data InputAudio Source #
Audio content part
InputAudio | |
|
Instances
Image content part
Instances
ToJSON ImageURL Source # | |
Generic ImageURL Source # | |
Show ImageURL Source # | |
type Rep ImageURL Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep ImageURL = D1 ('MetaData "ImageURL" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) (C1 ('MetaCons "ImageURL" 'PrefixI 'True) (S1 ('MetaSel ('Just "url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "detail") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (AutoOr Text))))) |
Data about a previous audio response from the model. Learn more
Output types that you would like the model to generate for this request
data Prediction Source #
Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content
Instances
ToJSON Prediction Source # | |
Defined in OpenAI.V1.Chat.Completions toJSON :: Prediction -> Value # toEncoding :: Prediction -> Encoding # toJSONList :: [Prediction] -> Value # toEncodingList :: [Prediction] -> Encoding # omitField :: Prediction -> Bool # | |
Generic Prediction Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep Prediction :: Type -> Type # from :: Prediction -> Rep Prediction x # to :: Rep Prediction x -> Prediction # | |
Show Prediction Source # | |
Defined in OpenAI.V1.Chat.Completions showsPrec :: Int -> Prediction -> ShowS # show :: Prediction -> String # showList :: [Prediction] -> ShowS # | |
type Rep Prediction Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep Prediction = D1 ('MetaData "Prediction" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) (C1 ('MetaCons "Content" 'PrefixI 'True) (S1 ('MetaSel ('Just "content") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) |
The voice the model uses to respond
Instances
ToJSON Voice Source # | |
Generic Voice Source # | |
Show Voice Source # | |
type Rep Voice Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep Voice = D1 ('MetaData "Voice" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) ((C1 ('MetaCons "Ash" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Ballad" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Coral" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Sage" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Verse" 'PrefixI 'False) (U1 :: Type -> Type)))) |
data AudioFormat Source #
Specifies the output audio format
Instances
data AudioParameters Source #
Parameters for audio output
Instances
data ResponseFormat Source #
An object specifying the format that the model must output
Instances
data ServiceTier Source #
Specifies the latency tier to use for processing the request
Instances
FromJSON ServiceTier Source # | |
Defined in OpenAI.V1.Chat.Completions parseJSON :: Value -> Parser ServiceTier # parseJSONList :: Value -> Parser [ServiceTier] # | |
ToJSON ServiceTier Source # | |
Defined in OpenAI.V1.Chat.Completions toJSON :: ServiceTier -> Value # toEncoding :: ServiceTier -> Encoding # toJSONList :: [ServiceTier] -> Value # toEncodingList :: [ServiceTier] -> Encoding # omitField :: ServiceTier -> Bool # | |
Generic ServiceTier Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep ServiceTier :: Type -> Type # from :: ServiceTier -> Rep ServiceTier x # to :: Rep ServiceTier x -> ServiceTier # | |
Show ServiceTier Source # | |
Defined in OpenAI.V1.Chat.Completions showsPrec :: Int -> ServiceTier -> ShowS # show :: ServiceTier -> String # showList :: [ServiceTier] -> ShowS # | |
type Rep ServiceTier Source # | |
data FinishReason Source #
The reason the model stopped generating tokens
Instances
Message tokens with log probability information
Instances
FromJSON Token Source # | |
Defined in OpenAI.V1.Chat.Completions | |
Generic Token Source # | |
Show Token Source # | |
type Rep Token Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep Token = D1 ('MetaData "Token" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) (C1 ('MetaCons "Token" 'PrefixI 'True) ((S1 ('MetaSel ('Just "token") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "logprob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "bytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Vector Word8))) :*: S1 ('MetaSel ('Just "top_logprobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Vector Token)))))) |
Log probability information for the choice
Instances
FromJSON LogProbs Source # | |
Defined in OpenAI.V1.Chat.Completions | |
Generic LogProbs Source # | |
Show LogProbs Source # | |
type Rep LogProbs Source # | |
Defined in OpenAI.V1.Chat.Completions type Rep LogProbs = D1 ('MetaData "LogProbs" "OpenAI.V1.Chat.Completions" "openai-1.0.0-DWUl3td9tpcnv1wfBaSVp" 'False) (C1 ('MetaCons "LogProbs" 'PrefixI 'True) (S1 ('MetaSel ('Just "content") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Vector Token))) :*: S1 ('MetaSel ('Just "refusal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Vector Token))))) |