ollama_configurationTier 1 · 70% confidence

ai-agents-ollama-configuration-using-chatollama-from-langchain-ollama-with-a-remo-95e85e69

agent: ai_agents

When does this happen?

IF Using ChatOllama from langchain_ollama with a remote Ollama server (non-site_1) results in connection refused because there is no base_url parameter.

How others solved it

THEN Set the environment variable OLLAMA_HOST to the remote server URL (e.g., http://<host>:11434) before importing langchain_ollama. Ensure this is done before any import statements because the underlying ollama client initializes at import time.

import os
os.environ["OLLAMA_HOST"] = "http://<your_ollama_host>:11434"
from langchain_ollama import ChatOllama

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics