Skip to content

Assistants API support for Azure

Compare
Choose a tag to compare
@jamesrochabrun jamesrochabrun released this 29 May 19:59
· 18 commits to main since this release
7821552

Getting started with Azure OpenAI Assistants (Preview)

Screenshot 2024-05-29 at 12 58 56 PM

https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/assistant

enum AzureOpenAIAPI {
   
   static var azureOpenAIResource: String = ""
   
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference?tabs=python
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/assistant
   case assistant(AssistantCategory)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions
   case chat(deploymentID: String)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference-messages?tabs=python
   case message(MessageCategory)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference-runs?tabs=python
   case run(RunCategory)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference-runs?tabs=python#list-run-steps
   case runStep(RunStepCategory)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference-threads?tabs=python#create-a-thread
   case thread(ThreadCategory)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/file-search?tabs=python#vector-stores
   case vectorStore(VectorStoreCategory)
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/file-search?tabs=python#vector-stores
   case vectorStoreFile(VectorStoreFileCategory)
   
   enum AssistantCategory {
      case create
      case list
      case retrieve(assistantID: String)
      case modify(assistantID: String)
      case delete(assistantID: String)
   }

   enum MessageCategory {
      case create(threadID: String)
      case retrieve(threadID: String, messageID: String)
      case modify(threadID: String, messageID: String)
      case list(threadID: String)
   }
   
   enum RunCategory {
      case create(threadID: String)
      case retrieve(threadID: String, runID: String)
      case modify(threadID: String, runID: String)
      case list(threadID: String)
      case cancel(threadID: String, runID: String)
      case submitToolOutput(threadID: String, runID: String)
      case createThreadAndRun
   }
   
   enum RunStepCategory {
      case retrieve(threadID: String, runID: String, stepID: String)
      case list(threadID: String, runID: String)
   }
   
   enum ThreadCategory {
      case create
      case retrieve(threadID: String)
      case modify(threadID: String)
      case delete(threadID: String)
   }
   
   enum VectorStoreCategory {
      case create
      case list
      case retrieve(vectorStoreID: String)
      case modify(vectorStoreID: String)
      case delete(vectorStoreID: String)
   }
   
   /// https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/file-search?tabs=python#file-search-support
   enum VectorStoreFileCategory {
      case create(vectorStoreID: String)
      case list(vectorStoreID: String)
      case retrieve(vectorStoreID: String, fileID: String)
      case delete(vectorStoreID: String, fileID: String)
   }
}