fix: check ollama url by probing Langflow validate#1099
Merged
Conversation
ricofurtado
requested changes
Mar 14, 2026
mpawlow
approved these changes
Mar 14, 2026
ricofurtado
approved these changes
Mar 14, 2026
ricofurtado
left a comment
Collaborator
There was a problem hiding this comment.
Looking good for me.
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 pull request introduces significant improvements to how Ollama endpoints are resolved and passed as global variables to Langflow and MCP services, ensuring more reliable container-to-container connectivity. The main theme is replacing static localhost transformations with dynamic endpoint resolution using the new
FlowsService.resolve_ollama_urlmethod. The changes also update several service constructors to accept aflows_serviceinstance, enabling consistent endpoint resolution across the codebase.Ollama endpoint resolution improvements:
FlowsService.resolve_ollama_url, which dynamically probes candidate container hosts and caches the resolved Ollama endpoint for improved reliability when running in containerized environments.transform_localhost_urlinutils/container_utils.pyto simplify its logic and remove container-specific arguments, delegating advanced resolution toFlowsService.FlowsService.resolve_ollama_urlin global variable updates, MCP server updates, and header construction, replacing the previous static transformation. [1] [2]Service constructor and dependency updates:
ChatServiceandLangflowFileServiceto accept an optionalflows_serviceparameter, enabling them to use the new dynamic endpoint resolution. [1] [2]initialize_servicesinmain.pyto instantiate and passflows_serviceto dependent services, ensuring consistent endpoint resolution throughout the application.Global variable and credential propagation:
flows_service, ensuring Ollama endpoint resolution is performed consistently whenever global variables or provider credentials are set. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Configuration enhancements:
resolved_endpointfield to theOllamaConfigclass to cache the resolved Ollama endpoint, reducing redundant network probing and improving performance.These changes collectively make Ollama connectivity more robust and maintainable, especially in containerized deployments, by centralizing and automating endpoint resolution logic.