Ollama Embedding Component doesn't retain the base URL
Bug Description
The Ollama Embedding Component allows the user to enter the base URL for Ollama, but then removes the base URL when the user clicks on the Ollama Model's refresh icon. It never actually accesses the Ollama URL, and as a result it cannot be configured to use any of the Ollama embedded LLMs.
Reproduction
Steps to reproduce the behavior:
- Create an Ollama Embedding Component (Embeddings->Ollama Embedding)
- Enter the base URL (HTTP://localhost:11434)
- Click on the refresh icon to the right of the Ollama Model selection box
Expected behavior
Expected behavior: clicking on the Ollama Model selection box should show all embedded LLMs(in my case, it should show nomic-embed-text:latest).
Actual behavior: the base URL disappears and clicking on the Ollama Model selection box shows "No options found".
Who can help?
No response
Operating System
Docker on Ubuntu 24.04
Langflow Version
1.4.3
Python Version
3.10
Screenshot
No response
Flow File
No response
This is a known bug: when you click the refresh icon, the backend tries to validate the Ollama base URL by making a request to the Ollama API. If the URL is unreachable (which is common in Docker setups if the networking isn't configured), the backend resets the base URL to an empty string, and the UI reflects this—so you lose your input and can't select models. This behavior is rooted in the backend validation logic, not the frontend UI. Multiple users have reported this, especially when running Langflow in Docker environments where localhost doesn't point to the host machine (example, another).
A fix has been merged that standardizes the URL validation and ensures the base URL is retained after refresh if the URL is valid (see PR). If you’re on 1.4.3, you may need to update to a newer version once the fix is released.
Until then, workarounds include:
- Manually re-entering the base URL after each refresh
- Using
http://host.docker.internal:11434as the base URL if Langflow is running in Docker and Ollama is running on the host (see workaround)
If you still see "No options found" after entering the correct URL, double-check that the Ollama server is running and accessible from inside the Docker container. If you’re using a remote server, make sure the network allows connections between the container and the Ollama host.
Let me know if you need more details or help with Docker networking!
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@dosu I am facing the same problem. However, on my side the used URL works inside the "Ollama" model (I can load models there and also receive answers when I set it up as a chat bot) while the exact same URL does not work inside the "Ollama Embeddings" Component. Should the URLs differ between the regular Ollama model and the Embeddings? What other problems could cause this?
Seems the code for checking the URL is causing this behavior. If I change the python code for the check inside "async def update_build_config" to match the code from the "Ollama" model (which also validates the server URL), I can find embedding models just fine. To be exact
if field_name in {"base_url", "model_name"} and not await self.is_valid_ollama_url(field_value):
# Check if any URL in the list is valid
valid_url = ""
for url in URL_LIST:
if await self.is_valid_ollama_url(url):
valid_url = url
break
build_config["base_url"]["value"] = valid_url
gets replaced by:
if build_config["base_url"].get("load_from_db", False):
base_url_value = await self.get_variables(build_config["base_url"].get("value", ""), "base_url")
else:
base_url_value = build_config["base_url"].get("value", "")
if not await self.is_valid_ollama_url(base_url_value):
# Check if any URL in the list is valid
valid_url = ""
check_urls = URL_LIST
if self.base_url:
check_urls = [self.base_url, *URL_LIST]
for url in check_urls:
if await self.is_valid_ollama_url(url):
valid_url = url
break
if valid_url != "":
build_config["base_url"]["value"] = valid_url
else:
msg = "No valid Ollama URL found."
raise ValueError(msg)
Beware of indentation errors when copying, you might have to correct that!
Hi @factor3, thank you for reporting this bug! This error is resolved in main and will be released with v1.7. As a workaround now, you can try replacing the base_url logic inside the ollama embedding component as follows:
async def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None):
- if field_name in {"base_url", "model_name"} and not await self.is_valid_ollama_url(field_value):
- # Check if any URL in the list is valid
- valid_url = ""
- for url in URL_LIST:
- if await self.is_valid_ollama_url(url):
- valid_url = url
- break
- build_config["base_url"]["value"] = valid_url
+ if field_name in {"base_url", "model_name"} and not await self.is_valid_ollama_url(self.base_url):
+ msg = "Ollama is not running on the provided base URL. Please start Ollama and try again."
+ raise ValueError(msg)
if field_name in {"model_name", "base_url", "tool_model_enabled"}:
if await self.is_valid_ollama_url(self.base_url):
build_config["model_name"]["options"] = await self.get_model(self.base_url)
Fixed in the main branch and release-1.7.0.
You have two options for using Ollama embedding models:
- Embedding Model component with Ollama provider
- Ollama Embedding component
For correct operation, ensure:
- The Ollama server is running.
- The number of dimensions in the vector database is compatible with the model used.
Future improvements:
- The default URL will be added to both components (currently it depends on the user);
- The dimension count parameter will be added to the Ollama Embedding component (currently it uses the default of the model used).