Ollixir offers a rich and complete set of features, covering almost all of Ollama's capabilities:
1. Full API Coverage
Ollixir supports all core APIs of Ollama:
- Chat: Supports multi-turn conversations, the foundation for building interactive applications
- Text Generation (Generate/Completion): Single text completion, suitable for simple generation tasks
- Embeddings: Converts text into vector representations, used for semantic search and RAG applications
- Model Management: List, pull, create, copy, and delete models
2. Stream Response Handling
Elixir's Stream abstraction perfectly aligns with Ollama's streaming API. Developers can direct streaming output to enumerables or send it directly to a specified process, enabling true asynchronous processing. This design allows non-blocking handling of streaming output from large models, which is ideal for real-time interaction scenarios such as chatbots and real-time content generation.
3. Function Calling
Ollixir supports Ollama's function calling feature, allowing models to call external functions. Developers can manually define tools or directly pass Elixir functions, letting Ollixir automatically convert them into tool definitions. This design greatly reduces the complexity of building Agent applications, enabling models to interact with external systems, perform calculations, query databases, or call APIs.
4. Structured Output
Through JSON Schema, Ollixir allows models to output structured data. This is very useful for applications that need to extract structured information from model outputs, such as data extraction, classification, entity recognition, etc. Developers only need to define the schema, and the model will return data in the specified format, facilitating subsequent processing.
5. Multimodal Support
Ollixir supports image input and can handle vision-language models (such as LLaVA). The client automatically encodes images into Base64; developers only need to provide the image path or binary data. This makes it easy to build applications that can "see" images.
6. Typed Responses and Options
Ollixir provides structured response and option types. Developers can choose to receive structs instead of raw maps, getting better IDE support and compile-time checks. The Options struct provides preset configurations (like creative, precise, etc.) to easily adjust generation parameters.