Ollama-sdk
An idiomatic low-level Rust library for interacting with the Ollama API.
[!NOTE] This is not an official Ollama SDK.
[!WARNING] This library is currently in pre-alpha so don't use it in production. There are frequent breaking changes and the API is not stable.
Features
- Idiomatic Rust API: Designed with Rust's best practices in mind.
- Streaming Responses: Efficiently handle streaming responses from the Ollama API.
- Configurable Transport: Uses
reqwestby default, with an extensibleTransporttrait for custom implementations. - Robust Error Handling: Comprehensive error types for predictable error management.
- Observability: Optional
tracingfor detailed logging andmetricsfor performance monitoring.
Installation
Add ollama-sdk to your Cargo.toml file:
[]
= "0.4.1"
To enable optional features like tracing or metrics:
[]
= { = "0.4.1", = ["tracing", "metrics"] }
Examples
[!TIP] Examples are present in the examples directory. You can run them using
cargo run --example <example_name>.
Contributing
We welcome contributions! Please see our CONTRIBUTING.md for more details.
License
This project is licensed under the MIT License. See the LICENSE file for details.