NAME
Langertha::Engine::Ollama - Ollama API
VERSION
version 0.100
SYNOPSIS
use Langertha::Engine::Ollama;
my $ollama = Langertha::Engine::Ollama->new(
url => $ENV{OLLAMA_URL},
model => 'llama3.3',
system_prompt => 'You are a helpful assistant',
context_size => 2048,
temperature => 0.5,
);
print($ollama->simple_chat('Say something nice'));
my $embedding = $ollama->embedding($content);
# Get OpenAI compatible API access to Ollama
my $ollama_openai = $ollama->openai;
# List available models
my $models = $ollama->simple_tags;
# Show running models
my $running = $ollama->simple_ps;
DESCRIPTION
This module provides access to Ollama, which runs large language models locally. Ollama supports many popular open-source models with various sizes and capabilities.
Popular Models (February 2026):
llama3.3 - Meta's Llama 3.3 70B with 128k context (default). Excellent general-purpose model with broad tool support.
llama3.2 - Meta's Llama 3.2 includes small models (1B, 3B) for efficient local inference.
qwen3 - Latest Qwen 3 generation with enhanced reasoning. Qwen3-30B recommended for most teams (delivers 90%+ flagship power at lower cost).
qwen2.5 - Qwen 2.5 family (up to 72B) with strong multilingual support and 128k context. Excellent for general tasks.
qwen2.5-coder - Qwen 2.5 specialized for code generation and programming tasks.
deepseek-coder-v2 - DeepSeek's coding-specialized model. Excellent for software development.
mixtral - Mistral's mixture-of-experts model (8x22B). Cost-effective performance.
mistral - Mistral models including latest Mistral 3 family (3B, 8B, 14B).
codestral - Mistral's code-specialized model.
mxbai-embed-large - Embedding model (default for embeddings).
Model Selection Tips:
For general tasks: qwen2.5-72b or llama3.3
For coding: deepseek-coder-v2 or qwen2.5-coder
For reasoning: llama3.3 or qwen3
For cost-effective performance: mixtral-8x22b
For low-resource systems: llama3.2-3b or qwen3-30b
Features:
Run models completely locally
No API key required
Chat completions with streaming
Embeddings
Custom models and quantization
OpenAI-compatible API access via openai() method
JSON format output support
Keep-alive model loading control
Dynamic model listing with caching
THIS API IS WORK IN PROGRESS
LISTING AVAILABLE MODELS
Fetch models from your local Ollama instance:
# Get simple list of model names
my $model_ids = $ollama->list_models;
# Returns: ['llama3.3', 'qwen2.5', ...]
# Get full model objects with metadata
my $models = $ollama->list_models(full => 1);
# Force refresh (bypass cache)
my $models = $ollama->list_models(force_refresh => 1);
# Or use the original method
my $tags = $ollama->simple_tags;
Caching: Results are cached for 1 hour. Configure TTL via models_cache_ttl or clear manually with clear_models_cache.
HOW TO INSTALL OLLAMA
https://github.com/ollama/ollama/tree/main
To pull a model:
ollama pull llama3.3
ollama pull qwen3
To list available models from Ollama library:
ollama list
SEE ALSO
https://ollama.com/library - Ollama model library
Langertha::Engine::OpenAI - OpenAI compatibility layer
Langertha - Main Langertha documentation
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudss.us/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.