Skip to content

Releases: jamesrochabrun/SwiftOpenAI

Assistant API Stream

22 Mar 22:55
Compare
Choose a tag to compare

Assistants API stream support.

You can stream events from the Create Thread and Run, Create Run, and Submit Tool Outputs endpoints by passing "stream": true. The response will be a Server-Sent events stream.

In Swift:

   /// Creates a thread and run with stream enabled.
   ///
   /// - Parameter parameters: The parameters needed to create a thread and run.
   /// - Returns: An AsyncThrowingStream of [AssistantStreamEvent](https://platform.openai.com/docs/api-reference/assistants-streaming/events) objects.
   /// - Throws: An error if the request fails.
   ///
   /// For more information, refer to [OpenAI's  Run API documentation](https://platform.openai.com/docs/api-reference/runs/createThreadAndRun).
   func createThreadAndRunStream(
      parameters: CreateThreadAndRunParameter)
   async throws -> AsyncThrowingStream<AssistantStreamEvent, Error>
   
   /// Create a run with stream enabled.
   ///
   /// - Parameter threadID: The ID of the thread to run.
   /// - Parameter parameters: The parameters needed to build a Run.
   /// - Returns: An AsyncThrowingStream of [AssistantStreamEvent](https://platform.openai.com/docs/api-reference/assistants-streaming/events) objects.
   /// - Throws: An error if the request fails.
   ///
   /// For more information, refer to [OpenAI's  Run API documentation](https://platform.openai.com/docs/api-reference/runs/createRun).
   func createRunStream(
      threadID: String,
      parameters: RunParameter)
   async throws -> AsyncThrowingStream<AssistantStreamEvent, Error>
   
   
   /// When a run has the status: "requires_action" and required_action.type is submit_tool_outputs, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request. Stream enabled
   ///
   /// - Parameter threadID: The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) to which this run belongs.
   /// - Parameter runID: The ID of the run that requires the tool output submission.
   /// - Parameter parameters: The parameters needed for the run tools output.
   /// - Returns: An AsyncThrowingStream of [AssistantStreamEvent](https://platform.openai.com/docs/api-reference/assistants-streaming/events) objects.
   /// - Throws: An error if the request fails.
   ///
   /// For more information, refer to [OpenAI's  Run API documentation](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs).
   func submitToolOutputsToRunStream(
      threadID: String,
      runID: String,
      parameters: RunToolsOutputParameter)
   async throws -> AsyncThrowingStream<AssistantStreamEvent, Error>

Added demo project/tutorial based on Python tutorial.

streamgif

Adding latest changes from OpenAI API https://platform.openai.com/docs/changelog

20 Feb 06:29
Compare
Choose a tag to compare

Azure OpenAI

24 Jan 06:57
1153951
Compare
Choose a tag to compare

This release provides support for both chat completions and chat stream completions through Azure OpenAI. Currently, DefaultOpenAIAzureService supports chat completions, including both streamed and non-streamed options.

openai-azure

v1.5

03 Jan 19:17
61d7539
Compare
Choose a tag to compare
  • Stream now can be canceled.
  • Updated demo for stream cancellation.

Simulator Screen Recording - iPhone 15 - 2024-01-03 at 11 15 49

Log probs are now available with chat completions.

19 Dec 07:12
Compare
Choose a tag to compare
Screenshot 2023-12-18 at 11 10 57 PM Screenshot 2023-12-18 at 11 10 57 PM

OpenAI DevDay Updates Final part

29 Nov 09:30
Compare
Choose a tag to compare

This release features all the new endpoints introduced at OpenAI Dev Day, including the beta version of the Assistants API. It supports a range of functionalities such as assistants, messages, threads, runs, run steps, message file objects, the Vision API, the Text-to-Speech API, and more.
Developers can create their own Assistant client like this.
demoassis

OpenAI DevDay Updates Part two

15 Nov 08:05
0d8a76c
Compare
Choose a tag to compare

OpenAI DevDay Updates Part one

10 Nov 01:32
Compare
Choose a tag to compare

This release includes updates on the latest OpenAI APIs announced at OpenAI DevDay. This release supports:

  • Parallel Function Calling.
  • Vision API.
  • New demos for Vision and Function Calling.

Simulator Screen Recording - iPhone 15 - 2023-11-09 at 17 12 06

SwiftOpenAI: OpenAI API Integration for Swift

24 Oct 08:17
e066c2a
Compare
Choose a tag to compare

SwiftOpenAI v1.0.0 is a Swift package that provides a wrapper for the OpenAI API. This version supports all the primary OpenAI endpoints, including Audio, Chat, Embeddings, Fine-tuning, Files, Images, Models, and Moderations. It also comes with demos for each endpoint to help users understand its usage.