packages feed

openai-2.5.4 / src / OpenAI / V1 / Assistants.hs

-- | @\/v1\/assistants@module OpenAI.V1.Assistants    ( -- * Main types      AssistantID(..)    , CreateAssistant(..)    , _CreateAssistant    , ModifyAssistant(..)    , _ModifyAssistant    , AssistantObject(..)      -- * Other types    , RankingOptions    , FileSearch(..)    , Function(..)    , Tool(..)    , CodeInterpreterResources(..)    , FileSearchResources(..)    , ToolResources(..)      -- * Servant    , API    ) whereimport OpenAI.Preludeimport OpenAI.V1.AutoOrimport OpenAI.V1.DeletionStatusimport OpenAI.V1.ListOfimport OpenAI.V1.Models (Model)import OpenAI.V1.Orderimport OpenAI.V1.ResponseFormatimport OpenAI.V1.Toolimport OpenAI.V1.ToolResources-- | AssistantIDnewtype AssistantID = AssistantID{ text :: Text }    deriving newtype (FromJSON, IsString, Show, ToHttpApiData, ToJSON)-- | Request body for @\/v1\/assistants@data CreateAssistant = CreateAssistant    { model :: Model    , name :: Maybe Text    , description :: Maybe Text    , instructions :: Maybe Text    , tools :: Maybe (Vector Tool)    , tool_resources :: Maybe ToolResources    , metadata :: Maybe (Map Text Text)    , temperature :: Maybe Double    , top_p :: Maybe Double    , response_format :: Maybe (AutoOr ResponseFormat)    } deriving stock (Generic, Show)instance FromJSON CreateAssistant where    parseJSON = genericParseJSON aesonOptionsinstance ToJSON CreateAssistant where    toJSON = genericToJSON aesonOptions-- | Default `CreateAssistant`_CreateAssistant :: CreateAssistant_CreateAssistant = CreateAssistant    { name = Nothing    , description = Nothing    , instructions = Nothing    , tools = Nothing    , tool_resources = Nothing    , metadata = Nothing    , temperature = Nothing    , top_p = Nothing    , response_format = Nothing    }-- | Request body for @\/v1\/assistants/:assistant_id@data ModifyAssistant = ModifyAssistant    { model :: Model    , name :: Maybe Text    , description :: Maybe Text    , instructions :: Maybe Text    , tools :: Maybe (Vector Tool)    , tool_resources :: Maybe ToolResources    , metadata :: Maybe (Map Text Text)    , temperature :: Maybe Double    , top_p :: Maybe Double    , response_format :: Maybe (AutoOr ResponseFormat)    } deriving stock (Generic, Show)instance FromJSON ModifyAssistant where    parseJSON = genericParseJSON aesonOptionsinstance ToJSON ModifyAssistant where    toJSON = genericToJSON aesonOptions-- | Default `ModifyAssistant`_ModifyAssistant :: ModifyAssistant_ModifyAssistant = ModifyAssistant    { name = Nothing    , description = Nothing    , instructions = Nothing    , tools = Nothing    , tool_resources = Nothing    , metadata = Nothing    , temperature = Nothing    , top_p = Nothing    , response_format = Nothing    }-- | Represents an assistant that can call the model and use tools.data AssistantObject = AssistantObject    { id :: AssistantID    , object :: Text    , created_at :: POSIXTime    , name :: Maybe Text    , description :: Maybe Text    , model :: Model    , instructions :: Maybe Text    , tools :: Maybe (Vector Tool)    , tool_resources :: Maybe ToolResources    , metadata :: Map Text Text    , temperature :: Maybe Double    , top_p :: Maybe Double    , response_format :: AutoOr ResponseFormat    } deriving stock (Generic, Show)      deriving anyclass (FromJSON, ToJSON)-- | Servant APItype API =        Header' '[Required, Strict] "OpenAI-Beta" Text    :>  "assistants"    :>  (         ReqBody '[JSON] CreateAssistant              :>  Post '[JSON] AssistantObject        :<|>      QueryParam "limit" Natural              :>  QueryParam "order" Order              :>  QueryParam "after" Text              :>  QueryParam "before" Text              :>  Get '[JSON] (ListOf AssistantObject)        :<|>      Capture "assistant_id" AssistantID              :>  Get '[JSON] AssistantObject        :<|>      Capture "assistant_id" AssistantID              :>  ReqBody '[JSON] ModifyAssistant              :>  Post '[JSON] AssistantObject        :<|>      Capture "assistant_id" AssistantID              :>  Delete '[JSON] DeletionStatus        )