📦 SwiftyLaunch Modules
✨ AIKit
Overview

AIKit Module Overview

SwiftyLaunch Module - AIKit

Powered by OpenAI

AIKit Module is a SwiftyLaunch module that includes three different mini AI-applications, which you can use as inspiration for your own AI-based applications. After the initial project setup, you will get following three mini-apps out of the box:

  • Bunny L1: Insipired by Rabbit R1, a computer vision camera app that allows you to ask questions about the objects in the camera view. Read more
  • AI Voice Translator: A mini translator app that you will record voice and translate it into another language. Read more
  • AI ChatBot: An AI Chat app powered by OpenAI's GPT-4o model. Read more

AIKit is designed to work with BackendKit out of the box, in order to prevent leakage of API keys on the client side. Most of the models are powered by OpenAI's API, but we also include a small local, multi-lingual speech-to-text whisper model (ggml-tiny (opens in a new tab))

We also integrate the models automatically with AuthKit and AnalyticsKit (if selected), see the sections below for more information.

Module Usage

In comparison to other modules, which are more focused on providing easy access specific capabilities, AIKit is to be seen as a collection of different AI-related features that you can use or repurpose in your app, or use as inspiration for your own AI-based applications.

You can tap into different

AuthKit Integration

We use AuthKit and DBKit to store the chat history for the AI ChatBot mini-app. The user is required to be logged in to use the chat feature, and if he quits the app and comes back, the chat history will be restored.

AnalyticsKit Integration

If AnalyticsKit is selected during project generation, events regarding user interacting with AI mini-apps will automatically be tracked with aikit as the source (both client-side and server-side).

Tracked events include:

  • Client-side view interactions
  • Camera-related analytics (errors, interactions)
  • Voice-related analytics (errors, interactions)
  • Backend logs and errors

Module File Contents

Let's go through every file that is contained in the AIKit module on the client side:

Resources / Models / Whisper

ggml-tiny.bin

The whisper model that is used for multi-lingual speech-to-text conversion. Around 77 MB in size. Source (opens in a new tab).

ggml-tiny-encoder.mlmodelc

Model Encoder to support CoreML for improved performance. Around 16 MB in size. Source (opens in a new tab).

Sources

View / AIKitExamplesView.swift

The AIKit root view that includes all three mini AI-applications.

View / VisionExample

Directory that includes the view and the view model of the Bunny L1 Example.

View / ChatExample

Directory that includes the view and the view model of the AI Chat Example.

View / VoiceExample

Directory that includes the view and the view model of the AI Voice Translator Example.

Misc / Camera

Directory that contains camera-related views, and view models that are primarily used in the Bunny L1 mini-app, but can be repurposed for other camera-related features.

Misc / Voice

Directory that contains voice-related models that handle both the recording and transcription using the whisper model. Used in the Bunny L1 and AI Voice Translator mini-app

Extensions / UIImage+Extensions.swift

Extension to handle Base64 encoding of an UIImage that we use to send images to the backend.