langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
35.41k stars 4.22k forks source link

Basic flow with Ollama not working with Version 1.1.0.dev5 #4742

Closed flefevre closed 3 days ago

flefevre commented 4 days ago

Bug Description

When creating a basic Ollama flow from the basic template, i have no answer. When clicking on Playground, i have "Flow running..." ! My Ollama is working, and accessible and checked with Openwebui front end

looking to the langflow log

               mœ,œnameœ:œpromptœ,œoutput_typesœ:[œMes            
                         sage...                                            
                                        |    |       ->                     
                         Vertex(display_name=Ollama,                        
                         id=OllamaModel-3GJ5M, data={'type':                
                         'OllamaModel', 'node': {'template':                
                         {'input_value': {'type': ...                       
                                        |    ->                             
                         Vertex(display_name=Prompt,                        
                         id=Prompt-X6hEm, data={'description':              
                         'Create a prompt template with dynamic             
                         variables.', 'displa...                            
                                        -> <class                           
                         'langflow.graph.edge.base.Edge'>                   
                           File                                             
                         "/app/.venv/lib/python3.12/site-package            
                         s/langflow/graph/edge/base.py", line               
                         52, in __init__                                    
                             self.validate_handles(source,                  
                         target)                                            
                             |    |                |       ->               
                         Vertex(display_name=Ollama,                        
                         id=OllamaModel-3GJ5M, data={'type':                
                         'OllamaModel', 'node': {'template':                
                         {'input_value': {'type': ...                       

...

                         │    54 │   │   │   # Logging here be │            
                         │    55 │   │   │   logger.error("Edg │            
                         │                                     │            
                         │ /app/.venv/lib/python3.12/site-pack │            
                         │ ages/langflow/graph/edge/base.py:77 │            
                         │  in validate_handles                │            
                         │                                     │            
                         │    74 │   │   if isinstance(self._s │            
                         │    75 │   │   │   self._legacy_vali │            
                         │    76 │   │   else:                 │            
                         │ ❱  77 │   │   │   self._validate_ha │            
                         │    78 │                             │            
                         │    79 │   def _validate_handles(sel │            
                         │    80 │   │   if self.target_handle │            
                         │                                     │            
                         │ /app/.venv/lib/python3.12/site-pack │            
                         │ ages/langflow/graph/edge/base.py:93 │            
                         │  in _validate_handles               │            
                         │                                     │            
                         │    90 │   │   │   logger.debug(self │            
                         │    91 │   │   │   logger.debug(self │            
                         │    92 │   │   │   msg = f"Edge betw │            
                         │       invalid handles"              │            
                         │ ❱  93 │   │   │   raise ValueError( │            
                         │    94 │                             │            
                         │    95 │   def _legacy_validate_hand │            
                         │    96 │   │   if self.target_handle │            
                         ╰─────────────────────────────────────╯            
                         ValueError: Edge between Prompt and                
                         Ollama has invalid handles           

Reproduction

Just click on Playground

Expected behavior

The playground should be accessible

Who can help?

No response

Operating System

Ubuntu 22.04

Langflow Version

1.1.0.dev5

Python Version

None

Screenshot

image

Flow File

Basic Prompting.json

dosubot[bot] commented 4 days ago

The error you're encountering, "Edge between Prompt and Ollama has invalid handles," suggests that there is a compatibility issue between the input and output types of the connected nodes in your flow. The validate_handles method in the Edge class is responsible for ensuring that the data types between connected nodes are compatible. If they are not, it raises a ValueError [1].

To resolve this issue, you should check the input and output types of the 'Prompt' and 'OllamaModel' nodes to ensure they are compatible. The 'Prompt' node has an input type of Text named "template" and an output type of Text [2]. The 'OllamaModel' node has various input types, including MessageInput for input_value, and outputs such as text_output and model_output [3].

Ensure that the output from the 'Prompt' node is correctly connected to a compatible input on the 'OllamaModel' node. If the types do not match, you may need to adjust the flow or use a node that can convert or adapt the data types accordingly.

To continue talking to Dosu, mention @dosu.

flefevre commented 3 days ago

It is the most simple workflow and it doesn't not work. It is very frustrating. It seems more related to a front end problem, do you agree @lucaseduoli

flefevre commented 3 days ago

it has been solved in the nighlty build by https://github.com/langflow-ai/langflow/issues/4398#issuecomment-2490201406