-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Description
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- This is not related to the langchain-community package.
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Package (Required)
- langchain
- langchain-openai
- langchain-anthropic
- langchain-classic
- langchain-core
- langchain-cli
- langchain-model-profiles
- langchain-tests
- langchain-text-splitters
- langchain-chroma
- langchain-deepseek
- langchain-exa
- langchain-fireworks
- langchain-groq
- langchain-huggingface
- langchain-mistralai
- langchain-nomic
- langchain-ollama
- langchain-perplexity
- langchain-prompty
- langchain-qdrant
- langchain-xai
- Other / not sure / general
Example Code (Python)
# test.py
from langchain_ollama.llms import OllamaLLM
import requests
import os
# expect the item to be hosted in some area on my local net..
print("DEBUG2", requests.get('http://ollama:11434/v1/models').status_code)
model_name="qwen3:8b"
model1 = OllamaLLM(model=model_name, base_url="ollama:11434")
model2 = OllamaLLM(model=model_name, base_url="somewherethatdoesntexist:11434")
#
print(
"DEBUG URL that exists\n",
model1.invoke("what is your knowladge cut off"))
try:
print("DEBUG doesnt exist URL\n",
model2.invoke("what is your knowladge cut off"))
assert False
except Exception as ex:
assert True
passError Message and Stack Trace (if applicable)
The above code will assert at the assert location. Showing that the OllamaLLM model that was installed with an invalid base_url should have failed. But it just ignores the base_url setting and talks to the wrong location..Description
OllamaLLM parameter base_url is ignored
System Info
System Information
OS: Linux
OS Version: #35~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Oct 14 13:55:17 UTC 2
Python Version: 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0]
Package Information
langchain_core: 1.0.3
langchain: 1.0.4
langsmith: 0.4.41
langchain_chroma: 1.0.0
langchain_mcp_adapters: 0.1.12
langchain_ollama: 1.0.0
langgraph_sdk: 0.2.9
Optional packages not installed
langserve
Other Dependencies
chromadb: 1.3.4
claude-agent-sdk: Installed. No version info available.
httpx: 0.28.1
jsonpatch: 1.33
langchain-anthropic: Installed. No version info available.
langchain-aws: Installed. No version info available.
langchain-azure-ai: Installed. No version info available.
langchain-community: Installed. No version info available.
langchain-deepseek: Installed. No version info available.
langchain-fireworks: Installed. No version info available.
langchain-google-genai: Installed. No version info available.
langchain-google-vertexai: Installed. No version info available.
langchain-groq: Installed. No version info available.
langchain-huggingface: Installed. No version info available.
langchain-mistralai: Installed. No version info available.
langchain-model-profiles: Installed. No version info available.
langchain-openai: Installed. No version info available.
langchain-perplexity: Installed. No version info available.
langchain-together: Installed. No version info available.
langchain-xai: Installed. No version info available.
langgraph: 1.0.2
langsmith-pyo3: Installed. No version info available.
mcp: 1.13.0
numpy: 2.2.6
ollama: 0.6.0
openai-agents: Installed. No version info available.
opentelemetry-api: 1.38.0
opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
opentelemetry-sdk: 1.38.0
orjson: 3.11.4
packaging: 25.0
pydantic: 2.12.4
pytest: 8.4.2
pyyaml: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
rich: 14.2.0
tenacity: 9.1.2
typing-extensions: 4.15.0
vcrpy: Installed. No version info available.
zstandard: 0.25.0