Add Ollama executor support for local model inference#2
Open
Add Ollama executor support for local model inference#2
Conversation
This commit adds full Ollama integration to LLMVM, enabling users to run local language models with complete tool calling support using the <helpers> block pattern. Key Features: - New OllamaExecutor that inherits from OpenAIExecutor - Leverages Ollama's OpenAI-compatible API endpoint - Full conversation mode support - Tool calling via <helpers> blocks for local code execution - Supports popular models: llama3.1, qwen2.5, mistral, etc. Implementation Details: - llmvm/common/ollama_executor.py: Main executor implementation - Inherits from OpenAIExecutor for OpenAI compatibility - Configurable endpoint (default: http://localhost:11434/v1) - No API key validation (Ollama runs locally) - Supports streaming responses and stop tokens - llmvm/common/helpers.py: Executor registration - Added 'ollama' executor to get_executor() method - Environment variable support: OLLAMA_API_BASE - Config variable: ollama_api_base, default_ollama_model Testing & Documentation: - scripts/test_ollama.py: Comprehensive test suite - Tests conversation mode - Tests tool calling with <helpers> blocks - Validates model availability - Supports multiple models and endpoints - docs/OLLAMA.md: Complete setup and usage guide - Installation instructions - Configuration options - Model recommendations - Troubleshooting guide - Performance tips - README.md: Updated to mention Ollama support Usage: LLMVM_EXECUTOR='ollama' LLMVM_MODEL='llama3.1' python -m llmvm.client Testing: python scripts/test_ollama.py Requirements: - Ollama installed and running (https://ollama.ai) - A model pulled (e.g., ollama pull llama3.1) Closes requirement: Enable Ollama compatibility with conversation mode and full tool calling support using <helpers> blocks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds full Ollama integration to LLMVM, enabling users to run
local language models with complete tool calling support using the
block pattern.
Key Features:
Implementation Details:
llmvm/common/ollama_executor.py: Main executor implementation
llmvm/common/helpers.py: Executor registration
Testing & Documentation:
scripts/test_ollama.py: Comprehensive test suite
docs/OLLAMA.md: Complete setup and usage guide
README.md: Updated to mention Ollama support
Usage:
LLMVM_EXECUTOR='ollama' LLMVM_MODEL='llama3.1' python -m llmvm.client
Testing:
python scripts/test_ollama.py
Requirements:
Closes requirement: Enable Ollama compatibility with conversation mode
and full tool calling support using blocks.