Setting up Ollama for LLM Development¶
Ollama allows you to run large language models locally, which is useful for development and testing HANI's LLM features without requiring API keys.
Installing Ollama¶
macOS¶
Or download from ollama.ai
Linux¶
Windows¶
Download the installer from ollama.ai
Starting Ollama¶
Start the Ollama server:
This starts the server at http://localhost:11434.
Pulling Models¶
Download a model to use with HANI:
# Recommended for development (small and fast)
ollama pull llama3.2
# Larger models for better quality
ollama pull llama3.1
ollama pull mistral
ollama pull codellama
Configuring HANI for Ollama¶
Edit ~/negmas/hani/settings/llm_settings.json:
{
"provider": "ollama",
"model": "llama3.2",
"base_url": "http://localhost:11434",
"temperature": 0.7
}
Configuration Options¶
| Setting | Description | Default |
|---|---|---|
provider |
LLM provider (ollama, openai, anthropic) |
openai |
model |
Model name | gpt-4o-mini |
base_url |
API endpoint URL | Provider default |
temperature |
Response randomness (0.0-2.0) | 0.7 |
api_key |
API key (not needed for Ollama) | - |
Testing the Configuration¶
-
Start Ollama:
-
Start HANI:
-
Log in and start a negotiation
-
Use the Response Generator tool to test LLM integration:
- Enter an instruction like "Propose a fair offer"
- Click Generate Response
- The generated text and outcome should appear
Recommended Models¶
| Model | Size | Speed | Quality | Best For |
|---|---|---|---|---|
llama3.2 |
3B | Fast | Good | Development, testing |
llama3.1 |
8B | Medium | Better | General use |
mistral |
7B | Medium | Good | Balanced performance |
llama3.1:70b |
70B | Slow | Excellent | Production quality |
Troubleshooting¶
Connection Refused¶
If you see "Connection refused" errors:
-
Ensure Ollama is running:
-
Check the server is accessible:
Model Not Found¶
If the model isn't found:
-
List available models:
-
Pull the model if needed:
Slow Responses¶
For faster responses:
- Use a smaller model (
llama3.2instead ofllama3.1:70b) - Reduce the context window in LLM settings
- Ensure no other heavy processes are running
Using OpenAI or Anthropic Instead¶
If you prefer cloud-based models:
OpenAI¶
Or set the environment variable:
Anthropic¶
Or set the environment variable:
Admin LLM Settings¶
Administrators can configure LLM settings directly in the HANI interface:
- Log in as admin
- Open the sidebar
- Navigate to LLM Settings
- Configure provider, model, and prompts
Changes are saved to llm_settings.json and take effect immediately.