SwiftAI A modern, type-safe Swift library for building AI-powered apps. SwiftAI provides a unified API that works seamlessly across different AI models - from Apple's on-device models to cloud-based services like OpenAI. โจ Features ๐ค Model Agnostic : Unified API across Apple's on-device models, OpenAI, Anthropic, and custom backends : Unified API across Apple's on-device models, OpenAI, Anthropic, and custom backends ๐ฏ Structured Output : Strongly-typed structured outputs with compile-time validation : Strongly-typed structured outputs with compile-time validation ๐ง Agent Tool Loop : First-class support for tool use : First-class support for tool use ๐ฌ Conversations : Stateful chat sessions with automatic context management : Stateful chat sessions with automatic context management ๐๏ธ Extensible : Plugin architecture for custom models and tools : Plugin architecture for custom models and tools โก Swift-Native: Built with async/await and modern Swift concurrency ๐ Quick Start import SwiftAI let llm = SystemLLM ( ) let response = try await llm . reply ( to : " What is the capital of France? " ) print ( response . content ) // "Paris" ๐ฆ Installation Swift Package Manager Xcode: Go to File โ Add Package Dependencies Enter: https://github.com/mi12labs/SwiftAI Click Add Package Package.swift: dependencies: [ . package ( url : " https://github.com/mi12labs/SwiftAI " , from : " main " ) ] ๐ Getting Started ๐ Step 1: Your First AI Query Start with the simplest possible example - just ask a question and get an answer: import SwiftAI // Initialize Apple's on-device language model. let llm = SystemLLM ( ) // Ask a question and get a response. let response = try await llm . reply ( to : " What is the capital of France? " ) print ( response . content ) // "Paris" What just happened? SystemLLM() creates Apple's on-device AI model creates Apple's on-device AI model reply(to:) sends your question and returns a String by default sends your question and returns a by default try await h...
First seen: 2025-08-28 20:30
Last seen: 2025-08-29 02:31