All notable changes to ollama_client_rs are documented here.
Model-aware tool calling — the crate now understands the different tool-call formats used by each model family and selects the correct one automatically.
| Type | Details |
|---|---|
ModelFamily |
Enum covering Gemma, Qwen, Llama, Mistral, DeepSeek, Phi, CommandR, Unknown |
ToolFormat |
Enum: Native, PromptInjectedJson, HermesXml, NativeFunctionTag |
ModelInfo |
Struct with family, tool_format, context_length, supports_thinking |
ModelInfo::from_name() |
Heuristic detection from model name string |
OllamaClient::model_info() |
Enriches heuristics with live Ollama API data |
ChatRequestBuilder — fluent builder API for constructing chat requests:
- Automatically injects tools into the system prompt for Gemma (prompt-injected format)
- Passes tools as native Ollama
toolsfield for all other families - Helper constructors:
ChatRequest::new(),ChatRequest::builder()
Message helper constructors — Message::system(), Message::user(),
Message::assistant(), Message::tool_result() for ergonomic message building.
Tool::function() — convenience constructor for function-type tools.
ChatResponse::extract_tool_calls() — smart extraction that:
- Returns native
tool_callsfield if populated - Falls back to parsing
contentfor Gemma JSON format - Falls back to parsing Hermes
<tool_call>XML tags - Falls back to parsing Llama
<function=name>tags
OllamaClient::pull_model() — stream model downloads with progress events.
Streaming improvements:
- Buffer now handles chunk boundaries that fall mid-JSON-line (previously could panic)
- Synthetic
done=truechunk emitted if server closes connection without one - Tool calls are normalised on the final streaming chunk automatically
Automatic tool-call normalisation — both chat() and chat_stream() now
call extract_tool_calls() on the response and populate message.tool_calls
if it was empty but content contained parseable tool calls. Callers no longer
need to check both fields.
| Example | Description |
|---|---|
basic |
List models, simple chat, structured JSON output, model info |
streaming |
Token-by-token streaming with usage statistics |
tool_calling |
Full two-turn tool-use loop for native models (Qwen, Mistral) |
gemma_tools |
Prompt-injected tool calling for Gemma with content parsing |
multi_turn |
Interactive REPL with full conversation history |
embeddings |
Batch embeddings, cosine similarity, semantic search |
model_info |
Model family detection and capability overview |
pull_model |
Download a model with a progress bar |
agentic_loop |
Full ReAct-style agent loop with tool dispatch |
ChatRequestnow derivesCloneto support multi-turn conversation patternsEmbedInputsupports bothSingle(String)andMultiple(Vec<String>)variantsCargo.toml: addedkeywordsandcategoriesfor crates.io discoverability
- Streaming parser no longer fails when a TCP chunk boundary falls mid-JSON-line
chat()andchat_stream()now correctly report tool calls for models that embed them incontentrather than the nativetool_callsfield
Initial public release with basic chat, streaming, and embeddings support.