Ollama client for Swift
OllamaKit
is a Swift library that streamlines interactions with the Ollama API. It handles the complexities of network communication and data processing behind the scenes, providing a simple and efficient way to integrate the Ollama API.
🧠 Thinking Model Support - Full support for thinking models like DeepSeek-R1
- Enable thinking mode with
think: true
parameter - Access the model's thinking process via
thinking
field in responses - Works with both Chat and Generate APIs
🛠️ Enhanced Tool Use - Improved tool calling capabilities
- Support for
tool_calls
in assistant messages - Enhanced message structure for tool interactions
- Better conversation flow management
🔧 Generate API Enhancements - New parameters for better control
suffix
parameter for code completion scenariosthinking
support for generate API
See Examples_NewFeatures.md for comprehensive usage examples.
OllamaKit
is primarily developed to power the Ollamac, a macOS app for interacting with Ollama models. Although the library provides robust capabilities for integrating the Ollama API, its features and optimizations are tailored specifically to meet the needs of the Ollamac.
You can find the documentation here: https://kevinhermawan.github.io/OllamaKit/documentation/ollamakit
You can add OllamaKit
as a dependency to your project using Swift Package Manager by adding it to the dependencies value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/kevinhermawan/OllamaKit.git", .upToNextMajor(from: "5.0.0"))
]
Alternatively, in Xcode:
- Open your project in Xcode.
- Click on
File
->Swift Packages
->Add Package Dependency...
- Enter the repository URL:
https://github.com/kevinhermawan/OllamaKit.git
- Choose the version you want to add. You probably want to add the latest version.
- Click
Add Package
.