Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Config = Config {}
- data OpenAIBackend a m = OpenAIBackend {
- cancelRun :: a -> Text -> Text -> m RunObject
- createAssistant :: a -> CreateAssistantRequest -> m AssistantObject
- createAssistantFile :: a -> Text -> CreateAssistantFileRequest -> m AssistantFileObject
- createMessage :: a -> Text -> CreateMessageRequest -> m MessageObject
- createRun :: a -> Text -> CreateRunRequest -> m RunObject
- createThread :: a -> CreateThreadRequest -> m ThreadObject
- createThreadAndRun :: a -> CreateThreadAndRunRequest -> m RunObject
- deleteAssistant :: a -> Text -> m DeleteAssistantResponse
- deleteAssistantFile :: a -> Text -> Text -> m DeleteAssistantFileResponse
- deleteThread :: a -> Text -> m DeleteThreadResponse
- getAssistant :: a -> Text -> m AssistantObject
- getAssistantFile :: a -> Text -> Text -> m AssistantFileObject
- getMessage :: a -> Text -> Text -> m MessageObject
- getMessageFile :: a -> Text -> Text -> Text -> m MessageFileObject
- getRun :: a -> Text -> Text -> m RunObject
- getRunStep :: a -> Text -> Text -> Text -> m RunStepObject
- getThread :: a -> Text -> m ThreadObject
- listAssistantFiles :: a -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListAssistantFilesResponse
- listAssistants :: a -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListAssistantsResponse
- listMessageFiles :: a -> Text -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListMessageFilesResponse
- listMessages :: a -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListMessagesResponse
- listRunSteps :: a -> Text -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListRunStepsResponse
- listRuns :: a -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListRunsResponse
- modifyAssistant :: a -> Text -> ModifyAssistantRequest -> m AssistantObject
- modifyMessage :: a -> Text -> Text -> ModifyMessageRequest -> m MessageObject
- modifyRun :: a -> Text -> Text -> ModifyRunRequest -> m RunObject
- modifyThread :: a -> Text -> ModifyThreadRequest -> m ThreadObject
- submitToolOuputsToRun :: a -> Text -> Text -> SubmitToolOutputsRunRequest -> m RunObject
- createSpeech :: a -> CreateSpeechRequest -> m ByteString
- createTranscription :: a -> FormCreateTranscription -> m CreateTranscription200Response
- createTranslation :: a -> FormCreateTranslation -> m CreateTranslation200Response
- createChatCompletion :: a -> CreateChatCompletionRequest -> m CreateChatCompletionResponse
- createCompletion :: a -> CreateCompletionRequest -> m CreateCompletionResponse
- createEmbedding :: a -> CreateEmbeddingRequest -> m CreateEmbeddingResponse
- createFile :: a -> FormCreateFile -> m OpenAIFile
- deleteFile :: a -> Text -> m DeleteFileResponse
- downloadFile :: a -> Text -> m Text
- listFiles :: a -> Maybe Text -> m ListFilesResponse
- retrieveFile :: a -> Text -> m OpenAIFile
- cancelFineTuningJob :: a -> Text -> m FineTuningJob
- createFineTuningJob :: a -> CreateFineTuningJobRequest -> m FineTuningJob
- listFineTuningEvents :: a -> Text -> Maybe Text -> Maybe Int -> m ListFineTuningJobEventsResponse
- listPaginatedFineTuningJobs :: a -> Maybe Text -> Maybe Int -> m ListPaginatedFineTuningJobsResponse
- retrieveFineTuningJob :: a -> Text -> m FineTuningJob
- createImage :: a -> CreateImageRequest -> m ImagesResponse
- createImageEdit :: a -> FormCreateImageEdit -> m ImagesResponse
- createImageVariation :: a -> FormCreateImageVariation -> m ImagesResponse
- deleteModel :: a -> Text -> m DeleteModelResponse
- listModels :: a -> m ListModelsResponse
- retrieveModel :: a -> Text -> m Model
- createModeration :: a -> CreateModerationRequest -> m CreateModerationResponse
- createOpenAIClient :: OpenAIBackend AuthClient OpenAIClient
- runOpenAIServer :: (MonadIO m, MonadThrow m) => Config -> OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> m ()
- runOpenAIMiddlewareServer :: (MonadIO m, MonadThrow m) => Config -> Middleware -> OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> m ()
- runOpenAIClient :: Config -> OpenAIClient a -> ExceptT ClientError IO a
- runOpenAIClientWithManager :: Manager -> Config -> OpenAIClient a -> ExceptT ClientError IO a
- callOpenAI :: (MonadIO m, MonadThrow m) => ClientEnv -> OpenAIClient a -> m a
- data OpenAIClient a
- newtype OpenAIClientError = OpenAIClientError ClientError
- type OpenAIAPI = (Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("cancel" :> Verb 'POST 200 '[JSON] RunObject)))))) :<|> ((Protected :> ("assistants" :> (ReqBody '[JSON] CreateAssistantRequest :> Verb 'POST 200 '[JSON] AssistantObject))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (ReqBody '[JSON] CreateAssistantFileRequest :> Verb 'POST 200 '[JSON] AssistantFileObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (ReqBody '[JSON] CreateMessageRequest :> Verb 'POST 200 '[JSON] MessageObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (ReqBody '[JSON] CreateRunRequest :> Verb 'POST 200 '[JSON] RunObject))))) :<|> ((Protected :> ("threads" :> (ReqBody '[JSON] CreateThreadRequest :> Verb 'POST 200 '[JSON] ThreadObject))) :<|> ((Protected :> ("threads" :> ("runs" :> (ReqBody '[JSON] CreateThreadAndRunRequest :> Verb 'POST 200 '[JSON] RunObject)))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> Verb 'DELETE 200 '[JSON] DeleteAssistantResponse))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (Capture "file_id" Text :> Verb 'DELETE 200 '[JSON] DeleteAssistantFileResponse))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> Verb 'DELETE 200 '[JSON] DeleteThreadResponse))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> Verb 'GET 200 '[JSON] AssistantObject))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (Capture "file_id" Text :> Verb 'GET 200 '[JSON] AssistantFileObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> Verb 'GET 200 '[JSON] MessageObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> ("files" :> (Capture "file_id" Text :> Verb 'GET 200 '[JSON] MessageFileObject))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> Verb 'GET 200 '[JSON] RunObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("steps" :> (Capture "step_id" Text :> Verb 'GET 200 '[JSON] RunStepObject))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> Verb 'GET 200 '[JSON] ThreadObject))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListAssistantFilesResponse)))))))) :<|> ((Protected :> ("assistants" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListAssistantsResponse)))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> ("files" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListMessageFilesResponse)))))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListMessagesResponse)))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("steps" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListRunStepsResponse)))))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListRunsResponse)))))))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> (ReqBody '[JSON] ModifyAssistantRequest :> Verb 'POST 200 '[JSON] AssistantObject)))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> (ReqBody '[JSON] ModifyMessageRequest :> Verb 'POST 200 '[JSON] MessageObject)))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> (ReqBody '[JSON] ModifyRunRequest :> Verb 'POST 200 '[JSON] RunObject)))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> (ReqBody '[JSON] ModifyThreadRequest :> Verb 'POST 200 '[JSON] ThreadObject)))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("submit_tool_outputs" :> (ReqBody '[JSON] SubmitToolOutputsRunRequest :> Verb 'POST 200 '[JSON] RunObject))))))) :<|> ((Protected :> ("audio" :> ("speech" :> (ReqBody '[JSON] CreateSpeechRequest :> Verb 'POST 200 '[AudioMpeg] ByteString)))) :<|> ((Protected :> ("audio" :> ("transcriptions" :> (ReqBody '[FormUrlEncoded] FormCreateTranscription :> Verb 'POST 200 '[JSON] CreateTranscription200Response)))) :<|> ((Protected :> ("audio" :> ("translations" :> (ReqBody '[FormUrlEncoded] FormCreateTranslation :> Verb 'POST 200 '[JSON] CreateTranslation200Response)))) :<|> ((Protected :> ("chat" :> ("completions" :> (ReqBody '[JSON] CreateChatCompletionRequest :> Verb 'POST 200 '[JSON] CreateChatCompletionResponse)))) :<|> ((Protected :> ("completions" :> (ReqBody '[JSON] CreateCompletionRequest :> Verb 'POST 200 '[JSON] CreateCompletionResponse))) :<|> ((Protected :> ("embeddings" :> (ReqBody '[JSON] CreateEmbeddingRequest :> Verb 'POST 200 '[JSON] CreateEmbeddingResponse))) :<|> ((Protected :> ("files" :> (ReqBody '[FormUrlEncoded] FormCreateFile :> Verb 'POST 200 '[JSON] OpenAIFile))) :<|> ((Protected :> ("files" :> (Capture "file_id" Text :> Verb 'DELETE 200 '[JSON] DeleteFileResponse))) :<|> ((Protected :> ("files" :> (Capture "file_id" Text :> ("content" :> Verb 'GET 200 '[JSON] Text)))) :<|> ((Protected :> ("files" :> (QueryParam "purpose" Text :> Verb 'GET 200 '[JSON] ListFilesResponse))) :<|> ((Protected :> ("files" :> (Capture "file_id" Text :> Verb 'GET 200 '[JSON] OpenAIFile))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (Capture "fine_tuning_job_id" Text :> ("cancel" :> Verb 'POST 200 '[JSON] FineTuningJob))))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (ReqBody '[JSON] CreateFineTuningJobRequest :> Verb 'POST 200 '[JSON] FineTuningJob)))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (Capture "fine_tuning_job_id" Text :> ("events" :> (QueryParam "after" Text :> (QueryParam "limit" Int :> Verb 'GET 200 '[JSON] ListFineTuningJobEventsResponse))))))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (QueryParam "after" Text :> (QueryParam "limit" Int :> Verb 'GET 200 '[JSON] ListPaginatedFineTuningJobsResponse))))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (Capture "fine_tuning_job_id" Text :> Verb 'GET 200 '[JSON] FineTuningJob)))) :<|> ((Protected :> ("images" :> ("generations" :> (ReqBody '[JSON] CreateImageRequest :> Verb 'POST 200 '[JSON] ImagesResponse)))) :<|> ((Protected :> ("images" :> ("edits" :> (ReqBody '[FormUrlEncoded] FormCreateImageEdit :> Verb 'POST 200 '[JSON] ImagesResponse)))) :<|> ((Protected :> ("images" :> ("variations" :> (ReqBody '[FormUrlEncoded] FormCreateImageVariation :> Verb 'POST 200 '[JSON] ImagesResponse)))) :<|> ((Protected :> ("models" :> (Capture "model" Text :> Verb 'DELETE 200 '[JSON] DeleteModelResponse))) :<|> ((Protected :> ("models" :> Verb 'GET 200 '[JSON] ListModelsResponse)) :<|> ((Protected :> ("models" :> (Capture "model" Text :> Verb 'GET 200 '[JSON] Model))) :<|> ((Protected :> ("moderations" :> (ReqBody '[JSON] CreateModerationRequest :> Verb 'POST 200 '[JSON] CreateModerationResponse))) :<|> Raw))))))))))))))))))))))))))))))))))))))))))))))))))
- serverWaiApplicationOpenAI :: OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> Application
- data OpenAIAuth = OpenAIAuth {
- lookupUser :: ByteString -> Handler AuthServer
- authError :: Request -> ServerError
- clientAuth :: Text -> AuthClient
- type Protected = AuthProtect "bearer"
Client and Server
Server or client configuration, specifying the host and port to query or serve on.
Config | |
|
data OpenAIBackend a m Source #
Configuration, specifying the full url of the service.
Backend for OpenAI.
The backend can be used both for the client and the server. The client generated from the OpenAI OpenAPI spec
is a backend that executes actions by sending HTTP requests (see createOpenAIClient
). Alternatively, provided
a backend, the API can be served using runOpenAIMiddlewareServer
.
createOpenAIClient :: OpenAIBackend AuthClient OpenAIClient Source #
runOpenAIServer :: (MonadIO m, MonadThrow m) => Config -> OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> m () Source #
Run the OpenAI server at the provided host and port.
runOpenAIMiddlewareServer :: (MonadIO m, MonadThrow m) => Config -> Middleware -> OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> m () Source #
Run the OpenAI server at the provided host and port.
runOpenAIClient :: Config -> OpenAIClient a -> ExceptT ClientError IO a Source #
Run requests in the OpenAIClient monad.
runOpenAIClientWithManager :: Manager -> Config -> OpenAIClient a -> ExceptT ClientError IO a Source #
Run requests in the OpenAIClient monad using a custom manager.
callOpenAI :: (MonadIO m, MonadThrow m) => ClientEnv -> OpenAIClient a -> m a Source #
Like runClient
, but returns the response or throws
a OpenAIClientError
data OpenAIClient a Source #
Instances
MonadIO OpenAIClient Source # | |
Defined in OpenAI.API liftIO :: IO a -> OpenAIClient a # | |
Applicative OpenAIClient Source # | |
Defined in OpenAI.API pure :: a -> OpenAIClient a # (<*>) :: OpenAIClient (a -> b) -> OpenAIClient a -> OpenAIClient b # liftA2 :: (a -> b -> c) -> OpenAIClient a -> OpenAIClient b -> OpenAIClient c # (*>) :: OpenAIClient a -> OpenAIClient b -> OpenAIClient b # (<*) :: OpenAIClient a -> OpenAIClient b -> OpenAIClient a # | |
Functor OpenAIClient Source # | |
Defined in OpenAI.API fmap :: (a -> b) -> OpenAIClient a -> OpenAIClient b # (<$) :: a -> OpenAIClient b -> OpenAIClient a # | |
Monad OpenAIClient Source # | |
Defined in OpenAI.API (>>=) :: OpenAIClient a -> (a -> OpenAIClient b) -> OpenAIClient b # (>>) :: OpenAIClient a -> OpenAIClient b -> OpenAIClient b # return :: a -> OpenAIClient a # |
newtype OpenAIClientError Source #
Custom exception type for our errors.
Instances
Exception OpenAIClientError Source # | |
Defined in OpenAI.API | |
Show OpenAIClientError Source # | |
Defined in OpenAI.API showsPrec :: Int -> OpenAIClientError -> ShowS # show :: OpenAIClientError -> String # showList :: [OpenAIClientError] -> ShowS # |
Servant
type OpenAIAPI = (Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("cancel" :> Verb 'POST 200 '[JSON] RunObject)))))) :<|> ((Protected :> ("assistants" :> (ReqBody '[JSON] CreateAssistantRequest :> Verb 'POST 200 '[JSON] AssistantObject))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (ReqBody '[JSON] CreateAssistantFileRequest :> Verb 'POST 200 '[JSON] AssistantFileObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (ReqBody '[JSON] CreateMessageRequest :> Verb 'POST 200 '[JSON] MessageObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (ReqBody '[JSON] CreateRunRequest :> Verb 'POST 200 '[JSON] RunObject))))) :<|> ((Protected :> ("threads" :> (ReqBody '[JSON] CreateThreadRequest :> Verb 'POST 200 '[JSON] ThreadObject))) :<|> ((Protected :> ("threads" :> ("runs" :> (ReqBody '[JSON] CreateThreadAndRunRequest :> Verb 'POST 200 '[JSON] RunObject)))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> Verb 'DELETE 200 '[JSON] DeleteAssistantResponse))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (Capture "file_id" Text :> Verb 'DELETE 200 '[JSON] DeleteAssistantFileResponse))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> Verb 'DELETE 200 '[JSON] DeleteThreadResponse))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> Verb 'GET 200 '[JSON] AssistantObject))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (Capture "file_id" Text :> Verb 'GET 200 '[JSON] AssistantFileObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> Verb 'GET 200 '[JSON] MessageObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> ("files" :> (Capture "file_id" Text :> Verb 'GET 200 '[JSON] MessageFileObject))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> Verb 'GET 200 '[JSON] RunObject))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("steps" :> (Capture "step_id" Text :> Verb 'GET 200 '[JSON] RunStepObject))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> Verb 'GET 200 '[JSON] ThreadObject))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> ("files" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListAssistantFilesResponse)))))))) :<|> ((Protected :> ("assistants" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListAssistantsResponse)))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> ("files" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListMessageFilesResponse)))))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListMessagesResponse)))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("steps" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListRunStepsResponse)))))))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (QueryParam "limit" Int :> (QueryParam "order" Text :> (QueryParam "after" Text :> (QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListRunsResponse)))))))) :<|> ((Protected :> ("assistants" :> (Capture "assistant_id" Text :> (ReqBody '[JSON] ModifyAssistantRequest :> Verb 'POST 200 '[JSON] AssistantObject)))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("messages" :> (Capture "message_id" Text :> (ReqBody '[JSON] ModifyMessageRequest :> Verb 'POST 200 '[JSON] MessageObject)))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> (ReqBody '[JSON] ModifyRunRequest :> Verb 'POST 200 '[JSON] RunObject)))))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> (ReqBody '[JSON] ModifyThreadRequest :> Verb 'POST 200 '[JSON] ThreadObject)))) :<|> ((Protected :> ("threads" :> (Capture "thread_id" Text :> ("runs" :> (Capture "run_id" Text :> ("submit_tool_outputs" :> (ReqBody '[JSON] SubmitToolOutputsRunRequest :> Verb 'POST 200 '[JSON] RunObject))))))) :<|> ((Protected :> ("audio" :> ("speech" :> (ReqBody '[JSON] CreateSpeechRequest :> Verb 'POST 200 '[AudioMpeg] ByteString)))) :<|> ((Protected :> ("audio" :> ("transcriptions" :> (ReqBody '[FormUrlEncoded] FormCreateTranscription :> Verb 'POST 200 '[JSON] CreateTranscription200Response)))) :<|> ((Protected :> ("audio" :> ("translations" :> (ReqBody '[FormUrlEncoded] FormCreateTranslation :> Verb 'POST 200 '[JSON] CreateTranslation200Response)))) :<|> ((Protected :> ("chat" :> ("completions" :> (ReqBody '[JSON] CreateChatCompletionRequest :> Verb 'POST 200 '[JSON] CreateChatCompletionResponse)))) :<|> ((Protected :> ("completions" :> (ReqBody '[JSON] CreateCompletionRequest :> Verb 'POST 200 '[JSON] CreateCompletionResponse))) :<|> ((Protected :> ("embeddings" :> (ReqBody '[JSON] CreateEmbeddingRequest :> Verb 'POST 200 '[JSON] CreateEmbeddingResponse))) :<|> ((Protected :> ("files" :> (ReqBody '[FormUrlEncoded] FormCreateFile :> Verb 'POST 200 '[JSON] OpenAIFile))) :<|> ((Protected :> ("files" :> (Capture "file_id" Text :> Verb 'DELETE 200 '[JSON] DeleteFileResponse))) :<|> ((Protected :> ("files" :> (Capture "file_id" Text :> ("content" :> Verb 'GET 200 '[JSON] Text)))) :<|> ((Protected :> ("files" :> (QueryParam "purpose" Text :> Verb 'GET 200 '[JSON] ListFilesResponse))) :<|> ((Protected :> ("files" :> (Capture "file_id" Text :> Verb 'GET 200 '[JSON] OpenAIFile))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (Capture "fine_tuning_job_id" Text :> ("cancel" :> Verb 'POST 200 '[JSON] FineTuningJob))))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (ReqBody '[JSON] CreateFineTuningJobRequest :> Verb 'POST 200 '[JSON] FineTuningJob)))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (Capture "fine_tuning_job_id" Text :> ("events" :> (QueryParam "after" Text :> (QueryParam "limit" Int :> Verb 'GET 200 '[JSON] ListFineTuningJobEventsResponse))))))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (QueryParam "after" Text :> (QueryParam "limit" Int :> Verb 'GET 200 '[JSON] ListPaginatedFineTuningJobsResponse))))) :<|> ((Protected :> ("fine_tuning" :> ("jobs" :> (Capture "fine_tuning_job_id" Text :> Verb 'GET 200 '[JSON] FineTuningJob)))) :<|> ((Protected :> ("images" :> ("generations" :> (ReqBody '[JSON] CreateImageRequest :> Verb 'POST 200 '[JSON] ImagesResponse)))) :<|> ((Protected :> ("images" :> ("edits" :> (ReqBody '[FormUrlEncoded] FormCreateImageEdit :> Verb 'POST 200 '[JSON] ImagesResponse)))) :<|> ((Protected :> ("images" :> ("variations" :> (ReqBody '[FormUrlEncoded] FormCreateImageVariation :> Verb 'POST 200 '[JSON] ImagesResponse)))) :<|> ((Protected :> ("models" :> (Capture "model" Text :> Verb 'DELETE 200 '[JSON] DeleteModelResponse))) :<|> ((Protected :> ("models" :> Verb 'GET 200 '[JSON] ListModelsResponse)) :<|> ((Protected :> ("models" :> (Capture "model" Text :> Verb 'GET 200 '[JSON] Model))) :<|> ((Protected :> ("moderations" :> (ReqBody '[JSON] CreateModerationRequest :> Verb 'POST 200 '[JSON] CreateModerationResponse))) :<|> Raw)))))))))))))))))))))))))))))))))))))))))))))))))) Source #
Servant type-level API, generated from the OpenAPI spec for OpenAI.
Plain WAI Application
serverWaiApplicationOpenAI :: OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> Application Source #
Plain Network.Wai Application for the OpenAI server.
Can be used to implement e.g. tests that call the API without a full webserver.
Authentication
data OpenAIAuth Source #
Authentication settings for OpenAI. lookupUser is used to retrieve a user given a header value. The data type can be specified by providing an type instance for AuthServerData. authError is a function that given a request returns a custom error that is returned when the header is not found.
OpenAIAuth | |
|
clientAuth :: Text -> AuthClient Source #
type Protected = AuthProtect "bearer" Source #