module OpenAI.V1.Responses
(
CreateResponse(..)
, _CreateResponse
, Input(..)
, InputItem(..)
, InputRole(..)
, InputContent(..)
, OutputItem(..)
, OutputMessage(..)
, OutputContent(..)
, FunctionToolCall(..)
, FunctionToolCallOutput(..)
, WebSearchToolCall(..)
, FileSearchToolCall(..)
, FileSearchResult(..)
, CodeInterpreterToolCall(..)
, CodeInterpreterOutput(..)
, WebSearchAction(..)
, WebSearchSource(..)
, Annotation(..)
, ReasoningSummary(..)
, Reasoning(..)
, _Reasoning
, ReasoningItem(..)
, SummaryPart(..)
, ReasoningText(..)
, ReasoningEffort(..)
, ServiceTier
, ResponseStreamEvent(..)
, ResponseObject(..)
, ResponseUsage(..)
, InputTokensDetails(..)
, OutputTokensDetails(..)
, statusIncomplete
, statusCompleted
, API
) where
import Data.Aeson (Object)
import qualified Data.Aeson as Aeson
import OpenAI.Prelude hiding (Input(..))
import OpenAI.V1.AutoOr (AutoOr(..))
import OpenAI.V1.ListOf (ListOf)
import OpenAI.V1.Models (Model)
import qualified Data.Aeson.Key as Key
import qualified Data.Aeson.KeyMap as KeyMap
import qualified Data.Vector as Vector
import OpenAI.V1.Tool
( Tool
, ToolChoice
, toolChoiceAutoText
, toolChoiceNoneText
, toolChoiceRequiredText
, toolChoiceToResponsesValue
, toolToResponsesValue
, unflattenToolValue
)
statusIncomplete, statusCompleted :: Text
statusIncomplete :: Text
statusIncomplete = Text
"incomplete"
statusCompleted :: Text
statusCompleted = Text
"completed"
type ServiceTier = Text
data ReasoningEffort
= ReasoningEffort_Minimal
| ReasoningEffort_Low
| ReasoningEffort_Medium
| ReasoningEffort_High
deriving stock (ReasoningEffort -> ReasoningEffort -> Bool
(ReasoningEffort -> ReasoningEffort -> Bool)
-> (ReasoningEffort -> ReasoningEffort -> Bool)
-> Eq ReasoningEffort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReasoningEffort -> ReasoningEffort -> Bool
== :: ReasoningEffort -> ReasoningEffort -> Bool
$c/= :: ReasoningEffort -> ReasoningEffort -> Bool
/= :: ReasoningEffort -> ReasoningEffort -> Bool
Eq, (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 ReasoningSummary
= ReasoningSummary_Auto
| ReasoningSummary_Concise
| ReasoningSummary_Detailed
deriving stock (ReasoningSummary -> ReasoningSummary -> Bool
(ReasoningSummary -> ReasoningSummary -> Bool)
-> (ReasoningSummary -> ReasoningSummary -> Bool)
-> Eq ReasoningSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReasoningSummary -> ReasoningSummary -> Bool
== :: ReasoningSummary -> ReasoningSummary -> Bool
$c/= :: ReasoningSummary -> ReasoningSummary -> Bool
/= :: ReasoningSummary -> ReasoningSummary -> Bool
Eq, (forall x. ReasoningSummary -> Rep ReasoningSummary x)
-> (forall x. Rep ReasoningSummary x -> ReasoningSummary)
-> Generic ReasoningSummary
forall x. Rep ReasoningSummary x -> ReasoningSummary
forall x. ReasoningSummary -> Rep ReasoningSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReasoningSummary -> Rep ReasoningSummary x
from :: forall x. ReasoningSummary -> Rep ReasoningSummary x
$cto :: forall x. Rep ReasoningSummary x -> ReasoningSummary
to :: forall x. Rep ReasoningSummary x -> ReasoningSummary
Generic, Int -> ReasoningSummary -> ShowS
[ReasoningSummary] -> ShowS
ReasoningSummary -> String
(Int -> ReasoningSummary -> ShowS)
-> (ReasoningSummary -> String)
-> ([ReasoningSummary] -> ShowS)
-> Show ReasoningSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReasoningSummary -> ShowS
showsPrec :: Int -> ReasoningSummary -> ShowS
$cshow :: ReasoningSummary -> String
show :: ReasoningSummary -> String
$cshowList :: [ReasoningSummary] -> ShowS
showList :: [ReasoningSummary] -> ShowS
Show)
reasoningSummaryOptions :: Options
reasoningSummaryOptions :: Options
reasoningSummaryOptions =
Options
aesonOptions
{ constructorTagModifier = stripPrefix "ReasoningSummary_" }
instance FromJSON ReasoningSummary where
parseJSON :: Value -> Parser ReasoningSummary
parseJSON = Options -> Value -> Parser ReasoningSummary
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
reasoningSummaryOptions
instance ToJSON ReasoningSummary where
toJSON :: ReasoningSummary -> Value
toJSON = Options -> ReasoningSummary -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
reasoningSummaryOptions
data Reasoning = Reasoning
{ Reasoning -> Maybe ReasoningEffort
effort :: Maybe ReasoningEffort
, Reasoning -> Maybe ReasoningSummary
summary :: Maybe ReasoningSummary
, Reasoning -> Maybe ReasoningSummary
generate_summary :: Maybe ReasoningSummary
} deriving stock (Reasoning -> Reasoning -> Bool
(Reasoning -> Reasoning -> Bool)
-> (Reasoning -> Reasoning -> Bool) -> Eq Reasoning
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Reasoning -> Reasoning -> Bool
== :: Reasoning -> Reasoning -> Bool
$c/= :: Reasoning -> Reasoning -> Bool
/= :: Reasoning -> Reasoning -> Bool
Eq, (forall x. Reasoning -> Rep Reasoning x)
-> (forall x. Rep Reasoning x -> Reasoning) -> Generic Reasoning
forall x. Rep Reasoning x -> Reasoning
forall x. Reasoning -> Rep Reasoning x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Reasoning -> Rep Reasoning x
from :: forall x. Reasoning -> Rep Reasoning x
$cto :: forall x. Rep Reasoning x -> Reasoning
to :: forall x. Rep Reasoning x -> Reasoning
Generic, Int -> Reasoning -> ShowS
[Reasoning] -> ShowS
Reasoning -> String
(Int -> Reasoning -> ShowS)
-> (Reasoning -> String)
-> ([Reasoning] -> ShowS)
-> Show Reasoning
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Reasoning -> ShowS
showsPrec :: Int -> Reasoning -> ShowS
$cshow :: Reasoning -> String
show :: Reasoning -> String
$cshowList :: [Reasoning] -> ShowS
showList :: [Reasoning] -> ShowS
Show)
instance FromJSON Reasoning where
parseJSON :: Value -> Parser Reasoning
parseJSON = Options -> Value -> Parser Reasoning
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON Reasoning where
toJSON :: Reasoning -> Value
toJSON = Options -> Reasoning -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
_Reasoning :: Reasoning
_Reasoning :: Reasoning
_Reasoning =
Reasoning
{ effort :: Maybe ReasoningEffort
effort = Maybe ReasoningEffort
forall a. Maybe a
Nothing
, summary :: Maybe ReasoningSummary
summary = Maybe ReasoningSummary
forall a. Maybe a
Nothing
, generate_summary :: Maybe ReasoningSummary
generate_summary = Maybe ReasoningSummary
forall a. Maybe a
Nothing
}
newtype Input = Input (Vector InputItem)
deriving stock ((forall x. Input -> Rep Input x)
-> (forall x. Rep Input x -> Input) -> Generic Input
forall x. Rep Input x -> Input
forall x. Input -> Rep Input x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Input -> Rep Input x
from :: forall x. Input -> Rep Input x
$cto :: forall x. Rep Input x -> Input
to :: forall x. Rep Input x -> Input
Generic, Int -> Input -> ShowS
[Input] -> ShowS
Input -> String
(Int -> Input -> ShowS)
-> (Input -> String) -> ([Input] -> ShowS) -> Show Input
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Input -> ShowS
showsPrec :: Int -> Input -> ShowS
$cshow :: Input -> String
show :: Input -> String
$cshowList :: [Input] -> ShowS
showList :: [Input] -> ShowS
Show)
instance ToJSON Input where
toJSON :: Input -> Value
toJSON (Input Vector InputItem
xs) = Vector InputItem -> Value
forall a. ToJSON a => a -> Value
toJSON Vector InputItem
xs
instance FromJSON Input where
parseJSON :: Value -> Parser Input
parseJSON Value
v = Vector InputItem -> Input
Input (Vector InputItem -> Input)
-> Parser (Vector InputItem) -> Parser Input
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser (Vector InputItem)
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v
data InputRole = User | System | Developer
deriving stock (InputRole -> InputRole -> Bool
(InputRole -> InputRole -> Bool)
-> (InputRole -> InputRole -> Bool) -> Eq InputRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputRole -> InputRole -> Bool
== :: InputRole -> InputRole -> Bool
$c/= :: InputRole -> InputRole -> Bool
/= :: InputRole -> InputRole -> Bool
Eq, (forall x. InputRole -> Rep InputRole x)
-> (forall x. Rep InputRole x -> InputRole) -> Generic InputRole
forall x. Rep InputRole x -> InputRole
forall x. InputRole -> Rep InputRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InputRole -> Rep InputRole x
from :: forall x. InputRole -> Rep InputRole x
$cto :: forall x. Rep InputRole x -> InputRole
to :: forall x. Rep InputRole x -> InputRole
Generic, Int -> InputRole -> ShowS
[InputRole] -> ShowS
InputRole -> String
(Int -> InputRole -> ShowS)
-> (InputRole -> String)
-> ([InputRole] -> ShowS)
-> Show InputRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputRole -> ShowS
showsPrec :: Int -> InputRole -> ShowS
$cshow :: InputRole -> String
show :: InputRole -> String
$cshowList :: [InputRole] -> ShowS
showList :: [InputRole] -> ShowS
Show)
instance FromJSON InputRole where
parseJSON :: Value -> Parser InputRole
parseJSON = Options -> Value -> Parser InputRole
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON InputRole where
toJSON :: InputRole -> Value
toJSON = Options -> InputRole -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data InputContent
= Input_Text { InputContent -> Text
text :: Text }
| Input_Image { InputContent -> Maybe Text
image_url :: Maybe Text, InputContent -> Maybe Text
file_id :: Maybe Text, InputContent -> Maybe Text
detail :: Maybe Text }
| Input_File { file_id :: Maybe Text, InputContent -> Maybe Text
filename :: Maybe Text, InputContent -> Maybe Text
file_url :: Maybe Text, InputContent -> Maybe Text
file_data :: Maybe Text }
| Input_Audio { InputContent -> Object
input_audio :: Object }
deriving stock (InputContent -> InputContent -> Bool
(InputContent -> InputContent -> Bool)
-> (InputContent -> InputContent -> Bool) -> Eq InputContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputContent -> InputContent -> Bool
== :: InputContent -> InputContent -> Bool
$c/= :: InputContent -> InputContent -> Bool
/= :: InputContent -> InputContent -> Bool
Eq, (forall x. InputContent -> Rep InputContent x)
-> (forall x. Rep InputContent x -> InputContent)
-> Generic InputContent
forall x. Rep InputContent x -> InputContent
forall x. InputContent -> Rep InputContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InputContent -> Rep InputContent x
from :: forall x. InputContent -> Rep InputContent x
$cto :: forall x. Rep InputContent x -> InputContent
to :: forall x. Rep InputContent x -> InputContent
Generic, Int -> InputContent -> ShowS
[InputContent] -> ShowS
InputContent -> String
(Int -> InputContent -> ShowS)
-> (InputContent -> String)
-> ([InputContent] -> ShowS)
-> Show InputContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputContent -> ShowS
showsPrec :: Int -> InputContent -> ShowS
$cshow :: InputContent -> String
show :: InputContent -> String
$cshowList :: [InputContent] -> ShowS
showList :: [InputContent] -> ShowS
Show)
inputContentOptions :: Options
inputContentOptions :: Options
inputContentOptions =
Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, constructorTagModifier = labelModifier
}
instance FromJSON InputContent where
parseJSON :: Value -> Parser InputContent
parseJSON = Options -> Value -> Parser InputContent
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
inputContentOptions
instance ToJSON InputContent where
toJSON :: InputContent -> Value
toJSON = Options -> InputContent -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
inputContentOptions
data InputItem
= Item_Input_Message
{ InputItem -> InputRole
role :: InputRole
, InputItem -> Vector InputContent
content :: Vector InputContent
, InputItem -> Maybe Text
status :: Maybe Text
}
| Item_Input_Function_Call
{ InputItem -> Maybe Text
id :: Maybe Text
, InputItem -> Text
call_id :: Text
, InputItem -> Text
name :: Text
, InputItem -> Text
arguments :: Text
, status :: Maybe Text
}
| Item_Input_Function_Call_Output
{ id :: Maybe Text
, call_id :: Text
, InputItem -> Text
output :: Text
, status :: Maybe Text
}
| Item_Input_Reasoning
{ InputItem -> Text
reasoning_id :: Text
, InputItem -> Maybe Text
reasoning_encrypted_content :: Maybe Text
, InputItem -> Maybe (Vector SummaryPart)
reasoning_summary :: Maybe (Vector SummaryPart)
, InputItem -> Maybe (Vector ReasoningText)
reasoning_content :: Maybe (Vector ReasoningText)
, InputItem -> Maybe Text
reasoning_status :: Maybe Text
}
| Item_Input_Item_Reference
{ id :: Maybe Text
}
deriving stock (InputItem -> InputItem -> Bool
(InputItem -> InputItem -> Bool)
-> (InputItem -> InputItem -> Bool) -> Eq InputItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputItem -> InputItem -> Bool
== :: InputItem -> InputItem -> Bool
$c/= :: InputItem -> InputItem -> Bool
/= :: InputItem -> InputItem -> Bool
Eq, (forall x. InputItem -> Rep InputItem x)
-> (forall x. Rep InputItem x -> InputItem) -> Generic InputItem
forall x. Rep InputItem x -> InputItem
forall x. InputItem -> Rep InputItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InputItem -> Rep InputItem x
from :: forall x. InputItem -> Rep InputItem x
$cto :: forall x. Rep InputItem x -> InputItem
to :: forall x. Rep InputItem x -> InputItem
Generic, Int -> InputItem -> ShowS
[InputItem] -> ShowS
InputItem -> String
(Int -> InputItem -> ShowS)
-> (InputItem -> String)
-> ([InputItem] -> ShowS)
-> Show InputItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputItem -> ShowS
showsPrec :: Int -> InputItem -> ShowS
$cshow :: InputItem -> String
show :: InputItem -> String
$cshowList :: [InputItem] -> ShowS
showList :: [InputItem] -> ShowS
Show)
inputItemOptions :: Options
inputItemOptions :: Options
inputItemOptions =
Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, constructorTagModifier = stripPrefix "Item_Input_"
, fieldLabelModifier = stripPrefix "reasoning_"
}
instance FromJSON InputItem where
parseJSON :: Value -> Parser InputItem
parseJSON = Options -> Value -> Parser InputItem
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
inputItemOptions
instance ToJSON InputItem where
toJSON :: InputItem -> Value
toJSON = Options -> InputItem -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
inputItemOptions
keyTools :: Key.Key
keyTools :: Key
keyTools = Text -> Key
Key.fromText Text
"tools"
keyToolChoice :: Key.Key
keyToolChoice :: Key
keyToolChoice = Text -> Key
Key.fromText Text
"tool_choice"
flattenResponseToolFields
:: Maybe (Vector Tool)
-> Maybe ToolChoice
-> KeyMap.KeyMap Value
-> KeyMap.KeyMap Value
flattenResponseToolFields :: Maybe (Vector Tool) -> Maybe ToolChoice -> Object -> Object
flattenResponseToolFields Maybe (Vector Tool)
mTools Maybe ToolChoice
mChoice Object
o =
let oWithTools :: Object
oWithTools = case Maybe (Vector Tool)
mTools of
Maybe (Vector Tool)
Nothing -> Object
o
Just Vector Tool
ts -> Key -> Value -> Object -> Object
forall v. Key -> v -> KeyMap v -> KeyMap v
KeyMap.insert Key
keyTools (Array -> Value
Aeson.Array ((Tool -> Value) -> Vector Tool -> Array
forall a b. (a -> b) -> Vector a -> Vector b
Vector.map Tool -> Value
toolToResponsesValue Vector Tool
ts)) Object
o
oWithChoice :: Object
oWithChoice = case Maybe ToolChoice
mChoice of
Maybe ToolChoice
Nothing -> Object
oWithTools
Just ToolChoice
choice -> Key -> Value -> Object -> Object
forall v. Key -> v -> KeyMap v -> KeyMap v
KeyMap.insert Key
keyToolChoice (ToolChoice -> Value
toolChoiceToResponsesValue ToolChoice
choice) Object
oWithTools
in Object
oWithChoice
unflattenResponseToolFields :: KeyMap.KeyMap Value -> KeyMap.KeyMap Value
unflattenResponseToolFields :: Object -> Object
unflattenResponseToolFields = Object -> Object
adjustChoice (Object -> Object) -> (Object -> Object) -> Object -> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Object -> Object
adjustTools
where
adjustTools :: Object -> Object
adjustTools = Key -> (Value -> Value) -> Object -> Object
adjustKey Key
keyTools ((Value -> Value) -> Value -> Value
mapArrayValues Value -> Value
unflattenToolValue)
adjustChoice :: Object -> Object
adjustChoice = Key -> (Value -> Value) -> Object -> Object
adjustKey Key
keyToolChoice Value -> Value
unflattenChoice
unflattenChoice :: Value -> Value
unflattenChoice (String Text
s)
| Text
s Text -> [Text] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` ([Text
Item [Text]
toolChoiceNoneText, Text
Item [Text]
toolChoiceAutoText, Text
Item [Text]
toolChoiceRequiredText] :: [Text]) = Text -> Value
String Text
s
unflattenChoice Value
other = Value -> Value
unflattenToolValue Value
other
mapArrayValues :: (Value -> Value) -> Value -> Value
mapArrayValues :: (Value -> Value) -> Value -> Value
mapArrayValues Value -> Value
f (Aeson.Array Array
arr) = Array -> Value
Aeson.Array ((Value -> Value) -> Array -> Array
forall a b. (a -> b) -> Vector a -> Vector b
Vector.map Value -> Value
f Array
arr)
mapArrayValues Value -> Value
_ Value
other = Value
other
adjustKey
:: Key.Key
-> (Value -> Value)
-> KeyMap.KeyMap Value
-> KeyMap.KeyMap Value
adjustKey :: Key -> (Value -> Value) -> Object -> Object
adjustKey Key
key Value -> Value
f Object
obj =
case Key -> Object -> Maybe Value
forall v. Key -> KeyMap v -> Maybe v
KeyMap.lookup Key
key Object
obj of
Maybe Value
Nothing -> Object
obj
Just Value
v -> Key -> Value -> Object -> Object
forall v. Key -> v -> KeyMap v -> KeyMap v
KeyMap.insert Key
key (Value -> Value
f Value
v) Object
obj
data OutputContent
= Output_Text
{ OutputContent -> Text
text :: Text
, OutputContent -> Array
annotations :: Vector Value
, OutputContent -> Maybe Array
logprobs :: Maybe (Vector Value)
}
| Refusal
{ OutputContent -> Text
refusal :: Text }
deriving stock ((forall x. OutputContent -> Rep OutputContent x)
-> (forall x. Rep OutputContent x -> OutputContent)
-> Generic OutputContent
forall x. Rep OutputContent x -> OutputContent
forall x. OutputContent -> Rep OutputContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OutputContent -> Rep OutputContent x
from :: forall x. OutputContent -> Rep OutputContent x
$cto :: forall x. Rep OutputContent x -> OutputContent
to :: forall x. Rep OutputContent x -> OutputContent
Generic, Int -> OutputContent -> ShowS
[OutputContent] -> ShowS
OutputContent -> String
(Int -> OutputContent -> ShowS)
-> (OutputContent -> String)
-> ([OutputContent] -> ShowS)
-> Show OutputContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OutputContent -> ShowS
showsPrec :: Int -> OutputContent -> ShowS
$cshow :: OutputContent -> String
show :: OutputContent -> String
$cshowList :: [OutputContent] -> ShowS
showList :: [OutputContent] -> ShowS
Show)
outputContentOptions :: Options
outputContentOptions :: Options
outputContentOptions =
Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
}
instance FromJSON OutputContent where
parseJSON :: Value -> Parser OutputContent
parseJSON = Options -> Value -> Parser OutputContent
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
outputContentOptions
instance ToJSON OutputContent where
toJSON :: OutputContent -> Value
toJSON = Options -> OutputContent -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
outputContentOptions
data OutputMessage = OutputMessage
{ OutputMessage -> Text
id :: Text
, OutputMessage -> Text
role :: Text
, OutputMessage -> Vector OutputContent
content :: Vector OutputContent
, OutputMessage -> Text
status :: Text
} deriving stock ((forall x. OutputMessage -> Rep OutputMessage x)
-> (forall x. Rep OutputMessage x -> OutputMessage)
-> Generic OutputMessage
forall x. Rep OutputMessage x -> OutputMessage
forall x. OutputMessage -> Rep OutputMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OutputMessage -> Rep OutputMessage x
from :: forall x. OutputMessage -> Rep OutputMessage x
$cto :: forall x. Rep OutputMessage x -> OutputMessage
to :: forall x. Rep OutputMessage x -> OutputMessage
Generic, Int -> OutputMessage -> ShowS
[OutputMessage] -> ShowS
OutputMessage -> String
(Int -> OutputMessage -> ShowS)
-> (OutputMessage -> String)
-> ([OutputMessage] -> ShowS)
-> Show OutputMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OutputMessage -> ShowS
showsPrec :: Int -> OutputMessage -> ShowS
$cshow :: OutputMessage -> String
show :: OutputMessage -> String
$cshowList :: [OutputMessage] -> ShowS
showList :: [OutputMessage] -> ShowS
Show)
instance FromJSON OutputMessage where
parseJSON :: Value -> Parser OutputMessage
parseJSON = Options -> Value -> Parser OutputMessage
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON OutputMessage where
toJSON :: OutputMessage -> Value
toJSON = Options -> OutputMessage -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data OutputItem
= Item_OutputMessage
{ OutputItem -> Text
message_id :: Text
, OutputItem -> Text
message_role :: Text
, OutputItem -> Vector OutputContent
message_content :: Vector OutputContent
, OutputItem -> Text
message_status :: Text
}
| Item_FunctionToolCall
{ OutputItem -> Maybe Text
function_id :: Maybe Text
, OutputItem -> Text
function_call_id :: Text
, OutputItem -> Text
function_name :: Text
, OutputItem -> Text
function_arguments :: Text
, OutputItem -> Maybe Text
function_status :: Maybe Text
}
| Item_WebSearchToolCall
{ OutputItem -> Text
web_search_id :: Text
, OutputItem -> Text
web_search_status :: Text
, OutputItem -> Maybe WebSearchAction
web_search_action :: Maybe WebSearchAction
}
| Item_FunctionToolCallOutput
{ OutputItem -> Maybe Text
function_output_id :: Maybe Text
, OutputItem -> Text
function_output_call_id :: Text
, OutputItem -> Text
function_output_output :: Text
, OutputItem -> Maybe Text
function_output_status :: Maybe Text
}
| Item_FileSearchToolCall
{ OutputItem -> Text
file_search_id :: Text
, OutputItem -> Text
file_search_status :: Text
, OutputItem -> Vector Text
file_search_queries :: Vector Text
, OutputItem -> Maybe (Vector FileSearchResult)
file_search_results :: Maybe (Vector FileSearchResult)
}
| Item_CodeInterpreterToolCall
{ OutputItem -> Text
code_interpreter_id :: Text
, OutputItem -> Text
code_interpreter_status :: Text
, OutputItem -> Maybe Text
code_interpreter_container_id :: Maybe Text
, OutputItem -> Maybe Text
code_interpreter_code :: Maybe Text
, OutputItem -> Maybe (Vector CodeInterpreterOutput)
code_interpreter_outputs :: Maybe (Vector CodeInterpreterOutput)
}
| Item_Reasoning
{ OutputItem -> Text
reasoning_id :: Text
, OutputItem -> Maybe Text
reasoning_encrypted_content :: Maybe Text
, OutputItem -> Maybe (Vector SummaryPart)
reasoning_summary :: Maybe (Vector SummaryPart)
, OutputItem -> Maybe (Vector ReasoningText)
reasoning_content :: Maybe (Vector ReasoningText)
, OutputItem -> Maybe Text
reasoning_status :: Maybe Text
}
deriving stock ((forall x. OutputItem -> Rep OutputItem x)
-> (forall x. Rep OutputItem x -> OutputItem) -> Generic OutputItem
forall x. Rep OutputItem x -> OutputItem
forall x. OutputItem -> Rep OutputItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OutputItem -> Rep OutputItem x
from :: forall x. OutputItem -> Rep OutputItem x
$cto :: forall x. Rep OutputItem x -> OutputItem
to :: forall x. Rep OutputItem x -> OutputItem
Generic, Int -> OutputItem -> ShowS
[OutputItem] -> ShowS
OutputItem -> String
(Int -> OutputItem -> ShowS)
-> (OutputItem -> String)
-> ([OutputItem] -> ShowS)
-> Show OutputItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OutputItem -> ShowS
showsPrec :: Int -> OutputItem -> ShowS
$cshow :: OutputItem -> String
show :: OutputItem -> String
$cshowList :: [OutputItem] -> ShowS
showList :: [OutputItem] -> ShowS
Show)
outputItemOptions :: Options
outputItemOptions :: Options
outputItemOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, fieldLabelModifier = \String
s -> case String
s of
String
"message_id" -> String
"id"
String
"message_role" -> String
"role"
String
"message_content" -> String
"content"
String
"message_status" -> String
"status"
String
"function_id" -> String
"id"
String
"function_call_id" -> String
"call_id"
String
"function_name" -> String
"name"
String
"function_arguments" -> String
"arguments"
String
"function_status" -> String
"status"
String
"web_search_id" -> String
"id"
String
"web_search_status" -> String
"status"
String
"web_search_action" -> String
"action"
String
"function_output_id" -> String
"id"
String
"function_output_call_id" -> String
"call_id"
String
"function_output_output" -> String
"output"
String
"function_output_status" -> String
"status"
String
"file_search_id" -> String
"id"
String
"file_search_status" -> String
"status"
String
"file_search_queries" -> String
"queries"
String
"file_search_results" -> String
"results"
String
"code_interpreter_id" -> String
"id"
String
"code_interpreter_status" -> String
"status"
String
"code_interpreter_container_id" -> String
"container_id"
String
"code_interpreter_code" -> String
"code"
String
"code_interpreter_outputs" -> String
"outputs"
String
"reasoning_id" -> String
"id"
String
"reasoning_encrypted_content" -> String
"encrypted_content"
String
"reasoning_summary" -> String
"summary"
String
"reasoning_content" -> String
"content"
String
"reasoning_status" -> String
"status"
String
other -> String
other
, constructorTagModifier = \String
s -> case String
s of
String
"Item_OutputMessage" -> String
"message"
String
"Item_FunctionToolCall" -> String
"function_call"
String
"Item_WebSearchToolCall" -> String
"web_search_call"
String
"Item_FunctionToolCallOutput" -> String
"function_call_output"
String
"Item_FileSearchToolCall" -> String
"file_search_call"
String
"Item_CodeInterpreterToolCall" -> String
"code_interpreter_call"
String
"Item_Reasoning" -> String
"reasoning"
String
_ -> ShowS
forall a. HasCallStack => String -> a
Prelude.error String
"Unknown OutputItem constructor"
}
instance FromJSON OutputItem where
parseJSON :: Value -> Parser OutputItem
parseJSON = Options -> Value -> Parser OutputItem
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
outputItemOptions
instance ToJSON OutputItem where
toJSON :: OutputItem -> Value
toJSON = Options -> OutputItem -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
outputItemOptions
data FunctionToolCall = FunctionToolCall
{ FunctionToolCall -> Maybe Text
id :: Maybe Text
, FunctionToolCall -> Text
call_id :: Text
, FunctionToolCall -> Text
name :: Text
, FunctionToolCall -> Text
arguments :: Text
, FunctionToolCall -> Maybe Text
status :: Maybe Text
} deriving stock ((forall x. FunctionToolCall -> Rep FunctionToolCall x)
-> (forall x. Rep FunctionToolCall x -> FunctionToolCall)
-> Generic FunctionToolCall
forall x. Rep FunctionToolCall x -> FunctionToolCall
forall x. FunctionToolCall -> Rep FunctionToolCall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FunctionToolCall -> Rep FunctionToolCall x
from :: forall x. FunctionToolCall -> Rep FunctionToolCall x
$cto :: forall x. Rep FunctionToolCall x -> FunctionToolCall
to :: forall x. Rep FunctionToolCall x -> FunctionToolCall
Generic, Int -> FunctionToolCall -> ShowS
[FunctionToolCall] -> ShowS
FunctionToolCall -> String
(Int -> FunctionToolCall -> ShowS)
-> (FunctionToolCall -> String)
-> ([FunctionToolCall] -> ShowS)
-> Show FunctionToolCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionToolCall -> ShowS
showsPrec :: Int -> FunctionToolCall -> ShowS
$cshow :: FunctionToolCall -> String
show :: FunctionToolCall -> String
$cshowList :: [FunctionToolCall] -> ShowS
showList :: [FunctionToolCall] -> ShowS
Show)
deriving anyclass (Maybe FunctionToolCall
Value -> Parser [FunctionToolCall]
Value -> Parser FunctionToolCall
(Value -> Parser FunctionToolCall)
-> (Value -> Parser [FunctionToolCall])
-> Maybe FunctionToolCall
-> FromJSON FunctionToolCall
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser FunctionToolCall
parseJSON :: Value -> Parser FunctionToolCall
$cparseJSONList :: Value -> Parser [FunctionToolCall]
parseJSONList :: Value -> Parser [FunctionToolCall]
$comittedField :: Maybe FunctionToolCall
omittedField :: Maybe FunctionToolCall
FromJSON, [FunctionToolCall] -> Value
[FunctionToolCall] -> Encoding
FunctionToolCall -> Bool
FunctionToolCall -> Value
FunctionToolCall -> Encoding
(FunctionToolCall -> Value)
-> (FunctionToolCall -> Encoding)
-> ([FunctionToolCall] -> Value)
-> ([FunctionToolCall] -> Encoding)
-> (FunctionToolCall -> Bool)
-> ToJSON FunctionToolCall
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: FunctionToolCall -> Value
toJSON :: FunctionToolCall -> Value
$ctoEncoding :: FunctionToolCall -> Encoding
toEncoding :: FunctionToolCall -> Encoding
$ctoJSONList :: [FunctionToolCall] -> Value
toJSONList :: [FunctionToolCall] -> Value
$ctoEncodingList :: [FunctionToolCall] -> Encoding
toEncodingList :: [FunctionToolCall] -> Encoding
$comitField :: FunctionToolCall -> Bool
omitField :: FunctionToolCall -> Bool
ToJSON)
data FunctionToolCallOutput = FunctionToolCallOutput
{ FunctionToolCallOutput -> Maybe Text
id :: Maybe Text
, FunctionToolCallOutput -> Text
call_id :: Text
, FunctionToolCallOutput -> Text
output :: Text
, FunctionToolCallOutput -> Maybe Text
status :: Maybe Text
} deriving stock ((forall x. FunctionToolCallOutput -> Rep FunctionToolCallOutput x)
-> (forall x.
Rep FunctionToolCallOutput x -> FunctionToolCallOutput)
-> Generic FunctionToolCallOutput
forall x. Rep FunctionToolCallOutput x -> FunctionToolCallOutput
forall x. FunctionToolCallOutput -> Rep FunctionToolCallOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FunctionToolCallOutput -> Rep FunctionToolCallOutput x
from :: forall x. FunctionToolCallOutput -> Rep FunctionToolCallOutput x
$cto :: forall x. Rep FunctionToolCallOutput x -> FunctionToolCallOutput
to :: forall x. Rep FunctionToolCallOutput x -> FunctionToolCallOutput
Generic, Int -> FunctionToolCallOutput -> ShowS
[FunctionToolCallOutput] -> ShowS
FunctionToolCallOutput -> String
(Int -> FunctionToolCallOutput -> ShowS)
-> (FunctionToolCallOutput -> String)
-> ([FunctionToolCallOutput] -> ShowS)
-> Show FunctionToolCallOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionToolCallOutput -> ShowS
showsPrec :: Int -> FunctionToolCallOutput -> ShowS
$cshow :: FunctionToolCallOutput -> String
show :: FunctionToolCallOutput -> String
$cshowList :: [FunctionToolCallOutput] -> ShowS
showList :: [FunctionToolCallOutput] -> ShowS
Show)
deriving anyclass (Maybe FunctionToolCallOutput
Value -> Parser [FunctionToolCallOutput]
Value -> Parser FunctionToolCallOutput
(Value -> Parser FunctionToolCallOutput)
-> (Value -> Parser [FunctionToolCallOutput])
-> Maybe FunctionToolCallOutput
-> FromJSON FunctionToolCallOutput
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser FunctionToolCallOutput
parseJSON :: Value -> Parser FunctionToolCallOutput
$cparseJSONList :: Value -> Parser [FunctionToolCallOutput]
parseJSONList :: Value -> Parser [FunctionToolCallOutput]
$comittedField :: Maybe FunctionToolCallOutput
omittedField :: Maybe FunctionToolCallOutput
FromJSON, [FunctionToolCallOutput] -> Value
[FunctionToolCallOutput] -> Encoding
FunctionToolCallOutput -> Bool
FunctionToolCallOutput -> Value
FunctionToolCallOutput -> Encoding
(FunctionToolCallOutput -> Value)
-> (FunctionToolCallOutput -> Encoding)
-> ([FunctionToolCallOutput] -> Value)
-> ([FunctionToolCallOutput] -> Encoding)
-> (FunctionToolCallOutput -> Bool)
-> ToJSON FunctionToolCallOutput
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: FunctionToolCallOutput -> Value
toJSON :: FunctionToolCallOutput -> Value
$ctoEncoding :: FunctionToolCallOutput -> Encoding
toEncoding :: FunctionToolCallOutput -> Encoding
$ctoJSONList :: [FunctionToolCallOutput] -> Value
toJSONList :: [FunctionToolCallOutput] -> Value
$ctoEncodingList :: [FunctionToolCallOutput] -> Encoding
toEncodingList :: [FunctionToolCallOutput] -> Encoding
$comitField :: FunctionToolCallOutput -> Bool
omitField :: FunctionToolCallOutput -> Bool
ToJSON)
data WebSearchToolCall = WebSearchToolCall
{ WebSearchToolCall -> Text
id :: Text
, WebSearchToolCall -> Text
status :: Text
, WebSearchToolCall -> Maybe WebSearchAction
action :: Maybe WebSearchAction
} deriving stock ((forall x. WebSearchToolCall -> Rep WebSearchToolCall x)
-> (forall x. Rep WebSearchToolCall x -> WebSearchToolCall)
-> Generic WebSearchToolCall
forall x. Rep WebSearchToolCall x -> WebSearchToolCall
forall x. WebSearchToolCall -> Rep WebSearchToolCall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WebSearchToolCall -> Rep WebSearchToolCall x
from :: forall x. WebSearchToolCall -> Rep WebSearchToolCall x
$cto :: forall x. Rep WebSearchToolCall x -> WebSearchToolCall
to :: forall x. Rep WebSearchToolCall x -> WebSearchToolCall
Generic, Int -> WebSearchToolCall -> ShowS
[WebSearchToolCall] -> ShowS
WebSearchToolCall -> String
(Int -> WebSearchToolCall -> ShowS)
-> (WebSearchToolCall -> String)
-> ([WebSearchToolCall] -> ShowS)
-> Show WebSearchToolCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WebSearchToolCall -> ShowS
showsPrec :: Int -> WebSearchToolCall -> ShowS
$cshow :: WebSearchToolCall -> String
show :: WebSearchToolCall -> String
$cshowList :: [WebSearchToolCall] -> ShowS
showList :: [WebSearchToolCall] -> ShowS
Show)
instance FromJSON WebSearchToolCall where
parseJSON :: Value -> Parser WebSearchToolCall
parseJSON = Options -> Value -> Parser WebSearchToolCall
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON WebSearchToolCall where
toJSON :: WebSearchToolCall -> Value
toJSON = Options -> WebSearchToolCall -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data FileSearchResult = FileSearchResult
{ FileSearchResult -> Text
file_id :: Text
, FileSearchResult -> Text
text :: Text
, FileSearchResult -> Text
filename :: Text
, FileSearchResult -> Maybe Double
score :: Maybe Double
} deriving stock ((forall x. FileSearchResult -> Rep FileSearchResult x)
-> (forall x. Rep FileSearchResult x -> FileSearchResult)
-> Generic FileSearchResult
forall x. Rep FileSearchResult x -> FileSearchResult
forall x. FileSearchResult -> Rep FileSearchResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FileSearchResult -> Rep FileSearchResult x
from :: forall x. FileSearchResult -> Rep FileSearchResult x
$cto :: forall x. Rep FileSearchResult x -> FileSearchResult
to :: forall x. Rep FileSearchResult x -> FileSearchResult
Generic, Int -> FileSearchResult -> ShowS
[FileSearchResult] -> ShowS
FileSearchResult -> String
(Int -> FileSearchResult -> ShowS)
-> (FileSearchResult -> String)
-> ([FileSearchResult] -> ShowS)
-> Show FileSearchResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FileSearchResult -> ShowS
showsPrec :: Int -> FileSearchResult -> ShowS
$cshow :: FileSearchResult -> String
show :: FileSearchResult -> String
$cshowList :: [FileSearchResult] -> ShowS
showList :: [FileSearchResult] -> ShowS
Show)
deriving anyclass (Maybe FileSearchResult
Value -> Parser [FileSearchResult]
Value -> Parser FileSearchResult
(Value -> Parser FileSearchResult)
-> (Value -> Parser [FileSearchResult])
-> Maybe FileSearchResult
-> FromJSON FileSearchResult
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser FileSearchResult
parseJSON :: Value -> Parser FileSearchResult
$cparseJSONList :: Value -> Parser [FileSearchResult]
parseJSONList :: Value -> Parser [FileSearchResult]
$comittedField :: Maybe FileSearchResult
omittedField :: Maybe FileSearchResult
FromJSON, [FileSearchResult] -> Value
[FileSearchResult] -> Encoding
FileSearchResult -> Bool
FileSearchResult -> Value
FileSearchResult -> Encoding
(FileSearchResult -> Value)
-> (FileSearchResult -> Encoding)
-> ([FileSearchResult] -> Value)
-> ([FileSearchResult] -> Encoding)
-> (FileSearchResult -> Bool)
-> ToJSON FileSearchResult
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: FileSearchResult -> Value
toJSON :: FileSearchResult -> Value
$ctoEncoding :: FileSearchResult -> Encoding
toEncoding :: FileSearchResult -> Encoding
$ctoJSONList :: [FileSearchResult] -> Value
toJSONList :: [FileSearchResult] -> Value
$ctoEncodingList :: [FileSearchResult] -> Encoding
toEncodingList :: [FileSearchResult] -> Encoding
$comitField :: FileSearchResult -> Bool
omitField :: FileSearchResult -> Bool
ToJSON)
data FileSearchToolCall = FileSearchToolCall
{ FileSearchToolCall -> Text
id :: Text
, FileSearchToolCall -> Text
status :: Text
, FileSearchToolCall -> Vector Text
queries :: Vector Text
, FileSearchToolCall -> Maybe (Vector FileSearchResult)
results :: Maybe (Vector FileSearchResult)
} deriving stock ((forall x. FileSearchToolCall -> Rep FileSearchToolCall x)
-> (forall x. Rep FileSearchToolCall x -> FileSearchToolCall)
-> Generic FileSearchToolCall
forall x. Rep FileSearchToolCall x -> FileSearchToolCall
forall x. FileSearchToolCall -> Rep FileSearchToolCall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FileSearchToolCall -> Rep FileSearchToolCall x
from :: forall x. FileSearchToolCall -> Rep FileSearchToolCall x
$cto :: forall x. Rep FileSearchToolCall x -> FileSearchToolCall
to :: forall x. Rep FileSearchToolCall x -> FileSearchToolCall
Generic, Int -> FileSearchToolCall -> ShowS
[FileSearchToolCall] -> ShowS
FileSearchToolCall -> String
(Int -> FileSearchToolCall -> ShowS)
-> (FileSearchToolCall -> String)
-> ([FileSearchToolCall] -> ShowS)
-> Show FileSearchToolCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FileSearchToolCall -> ShowS
showsPrec :: Int -> FileSearchToolCall -> ShowS
$cshow :: FileSearchToolCall -> String
show :: FileSearchToolCall -> String
$cshowList :: [FileSearchToolCall] -> ShowS
showList :: [FileSearchToolCall] -> ShowS
Show)
deriving anyclass (Maybe FileSearchToolCall
Value -> Parser [FileSearchToolCall]
Value -> Parser FileSearchToolCall
(Value -> Parser FileSearchToolCall)
-> (Value -> Parser [FileSearchToolCall])
-> Maybe FileSearchToolCall
-> FromJSON FileSearchToolCall
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser FileSearchToolCall
parseJSON :: Value -> Parser FileSearchToolCall
$cparseJSONList :: Value -> Parser [FileSearchToolCall]
parseJSONList :: Value -> Parser [FileSearchToolCall]
$comittedField :: Maybe FileSearchToolCall
omittedField :: Maybe FileSearchToolCall
FromJSON, [FileSearchToolCall] -> Value
[FileSearchToolCall] -> Encoding
FileSearchToolCall -> Bool
FileSearchToolCall -> Value
FileSearchToolCall -> Encoding
(FileSearchToolCall -> Value)
-> (FileSearchToolCall -> Encoding)
-> ([FileSearchToolCall] -> Value)
-> ([FileSearchToolCall] -> Encoding)
-> (FileSearchToolCall -> Bool)
-> ToJSON FileSearchToolCall
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: FileSearchToolCall -> Value
toJSON :: FileSearchToolCall -> Value
$ctoEncoding :: FileSearchToolCall -> Encoding
toEncoding :: FileSearchToolCall -> Encoding
$ctoJSONList :: [FileSearchToolCall] -> Value
toJSONList :: [FileSearchToolCall] -> Value
$ctoEncodingList :: [FileSearchToolCall] -> Encoding
toEncodingList :: [FileSearchToolCall] -> Encoding
$comitField :: FileSearchToolCall -> Bool
omitField :: FileSearchToolCall -> Bool
ToJSON)
data CodeInterpreterOutput
= CodeInterpreterOutput_Logs{ CodeInterpreterOutput -> Text
logs :: Text }
| CodeInterpreterOutput_Image{ CodeInterpreterOutput -> Text
url :: Text }
deriving stock ((forall x. CodeInterpreterOutput -> Rep CodeInterpreterOutput x)
-> (forall x. Rep CodeInterpreterOutput x -> CodeInterpreterOutput)
-> Generic CodeInterpreterOutput
forall x. Rep CodeInterpreterOutput x -> CodeInterpreterOutput
forall x. CodeInterpreterOutput -> Rep CodeInterpreterOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CodeInterpreterOutput -> Rep CodeInterpreterOutput x
from :: forall x. CodeInterpreterOutput -> Rep CodeInterpreterOutput x
$cto :: forall x. Rep CodeInterpreterOutput x -> CodeInterpreterOutput
to :: forall x. Rep CodeInterpreterOutput x -> CodeInterpreterOutput
Generic, Int -> CodeInterpreterOutput -> ShowS
[CodeInterpreterOutput] -> ShowS
CodeInterpreterOutput -> String
(Int -> CodeInterpreterOutput -> ShowS)
-> (CodeInterpreterOutput -> String)
-> ([CodeInterpreterOutput] -> ShowS)
-> Show CodeInterpreterOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeInterpreterOutput -> ShowS
showsPrec :: Int -> CodeInterpreterOutput -> ShowS
$cshow :: CodeInterpreterOutput -> String
show :: CodeInterpreterOutput -> String
$cshowList :: [CodeInterpreterOutput] -> ShowS
showList :: [CodeInterpreterOutput] -> ShowS
Show)
codeInterpreterOutputOptions :: Options
codeInterpreterOutputOptions :: Options
codeInterpreterOutputOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, constructorTagModifier = stripPrefix "CodeInterpreterOutput_"
}
instance FromJSON CodeInterpreterOutput where
parseJSON :: Value -> Parser CodeInterpreterOutput
parseJSON = Options -> Value -> Parser CodeInterpreterOutput
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
codeInterpreterOutputOptions
instance ToJSON CodeInterpreterOutput where
toJSON :: CodeInterpreterOutput -> Value
toJSON = Options -> CodeInterpreterOutput -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
codeInterpreterOutputOptions
data CodeInterpreterToolCall = CodeInterpreterToolCall
{ CodeInterpreterToolCall -> Text
id :: Text
, CodeInterpreterToolCall -> Text
status :: Text
, CodeInterpreterToolCall -> Maybe Text
container_id :: Maybe Text
, CodeInterpreterToolCall -> Maybe Text
code :: Maybe Text
, CodeInterpreterToolCall -> Maybe (Vector CodeInterpreterOutput)
outputs :: Maybe (Vector CodeInterpreterOutput)
} deriving stock ((forall x.
CodeInterpreterToolCall -> Rep CodeInterpreterToolCall x)
-> (forall x.
Rep CodeInterpreterToolCall x -> CodeInterpreterToolCall)
-> Generic CodeInterpreterToolCall
forall x. Rep CodeInterpreterToolCall x -> CodeInterpreterToolCall
forall x. CodeInterpreterToolCall -> Rep CodeInterpreterToolCall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CodeInterpreterToolCall -> Rep CodeInterpreterToolCall x
from :: forall x. CodeInterpreterToolCall -> Rep CodeInterpreterToolCall x
$cto :: forall x. Rep CodeInterpreterToolCall x -> CodeInterpreterToolCall
to :: forall x. Rep CodeInterpreterToolCall x -> CodeInterpreterToolCall
Generic, Int -> CodeInterpreterToolCall -> ShowS
[CodeInterpreterToolCall] -> ShowS
CodeInterpreterToolCall -> String
(Int -> CodeInterpreterToolCall -> ShowS)
-> (CodeInterpreterToolCall -> String)
-> ([CodeInterpreterToolCall] -> ShowS)
-> Show CodeInterpreterToolCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeInterpreterToolCall -> ShowS
showsPrec :: Int -> CodeInterpreterToolCall -> ShowS
$cshow :: CodeInterpreterToolCall -> String
show :: CodeInterpreterToolCall -> String
$cshowList :: [CodeInterpreterToolCall] -> ShowS
showList :: [CodeInterpreterToolCall] -> ShowS
Show)
deriving anyclass (Maybe CodeInterpreterToolCall
Value -> Parser [CodeInterpreterToolCall]
Value -> Parser CodeInterpreterToolCall
(Value -> Parser CodeInterpreterToolCall)
-> (Value -> Parser [CodeInterpreterToolCall])
-> Maybe CodeInterpreterToolCall
-> FromJSON CodeInterpreterToolCall
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CodeInterpreterToolCall
parseJSON :: Value -> Parser CodeInterpreterToolCall
$cparseJSONList :: Value -> Parser [CodeInterpreterToolCall]
parseJSONList :: Value -> Parser [CodeInterpreterToolCall]
$comittedField :: Maybe CodeInterpreterToolCall
omittedField :: Maybe CodeInterpreterToolCall
FromJSON, [CodeInterpreterToolCall] -> Value
[CodeInterpreterToolCall] -> Encoding
CodeInterpreterToolCall -> Bool
CodeInterpreterToolCall -> Value
CodeInterpreterToolCall -> Encoding
(CodeInterpreterToolCall -> Value)
-> (CodeInterpreterToolCall -> Encoding)
-> ([CodeInterpreterToolCall] -> Value)
-> ([CodeInterpreterToolCall] -> Encoding)
-> (CodeInterpreterToolCall -> Bool)
-> ToJSON CodeInterpreterToolCall
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CodeInterpreterToolCall -> Value
toJSON :: CodeInterpreterToolCall -> Value
$ctoEncoding :: CodeInterpreterToolCall -> Encoding
toEncoding :: CodeInterpreterToolCall -> Encoding
$ctoJSONList :: [CodeInterpreterToolCall] -> Value
toJSONList :: [CodeInterpreterToolCall] -> Value
$ctoEncodingList :: [CodeInterpreterToolCall] -> Encoding
toEncodingList :: [CodeInterpreterToolCall] -> Encoding
$comitField :: CodeInterpreterToolCall -> Bool
omitField :: CodeInterpreterToolCall -> Bool
ToJSON)
data WebSearchSource = WebSearchSource_URL{ WebSearchSource -> Text
url :: Text }
deriving stock ((forall x. WebSearchSource -> Rep WebSearchSource x)
-> (forall x. Rep WebSearchSource x -> WebSearchSource)
-> Generic WebSearchSource
forall x. Rep WebSearchSource x -> WebSearchSource
forall x. WebSearchSource -> Rep WebSearchSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WebSearchSource -> Rep WebSearchSource x
from :: forall x. WebSearchSource -> Rep WebSearchSource x
$cto :: forall x. Rep WebSearchSource x -> WebSearchSource
to :: forall x. Rep WebSearchSource x -> WebSearchSource
Generic, Int -> WebSearchSource -> ShowS
[WebSearchSource] -> ShowS
WebSearchSource -> String
(Int -> WebSearchSource -> ShowS)
-> (WebSearchSource -> String)
-> ([WebSearchSource] -> ShowS)
-> Show WebSearchSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WebSearchSource -> ShowS
showsPrec :: Int -> WebSearchSource -> ShowS
$cshow :: WebSearchSource -> String
show :: WebSearchSource -> String
$cshowList :: [WebSearchSource] -> ShowS
showList :: [WebSearchSource] -> ShowS
Show)
webSearchSourceOptions :: Options
webSearchSourceOptions :: Options
webSearchSourceOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, constructorTagModifier = stripPrefix "WebSearchSource_"
}
instance FromJSON WebSearchSource where
parseJSON :: Value -> Parser WebSearchSource
parseJSON = Options -> Value -> Parser WebSearchSource
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
webSearchSourceOptions
instance ToJSON WebSearchSource where
toJSON :: WebSearchSource -> Value
toJSON = Options -> WebSearchSource -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
webSearchSourceOptions
data WebSearchAction
= WebSearchAction_Search
{ WebSearchAction -> Maybe Text
query :: Maybe Text
, WebSearchAction -> Maybe (Vector WebSearchSource)
sources :: Maybe (Vector WebSearchSource)
}
| WebSearchAction_Open_Page
{ WebSearchAction -> Maybe Text
url :: Maybe Text }
| WebSearchAction_Find
{ url :: Maybe Text
, WebSearchAction -> Maybe Text
pattern :: Maybe Text
}
deriving stock ((forall x. WebSearchAction -> Rep WebSearchAction x)
-> (forall x. Rep WebSearchAction x -> WebSearchAction)
-> Generic WebSearchAction
forall x. Rep WebSearchAction x -> WebSearchAction
forall x. WebSearchAction -> Rep WebSearchAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WebSearchAction -> Rep WebSearchAction x
from :: forall x. WebSearchAction -> Rep WebSearchAction x
$cto :: forall x. Rep WebSearchAction x -> WebSearchAction
to :: forall x. Rep WebSearchAction x -> WebSearchAction
Generic, Int -> WebSearchAction -> ShowS
[WebSearchAction] -> ShowS
WebSearchAction -> String
(Int -> WebSearchAction -> ShowS)
-> (WebSearchAction -> String)
-> ([WebSearchAction] -> ShowS)
-> Show WebSearchAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WebSearchAction -> ShowS
showsPrec :: Int -> WebSearchAction -> ShowS
$cshow :: WebSearchAction -> String
show :: WebSearchAction -> String
$cshowList :: [WebSearchAction] -> ShowS
showList :: [WebSearchAction] -> ShowS
Show)
webSearchActionOptions :: Options
webSearchActionOptions :: Options
webSearchActionOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, constructorTagModifier = stripPrefix "WebSearchAction_"
}
instance FromJSON WebSearchAction where
parseJSON :: Value -> Parser WebSearchAction
parseJSON = Options -> Value -> Parser WebSearchAction
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
webSearchActionOptions
instance ToJSON WebSearchAction where
toJSON :: WebSearchAction -> Value
toJSON = Options -> WebSearchAction -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
webSearchActionOptions
data Annotation
= Annotation_File_Citation
{ Annotation -> Text
file_id :: Text
, Annotation -> Natural
index :: Natural
, Annotation -> Text
filename :: Text
}
| Annotation_Url_Citation
{ Annotation -> Text
url :: Text
, Annotation -> Natural
start_index :: Natural
, Annotation -> Natural
end_index :: Natural
, Annotation -> Text
title :: Text
}
| Annotation_Container_File_Citation
{ Annotation -> Text
container_id :: Text
, file_id :: Text
, start_index :: Natural
, end_index :: Natural
, filename :: Text
}
| Annotation_File_Path
{ file_id :: Text
, index :: Natural
}
deriving stock ((forall x. Annotation -> Rep Annotation x)
-> (forall x. Rep Annotation x -> Annotation) -> Generic Annotation
forall x. Rep Annotation x -> Annotation
forall x. Annotation -> Rep Annotation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Annotation -> Rep Annotation x
from :: forall x. Annotation -> Rep Annotation x
$cto :: forall x. Rep Annotation x -> Annotation
to :: forall x. Rep Annotation x -> Annotation
Generic, Int -> Annotation -> ShowS
[Annotation] -> ShowS
Annotation -> String
(Int -> Annotation -> ShowS)
-> (Annotation -> String)
-> ([Annotation] -> ShowS)
-> Show Annotation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Annotation -> ShowS
showsPrec :: Int -> Annotation -> ShowS
$cshow :: Annotation -> String
show :: Annotation -> String
$cshowList :: [Annotation] -> ShowS
showList :: [Annotation] -> ShowS
Show)
annotationOptions :: Options
annotationOptions :: Options
annotationOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, constructorTagModifier = stripPrefix "Annotation_"
}
instance FromJSON Annotation where
parseJSON :: Value -> Parser Annotation
parseJSON = Options -> Value -> Parser Annotation
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
annotationOptions
instance ToJSON Annotation where
toJSON :: Annotation -> Value
toJSON = Options -> Annotation -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
annotationOptions
data SummaryPart = Summary_Text{ SummaryPart -> Text
text :: Text }
deriving stock (SummaryPart -> SummaryPart -> Bool
(SummaryPart -> SummaryPart -> Bool)
-> (SummaryPart -> SummaryPart -> Bool) -> Eq SummaryPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SummaryPart -> SummaryPart -> Bool
== :: SummaryPart -> SummaryPart -> Bool
$c/= :: SummaryPart -> SummaryPart -> Bool
/= :: SummaryPart -> SummaryPart -> Bool
Eq, (forall x. SummaryPart -> Rep SummaryPart x)
-> (forall x. Rep SummaryPart x -> SummaryPart)
-> Generic SummaryPart
forall x. Rep SummaryPart x -> SummaryPart
forall x. SummaryPart -> Rep SummaryPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SummaryPart -> Rep SummaryPart x
from :: forall x. SummaryPart -> Rep SummaryPart x
$cto :: forall x. Rep SummaryPart x -> SummaryPart
to :: forall x. Rep SummaryPart x -> SummaryPart
Generic, Int -> SummaryPart -> ShowS
[SummaryPart] -> ShowS
SummaryPart -> String
(Int -> SummaryPart -> ShowS)
-> (SummaryPart -> String)
-> ([SummaryPart] -> ShowS)
-> Show SummaryPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SummaryPart -> ShowS
showsPrec :: Int -> SummaryPart -> ShowS
$cshow :: SummaryPart -> String
show :: SummaryPart -> String
$cshowList :: [SummaryPart] -> ShowS
showList :: [SummaryPart] -> ShowS
Show)
summaryPartOptions :: Options
summaryPartOptions :: Options
summaryPartOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
}
instance FromJSON SummaryPart where
parseJSON :: Value -> Parser SummaryPart
parseJSON = Options -> Value -> Parser SummaryPart
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
summaryPartOptions
instance ToJSON SummaryPart where
toJSON :: SummaryPart -> Value
toJSON = Options -> SummaryPart -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
summaryPartOptions
data ReasoningText = Reasoning_Text{ ReasoningText -> Text
text :: Text }
deriving stock (ReasoningText -> ReasoningText -> Bool
(ReasoningText -> ReasoningText -> Bool)
-> (ReasoningText -> ReasoningText -> Bool) -> Eq ReasoningText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReasoningText -> ReasoningText -> Bool
== :: ReasoningText -> ReasoningText -> Bool
$c/= :: ReasoningText -> ReasoningText -> Bool
/= :: ReasoningText -> ReasoningText -> Bool
Eq, (forall x. ReasoningText -> Rep ReasoningText x)
-> (forall x. Rep ReasoningText x -> ReasoningText)
-> Generic ReasoningText
forall x. Rep ReasoningText x -> ReasoningText
forall x. ReasoningText -> Rep ReasoningText x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReasoningText -> Rep ReasoningText x
from :: forall x. ReasoningText -> Rep ReasoningText x
$cto :: forall x. Rep ReasoningText x -> ReasoningText
to :: forall x. Rep ReasoningText x -> ReasoningText
Generic, Int -> ReasoningText -> ShowS
[ReasoningText] -> ShowS
ReasoningText -> String
(Int -> ReasoningText -> ShowS)
-> (ReasoningText -> String)
-> ([ReasoningText] -> ShowS)
-> Show ReasoningText
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReasoningText -> ShowS
showsPrec :: Int -> ReasoningText -> ShowS
$cshow :: ReasoningText -> String
show :: ReasoningText -> String
$cshowList :: [ReasoningText] -> ShowS
showList :: [ReasoningText] -> ShowS
Show)
reasoningTextOptions :: Options
reasoningTextOptions :: Options
reasoningTextOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
}
instance FromJSON ReasoningText where
parseJSON :: Value -> Parser ReasoningText
parseJSON = Options -> Value -> Parser ReasoningText
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
reasoningTextOptions
instance ToJSON ReasoningText where
toJSON :: ReasoningText -> Value
toJSON = Options -> ReasoningText -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
reasoningTextOptions
data ReasoningItem = ReasoningItem
{ ReasoningItem -> Text
id :: Text
, ReasoningItem -> Maybe Text
encrypted_content :: Maybe Text
, ReasoningItem -> Maybe (Vector SummaryPart)
summary :: Maybe (Vector SummaryPart)
, ReasoningItem -> Maybe (Vector ReasoningText)
content :: Maybe (Vector ReasoningText)
, ReasoningItem -> Maybe Text
status :: Maybe Text
} deriving stock (ReasoningItem -> ReasoningItem -> Bool
(ReasoningItem -> ReasoningItem -> Bool)
-> (ReasoningItem -> ReasoningItem -> Bool) -> Eq ReasoningItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReasoningItem -> ReasoningItem -> Bool
== :: ReasoningItem -> ReasoningItem -> Bool
$c/= :: ReasoningItem -> ReasoningItem -> Bool
/= :: ReasoningItem -> ReasoningItem -> Bool
Eq, (forall x. ReasoningItem -> Rep ReasoningItem x)
-> (forall x. Rep ReasoningItem x -> ReasoningItem)
-> Generic ReasoningItem
forall x. Rep ReasoningItem x -> ReasoningItem
forall x. ReasoningItem -> Rep ReasoningItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReasoningItem -> Rep ReasoningItem x
from :: forall x. ReasoningItem -> Rep ReasoningItem x
$cto :: forall x. Rep ReasoningItem x -> ReasoningItem
to :: forall x. Rep ReasoningItem x -> ReasoningItem
Generic, Int -> ReasoningItem -> ShowS
[ReasoningItem] -> ShowS
ReasoningItem -> String
(Int -> ReasoningItem -> ShowS)
-> (ReasoningItem -> String)
-> ([ReasoningItem] -> ShowS)
-> Show ReasoningItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReasoningItem -> ShowS
showsPrec :: Int -> ReasoningItem -> ShowS
$cshow :: ReasoningItem -> String
show :: ReasoningItem -> String
$cshowList :: [ReasoningItem] -> ShowS
showList :: [ReasoningItem] -> ShowS
Show)
instance FromJSON ReasoningItem where
parseJSON :: Value -> Parser ReasoningItem
parseJSON = Options -> Value -> Parser ReasoningItem
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance ToJSON ReasoningItem where
toJSON :: ReasoningItem -> Value
toJSON = Options -> ReasoningItem -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions
data ResponseStreamEvent
= ResponseCreatedEvent
{ ResponseStreamEvent -> ResponseObject
response :: ResponseObject
, ResponseStreamEvent -> Natural
sequence_number :: Natural
}
| ResponseInProgressEvent
{ response :: ResponseObject
, sequence_number :: Natural
}
| ResponseCompletedEvent
{ response :: ResponseObject
, sequence_number :: Natural
}
| ResponseFailedEvent
{ response :: ResponseObject
, sequence_number :: Natural
}
| ResponseOutputItemAddedEvent
{ ResponseStreamEvent -> Natural
output_index :: Natural
, ResponseStreamEvent -> OutputItem
item :: OutputItem
, sequence_number :: Natural
}
| ResponseOutputItemDoneEvent
{ output_index :: Natural
, sequence_number :: Natural
}
| ResponseContentPartAddedEvent
{ ResponseStreamEvent -> Text
item_id :: Text
, output_index :: Natural
, ResponseStreamEvent -> Natural
content_index :: Natural
, ResponseStreamEvent -> OutputContent
part :: OutputContent
, sequence_number :: Natural
}
| ResponseContentPartDoneEvent
{ item_id :: Text
, output_index :: Natural
, content_index :: Natural
, part :: OutputContent
, sequence_number :: Natural
}
| ResponseTextDeltaEvent
{ item_id :: Text
, output_index :: Natural
, content_index :: Natural
, ResponseStreamEvent -> Text
delta :: Text
, sequence_number :: Natural
}
| ResponseTextDoneEvent
{ item_id :: Text
, output_index :: Natural
, content_index :: Natural
, ResponseStreamEvent -> Text
text :: Text
, sequence_number :: Natural
}
| ResponseOutputTextAnnotationAddedEvent
{ item_id :: Text
, output_index :: Natural
, content_index :: Natural
, ResponseStreamEvent -> Natural
annotation_index :: Natural
, ResponseStreamEvent -> Annotation
annotation :: Annotation
, sequence_number :: Natural
}
| ResponseWebSearchCallInProgressEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseWebSearchCallSearchingEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseWebSearchCallCompletedEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseFileSearchCallInProgressEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseFileSearchCallSearchingEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseFileSearchCallCompletedEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseCodeInterpreterCallInProgressEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseCodeInterpreterCallInterpretingEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseCodeInterpreterCallCompletedEvent
{ output_index :: Natural
, item_id :: Text
, sequence_number :: Natural
}
| ResponseCodeInterpreterCallCodeDeltaEvent
{ output_index :: Natural
, item_id :: Text
, delta :: Text
, sequence_number :: Natural
}
| ResponseCodeInterpreterCallCodeDoneEvent
{ output_index :: Natural
, item_id :: Text
, ResponseStreamEvent -> Text
code :: Text
, sequence_number :: Natural
}
| ErrorEvent
{ ResponseStreamEvent -> Maybe Text
error_code :: Maybe Text
, ResponseStreamEvent -> Text
error_message :: Text
, ResponseStreamEvent -> Maybe Text
error_param :: Maybe Text
, ResponseStreamEvent -> Natural
error_sequence_number :: Natural
}
deriving stock ((forall x. ResponseStreamEvent -> Rep ResponseStreamEvent x)
-> (forall x. Rep ResponseStreamEvent x -> ResponseStreamEvent)
-> Generic ResponseStreamEvent
forall x. Rep ResponseStreamEvent x -> ResponseStreamEvent
forall x. ResponseStreamEvent -> Rep ResponseStreamEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ResponseStreamEvent -> Rep ResponseStreamEvent x
from :: forall x. ResponseStreamEvent -> Rep ResponseStreamEvent x
$cto :: forall x. Rep ResponseStreamEvent x -> ResponseStreamEvent
to :: forall x. Rep ResponseStreamEvent x -> ResponseStreamEvent
Generic, Int -> ResponseStreamEvent -> ShowS
[ResponseStreamEvent] -> ShowS
ResponseStreamEvent -> String
(Int -> ResponseStreamEvent -> ShowS)
-> (ResponseStreamEvent -> String)
-> ([ResponseStreamEvent] -> ShowS)
-> Show ResponseStreamEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResponseStreamEvent -> ShowS
showsPrec :: Int -> ResponseStreamEvent -> ShowS
$cshow :: ResponseStreamEvent -> String
show :: ResponseStreamEvent -> String
$cshowList :: [ResponseStreamEvent] -> ShowS
showList :: [ResponseStreamEvent] -> ShowS
Show)
responseStreamEventOptions :: Options
responseStreamEventOptions :: Options
responseStreamEventOptions = Options
aesonOptions
{ sumEncoding = TaggedObject{ tagFieldName = "type", contentsFieldName = "" }
, tagSingleConstructors = True
, fieldLabelModifier = \String
s -> case String
s of
String
"error_code" -> String
"code"
String
"error_message" -> String
"message"
String
"error_param" -> String
"param"
String
"error_sequence_number" -> String
"sequence_number"
String
other -> String
other
, constructorTagModifier = \String
s -> case String
s of
String
"ResponseCreatedEvent" -> String
"response.created"
String
"ResponseInProgressEvent" -> String
"response.in_progress"
String
"ResponseCompletedEvent" -> String
"response.completed"
String
"ResponseFailedEvent" -> String
"response.failed"
String
"ResponseOutputItemAddedEvent" -> String
"response.output_item.added"
String
"ResponseOutputItemDoneEvent" -> String
"response.output_item.done"
String
"ResponseContentPartAddedEvent" -> String
"response.content_part.added"
String
"ResponseContentPartDoneEvent" -> String
"response.content_part.done"
String
"ResponseTextDeltaEvent" -> String
"response.output_text.delta"
String
"ResponseTextDoneEvent" -> String
"response.output_text.done"
String
"ResponseOutputTextAnnotationAddedEvent" -> String
"response.output_text.annotation.added"
String
"ResponseWebSearchCallInProgressEvent" -> String
"response.web_search_call.in_progress"
String
"ResponseWebSearchCallSearchingEvent" -> String
"response.web_search_call.searching"
String
"ResponseWebSearchCallCompletedEvent" -> String
"response.web_search_call.completed"
String
"ResponseFileSearchCallInProgressEvent" -> String
"response.file_search_call.in_progress"
String
"ResponseFileSearchCallSearchingEvent" -> String
"response.file_search_call.searching"
String
"ResponseFileSearchCallCompletedEvent" -> String
"response.file_search_call.completed"
String
"ResponseCodeInterpreterCallInProgressEvent" -> String
"response.code_interpreter_call.in_progress"
String
"ResponseCodeInterpreterCallInterpretingEvent" -> String
"response.code_interpreter_call.interpreting"
String
"ResponseCodeInterpreterCallCompletedEvent" -> String
"response.code_interpreter_call.completed"
String
"ResponseCodeInterpreterCallCodeDeltaEvent" -> String
"response.code_interpreter_call_code.delta"
String
"ResponseCodeInterpreterCallCodeDoneEvent" -> String
"response.code_interpreter_call_code.done"
String
"ErrorEvent" -> String
"error"
String
_ -> ShowS
forall a. HasCallStack => String -> a
Prelude.error String
"Unknown ResponseStreamEvent constructor"
}
instance FromJSON ResponseStreamEvent where
parseJSON :: Value -> Parser ResponseStreamEvent
parseJSON = Options -> Value -> Parser ResponseStreamEvent
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
responseStreamEventOptions
instance ToJSON ResponseStreamEvent where
toJSON :: ResponseStreamEvent -> Value
toJSON = Options -> ResponseStreamEvent -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
responseStreamEventOptions
data ResponseUsage = ResponseUsage
{ ResponseUsage -> Natural
input_tokens :: Natural
, ResponseUsage -> InputTokensDetails
input_tokens_details :: InputTokensDetails
, ResponseUsage -> Natural
output_tokens :: Natural
, ResponseUsage -> OutputTokensDetails
output_tokens_details :: OutputTokensDetails
, ResponseUsage -> Natural
total_tokens :: Natural
} deriving stock ((forall x. ResponseUsage -> Rep ResponseUsage x)
-> (forall x. Rep ResponseUsage x -> ResponseUsage)
-> Generic ResponseUsage
forall x. Rep ResponseUsage x -> ResponseUsage
forall x. ResponseUsage -> Rep ResponseUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ResponseUsage -> Rep ResponseUsage x
from :: forall x. ResponseUsage -> Rep ResponseUsage x
$cto :: forall x. Rep ResponseUsage x -> ResponseUsage
to :: forall x. Rep ResponseUsage x -> ResponseUsage
Generic, Int -> ResponseUsage -> ShowS
[ResponseUsage] -> ShowS
ResponseUsage -> String
(Int -> ResponseUsage -> ShowS)
-> (ResponseUsage -> String)
-> ([ResponseUsage] -> ShowS)
-> Show ResponseUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResponseUsage -> ShowS
showsPrec :: Int -> ResponseUsage -> ShowS
$cshow :: ResponseUsage -> String
show :: ResponseUsage -> String
$cshowList :: [ResponseUsage] -> ShowS
showList :: [ResponseUsage] -> ShowS
Show)
deriving anyclass (Maybe ResponseUsage
Value -> Parser [ResponseUsage]
Value -> Parser ResponseUsage
(Value -> Parser ResponseUsage)
-> (Value -> Parser [ResponseUsage])
-> Maybe ResponseUsage
-> FromJSON ResponseUsage
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ResponseUsage
parseJSON :: Value -> Parser ResponseUsage
$cparseJSONList :: Value -> Parser [ResponseUsage]
parseJSONList :: Value -> Parser [ResponseUsage]
$comittedField :: Maybe ResponseUsage
omittedField :: Maybe ResponseUsage
FromJSON, [ResponseUsage] -> Value
[ResponseUsage] -> Encoding
ResponseUsage -> Bool
ResponseUsage -> Value
ResponseUsage -> Encoding
(ResponseUsage -> Value)
-> (ResponseUsage -> Encoding)
-> ([ResponseUsage] -> Value)
-> ([ResponseUsage] -> Encoding)
-> (ResponseUsage -> Bool)
-> ToJSON ResponseUsage
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ResponseUsage -> Value
toJSON :: ResponseUsage -> Value
$ctoEncoding :: ResponseUsage -> Encoding
toEncoding :: ResponseUsage -> Encoding
$ctoJSONList :: [ResponseUsage] -> Value
toJSONList :: [ResponseUsage] -> Value
$ctoEncodingList :: [ResponseUsage] -> Encoding
toEncodingList :: [ResponseUsage] -> Encoding
$comitField :: ResponseUsage -> Bool
omitField :: ResponseUsage -> Bool
ToJSON)
data InputTokensDetails = InputTokensDetails
{ InputTokensDetails -> Natural
cached_tokens :: Natural
} deriving stock ((forall x. InputTokensDetails -> Rep InputTokensDetails x)
-> (forall x. Rep InputTokensDetails x -> InputTokensDetails)
-> Generic InputTokensDetails
forall x. Rep InputTokensDetails x -> InputTokensDetails
forall x. InputTokensDetails -> Rep InputTokensDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InputTokensDetails -> Rep InputTokensDetails x
from :: forall x. InputTokensDetails -> Rep InputTokensDetails x
$cto :: forall x. Rep InputTokensDetails x -> InputTokensDetails
to :: forall x. Rep InputTokensDetails x -> InputTokensDetails
Generic, Int -> InputTokensDetails -> ShowS
[InputTokensDetails] -> ShowS
InputTokensDetails -> String
(Int -> InputTokensDetails -> ShowS)
-> (InputTokensDetails -> String)
-> ([InputTokensDetails] -> ShowS)
-> Show InputTokensDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputTokensDetails -> ShowS
showsPrec :: Int -> InputTokensDetails -> ShowS
$cshow :: InputTokensDetails -> String
show :: InputTokensDetails -> String
$cshowList :: [InputTokensDetails] -> ShowS
showList :: [InputTokensDetails] -> ShowS
Show)
deriving anyclass (Maybe InputTokensDetails
Value -> Parser [InputTokensDetails]
Value -> Parser InputTokensDetails
(Value -> Parser InputTokensDetails)
-> (Value -> Parser [InputTokensDetails])
-> Maybe InputTokensDetails
-> FromJSON InputTokensDetails
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser InputTokensDetails
parseJSON :: Value -> Parser InputTokensDetails
$cparseJSONList :: Value -> Parser [InputTokensDetails]
parseJSONList :: Value -> Parser [InputTokensDetails]
$comittedField :: Maybe InputTokensDetails
omittedField :: Maybe InputTokensDetails
FromJSON, [InputTokensDetails] -> Value
[InputTokensDetails] -> Encoding
InputTokensDetails -> Bool
InputTokensDetails -> Value
InputTokensDetails -> Encoding
(InputTokensDetails -> Value)
-> (InputTokensDetails -> Encoding)
-> ([InputTokensDetails] -> Value)
-> ([InputTokensDetails] -> Encoding)
-> (InputTokensDetails -> Bool)
-> ToJSON InputTokensDetails
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: InputTokensDetails -> Value
toJSON :: InputTokensDetails -> Value
$ctoEncoding :: InputTokensDetails -> Encoding
toEncoding :: InputTokensDetails -> Encoding
$ctoJSONList :: [InputTokensDetails] -> Value
toJSONList :: [InputTokensDetails] -> Value
$ctoEncodingList :: [InputTokensDetails] -> Encoding
toEncodingList :: [InputTokensDetails] -> Encoding
$comitField :: InputTokensDetails -> Bool
omitField :: InputTokensDetails -> Bool
ToJSON)
data OutputTokensDetails = OutputTokensDetails
{ OutputTokensDetails -> Natural
reasoning_tokens :: Natural
} deriving stock ((forall x. OutputTokensDetails -> Rep OutputTokensDetails x)
-> (forall x. Rep OutputTokensDetails x -> OutputTokensDetails)
-> Generic OutputTokensDetails
forall x. Rep OutputTokensDetails x -> OutputTokensDetails
forall x. OutputTokensDetails -> Rep OutputTokensDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OutputTokensDetails -> Rep OutputTokensDetails x
from :: forall x. OutputTokensDetails -> Rep OutputTokensDetails x
$cto :: forall x. Rep OutputTokensDetails x -> OutputTokensDetails
to :: forall x. Rep OutputTokensDetails x -> OutputTokensDetails
Generic, Int -> OutputTokensDetails -> ShowS
[OutputTokensDetails] -> ShowS
OutputTokensDetails -> String
(Int -> OutputTokensDetails -> ShowS)
-> (OutputTokensDetails -> String)
-> ([OutputTokensDetails] -> ShowS)
-> Show OutputTokensDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OutputTokensDetails -> ShowS
showsPrec :: Int -> OutputTokensDetails -> ShowS
$cshow :: OutputTokensDetails -> String
show :: OutputTokensDetails -> String
$cshowList :: [OutputTokensDetails] -> ShowS
showList :: [OutputTokensDetails] -> ShowS
Show)
deriving anyclass (Maybe OutputTokensDetails
Value -> Parser [OutputTokensDetails]
Value -> Parser OutputTokensDetails
(Value -> Parser OutputTokensDetails)
-> (Value -> Parser [OutputTokensDetails])
-> Maybe OutputTokensDetails
-> FromJSON OutputTokensDetails
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser OutputTokensDetails
parseJSON :: Value -> Parser OutputTokensDetails
$cparseJSONList :: Value -> Parser [OutputTokensDetails]
parseJSONList :: Value -> Parser [OutputTokensDetails]
$comittedField :: Maybe OutputTokensDetails
omittedField :: Maybe OutputTokensDetails
FromJSON, [OutputTokensDetails] -> Value
[OutputTokensDetails] -> Encoding
OutputTokensDetails -> Bool
OutputTokensDetails -> Value
OutputTokensDetails -> Encoding
(OutputTokensDetails -> Value)
-> (OutputTokensDetails -> Encoding)
-> ([OutputTokensDetails] -> Value)
-> ([OutputTokensDetails] -> Encoding)
-> (OutputTokensDetails -> Bool)
-> ToJSON OutputTokensDetails
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: OutputTokensDetails -> Value
toJSON :: OutputTokensDetails -> Value
$ctoEncoding :: OutputTokensDetails -> Encoding
toEncoding :: OutputTokensDetails -> Encoding
$ctoJSONList :: [OutputTokensDetails] -> Value
toJSONList :: [OutputTokensDetails] -> Value
$ctoEncodingList :: [OutputTokensDetails] -> Encoding
toEncodingList :: [OutputTokensDetails] -> Encoding
$comitField :: OutputTokensDetails -> Bool
omitField :: OutputTokensDetails -> Bool
ToJSON)
data ResponseObject = ResponseObject
{ ResponseObject -> Text
id :: Text
, ResponseObject -> Text
object :: Text
, ResponseObject -> POSIXTime
created_at :: POSIXTime
, ResponseObject -> Text
status :: Text
, ResponseObject -> Maybe Value
error :: Maybe Value
, ResponseObject -> Maybe Value
incomplete_details :: Maybe Value
, ResponseObject -> Maybe Value
instructions :: Maybe Value
, ResponseObject -> Model
model :: Model
, ResponseObject -> Vector OutputItem
output :: Vector OutputItem
, ResponseObject -> Bool
parallel_tool_calls :: Bool
, ResponseObject -> Maybe Text
previous_response_id :: Maybe Text
, ResponseObject -> Maybe Reasoning
reasoning :: Maybe Reasoning
, ResponseObject -> Maybe Text
service_tier :: Maybe ServiceTier
, ResponseObject -> Maybe Bool
store :: Maybe Bool
, ResponseObject -> Maybe Double
temperature :: Maybe Double
, ResponseObject -> Maybe ToolChoice
tool_choice :: Maybe ToolChoice
, ResponseObject -> Maybe (Vector Tool)
tools :: Maybe (Vector Tool)
, ResponseObject -> Maybe Double
top_p :: Maybe Double
, ResponseObject -> Maybe Text
truncation :: Maybe Text
, ResponseObject -> Maybe ResponseUsage
usage :: Maybe ResponseUsage
, ResponseObject -> Maybe Text
user :: Maybe Text
, ResponseObject -> Maybe (Map Text Text)
metadata :: Maybe (Map Text Text)
} deriving stock ((forall x. ResponseObject -> Rep ResponseObject x)
-> (forall x. Rep ResponseObject x -> ResponseObject)
-> Generic ResponseObject
forall x. Rep ResponseObject x -> ResponseObject
forall x. ResponseObject -> Rep ResponseObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ResponseObject -> Rep ResponseObject x
from :: forall x. ResponseObject -> Rep ResponseObject x
$cto :: forall x. Rep ResponseObject x -> ResponseObject
to :: forall x. Rep ResponseObject x -> ResponseObject
Generic, Int -> ResponseObject -> ShowS
[ResponseObject] -> ShowS
ResponseObject -> String
(Int -> ResponseObject -> ShowS)
-> (ResponseObject -> String)
-> ([ResponseObject] -> ShowS)
-> Show ResponseObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResponseObject -> ShowS
showsPrec :: Int -> ResponseObject -> ShowS
$cshow :: ResponseObject -> String
show :: ResponseObject -> String
$cshowList :: [ResponseObject] -> ShowS
showList :: [ResponseObject] -> ShowS
Show)
instance FromJSON ResponseObject where
parseJSON :: Value -> Parser ResponseObject
parseJSON (Aeson.Object Object
o) =
Options -> Value -> Parser ResponseObject
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions (Object -> Value
Aeson.Object (Object -> Object
unflattenResponseToolFields Object
o))
parseJSON Value
other = Options -> Value -> Parser ResponseObject
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions Value
other
instance ToJSON ResponseObject where
toJSON :: ResponseObject -> Value
toJSON response :: ResponseObject
response@ResponseObject{ tools :: ResponseObject -> Maybe (Vector Tool)
tools = Maybe (Vector Tool)
mTools, tool_choice :: ResponseObject -> Maybe ToolChoice
tool_choice = Maybe ToolChoice
mChoice } =
case Options -> ResponseObject -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions ResponseObject
response of
Aeson.Object Object
o ->
Object -> Value
Aeson.Object
(Maybe (Vector Tool) -> Maybe ToolChoice -> Object -> Object
flattenResponseToolFields Maybe (Vector Tool)
mTools Maybe ToolChoice
mChoice Object
o)
Value
other -> Value
other
data CreateResponse = CreateResponse
{ CreateResponse -> Model
model :: Model
, CreateResponse -> Maybe Input
input :: Maybe Input
, CreateResponse -> Maybe (Vector Text)
include :: Maybe (Vector Text)
, CreateResponse -> Maybe Reasoning
reasoning :: Maybe Reasoning
, CreateResponse -> Maybe (AutoOr Text)
service_tier :: Maybe (AutoOr ServiceTier)
, CreateResponse -> Maybe Bool
parallel_tool_calls :: Maybe Bool
, CreateResponse -> Maybe Bool
store :: Maybe Bool
, CreateResponse -> Maybe Text
instructions :: Maybe Text
, CreateResponse -> Maybe Bool
stream :: Maybe Bool
, CreateResponse -> Maybe Value
stream_options :: Maybe Value
, CreateResponse -> Maybe (Map Text Text)
metadata :: Maybe (Map Text Text)
, CreateResponse -> Maybe Double
temperature :: Maybe Double
, CreateResponse -> Maybe Double
top_p :: Maybe Double
, CreateResponse -> Maybe (Vector Tool)
tools :: Maybe (Vector Tool)
, CreateResponse -> Maybe ToolChoice
tool_choice :: Maybe ToolChoice
} deriving stock ((forall x. CreateResponse -> Rep CreateResponse x)
-> (forall x. Rep CreateResponse x -> CreateResponse)
-> Generic CreateResponse
forall x. Rep CreateResponse x -> CreateResponse
forall x. CreateResponse -> Rep CreateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CreateResponse -> Rep CreateResponse x
from :: forall x. CreateResponse -> Rep CreateResponse x
$cto :: forall x. Rep CreateResponse x -> CreateResponse
to :: forall x. Rep CreateResponse x -> CreateResponse
Generic, Int -> CreateResponse -> ShowS
[CreateResponse] -> ShowS
CreateResponse -> String
(Int -> CreateResponse -> ShowS)
-> (CreateResponse -> String)
-> ([CreateResponse] -> ShowS)
-> Show CreateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateResponse -> ShowS
showsPrec :: Int -> CreateResponse -> ShowS
$cshow :: CreateResponse -> String
show :: CreateResponse -> String
$cshowList :: [CreateResponse] -> ShowS
showList :: [CreateResponse] -> ShowS
Show)
instance FromJSON CreateResponse where
parseJSON :: Value -> Parser CreateResponse
parseJSON (Aeson.Object Object
o) =
Options -> Value -> Parser CreateResponse
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions (Object -> Value
Aeson.Object (Object -> Object
unflattenResponseToolFields Object
o))
parseJSON Value
other = Options -> Value -> Parser CreateResponse
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions Value
other
instance ToJSON CreateResponse where
toJSON :: CreateResponse -> Value
toJSON request :: CreateResponse
request@CreateResponse{ tools :: CreateResponse -> Maybe (Vector Tool)
tools = Maybe (Vector Tool)
mTools, tool_choice :: CreateResponse -> Maybe ToolChoice
tool_choice = Maybe ToolChoice
mChoice } =
case Options -> CreateResponse -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
aesonOptions CreateResponse
request of
Aeson.Object Object
o ->
Object -> Value
Aeson.Object
(Maybe (Vector Tool) -> Maybe ToolChoice -> Object -> Object
flattenResponseToolFields Maybe (Vector Tool)
mTools Maybe ToolChoice
mChoice Object
o)
Value
other -> Value
other
_CreateResponse :: CreateResponse
_CreateResponse :: CreateResponse
_CreateResponse = CreateResponse
{ input :: Maybe Input
input = Maybe Input
forall a. Maybe a
Nothing
, include :: Maybe (Vector Text)
include = Maybe (Vector Text)
forall a. Maybe a
Nothing
, reasoning :: Maybe Reasoning
reasoning = Maybe Reasoning
forall a. Maybe a
Nothing
, service_tier :: Maybe (AutoOr Text)
service_tier = Maybe (AutoOr Text)
forall a. Maybe a
Nothing
, parallel_tool_calls :: Maybe Bool
parallel_tool_calls = Maybe Bool
forall a. Maybe a
Nothing
, store :: Maybe Bool
store = Maybe Bool
forall a. Maybe a
Nothing
, instructions :: Maybe Text
instructions = Maybe Text
forall a. Maybe a
Nothing
, stream :: Maybe Bool
stream = Maybe Bool
forall a. Maybe a
Nothing
, stream_options :: Maybe Value
stream_options = Maybe Value
forall a. Maybe a
Nothing
, metadata :: Maybe (Map Text Text)
metadata = Maybe (Map Text Text)
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
}
type API =
"responses"
:> ( ReqBody '[JSON] CreateResponse
:> Post '[JSON] ResponseObject
:<|> Capture "response_id" Text
:> Get '[JSON] ResponseObject
:<|> Capture "response_id" Text
:> "cancel"
:> Post '[JSON] ResponseObject
:<|> Capture "response_id" Text
:> "input_items"
:> Get '[JSON] (ListOf InputItem)
)