langflow icon indicating copy to clipboard operation
langflow copied to clipboard

[a58 bug] Chat Input stopped working with Azure OpenAI model/embedding component

Open msmygit opened this issue 1 year ago • 5 comments

Describe the bug When a chat input component is connected to Azure Open AI embedding/model, we currently get the below error with a58 version,

Error building vertex Azure OpenAI: 2 validation errors for HumanMessage content str type expected (type=type_error.str) content value is not a valid list (type=type_error.list)

Browser and Version All

To Reproduce Steps to reproduce the behavior:

  1. Create a very basic flow with Chat Input -> Azure Open AI Embedding -> Chat Output
  2. Run each component and you'll end up with this error. Console will show error as below:
ValueError: Error building vertex Azure OpenAI: 2 validation errors for HumanMessage                                                                                                    
                             content                                                                                                                                                                                 
                               str type expected (type=type_error.str)                                                                                                                                               
                             content                                                                                                                                                                                 
                               value is not a valid list (type=type_error.list) 

Screenshots Screenshot 2024-06-15 at 03 37 18

Additional context This used to work somewhere with <= a48 version.

msmygit avatar Jun 15 '24 07:06 msmygit

The error you're encountering occurs because the input_value parameter in the build method of the AzureChatOpenAISpecsComponent class is expected to be a string, but it is being provided as a list. To resolve this issue, ensure that the input_value parameter is passed as a string when using the Chat Input component with the Azure OpenAI embedding/model [1][2][3][4][5].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Jun 15 '24 07:06 dosubot[bot]

@dosu How is this fix implemented in the code of the Chat Input ? I have tried changing the code but it doesnt work. Please provide an example based on the issue that was described before.

DonPabs avatar Jun 16 '24 09:06 DonPabs

Is the problem still there with langflow 1.0.5?

nicoloboschi avatar Jun 28 '24 10:06 nicoloboschi

Yes, this is still a problem even with v1.0.6.

Expand/Collapse
```
python -m langflow run --env-file ~/langflow/.env
Starting Langflow v1.0.6...
╭───────────────────────────────────────────────────────────────────╮
│ Welcome to ⛓ Langflow                                             │
│                                                                   │
│                                                                   │
│ Collaborate, and contribute at our GitHub Repo 🌟                 │
│                                                                   │
│ We collect anonymous usage data to improve Langflow.              │
│ You can opt-out by setting DO_NOT_TRACK=true in your environment. │
│                                                                   │
│ Access http://127.0.0.1:7860                                      │
╰───────────────────────────────────────────────────────────────────╯
[07/08/24 09:32:29] ERROR    2024-07-08 09:32:29 - ERROR    - base - Could not connect to AzureOpenAIEmbeddings API.Traceback (most recent call last):                                                    base.py:627
                                                                                                                                                                                                                     
                               File "<string>", line 67, in build_embeddings                                                                                                                                         
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in __init__                                                      
                                 raise validation_error                                                                                                                                                              
                                       -> ValidationError(model='AzureOpenAIEmbeddings', errors=[{'loc': ('dimensions',), 'msg': 'value is not a valid integer', 'type'...                                           
                                                                                                                                                                                                                     
                             pydantic.v1.error_wrappers.ValidationError: 1 validation error for AzureOpenAIEmbeddings                                                                                                
                             dimensions                                                                                                                                                                              
                               value is not a valid integer (type=type_error.integer)                                                                                                                                
                                                                                                                                                                                                                     
                                                                                                                                                                                                                     
                             The above exception was the direct cause of the following exception:                                                                                                                    
                                                                                                                                                                                                                     
                                                                                                                                                                                                                     
                                                                                                                                                                                                                     
                             Traceback (most recent call last):                                                                                                                                                      
                                                                                                                                                                                                                     
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/runpy.py", line 196, in _run_module_as_main                                                                     
                                 return _run_code(code, main_globals, None,                                                                                                                                          
                                        |         |     -> {'__name__': '__main__', '__doc__': None, '__package__': 'langflow', '__loader__': <_frozen_importlib_external.SourceFileLoad...                          
                                        |         -> <code object <module> at 0x1016dbc00, file "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/la...                                
                                        -> <function _run_code at 0x1016e1f30>                                                                                                                                       
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/runpy.py", line 86, in _run_code                                                                                
                                 exec(code, run_globals)                                                                                                                                                             
                                      |     -> {'__name__': '__main__', '__doc__': None, '__package__': 'langflow', '__loader__': <_frozen_importlib_external.SourceFileLoad...                                      
                                      -> <code object <module> at 0x1016dbc00, file "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/la...                                            
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/__main__.py", line 607, in <module>                                                     
                                 main()                                                                                                                                                                              
                                 -> <function main at 0x11cd94e50>                                                                                                                                                   
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/__main__.py", line 603, in main                                                         
                                 app()                                                                                                                                                                               
                                 -> <typer.main.Typer object at 0x1031b8df0>                                                                                                                                         
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/typer/main.py", line 309, in __call__                                                            
                                 return get_command(self)(*args, **kwargs)                                                                                                                                           
                                        |           |      |       -> {}                                                                                                                                             
                                        |           |      -> ()                                                                                                                                                     
                                        |           -> <typer.main.Typer object at 0x1031b8df0>                                                                                                                      
                                        -> <function get_command at 0x10303a170>                                                                                                                                     
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/click/core.py", line 1157, in __call__                                                           
                                 return self.main(*args, **kwargs)                                                                                                                                                   
                                        |    |     |       -> {}                                                                                                                                                     
                                        |    |     -> ()                                                                                                                                                             
                                        |    -> <function TyperGroup.main at 0x1030388b0>                                                                                                                            
                                        -> <TyperGroup >                                                                                                                                                             
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/typer/core.py", line 723, in main                                                                
                                 return _main(                                                                                                                                                                       
                                        -> <function _main at 0x103033be0>                                                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/typer/core.py", line 193, in _main                                                               
                                 rv = self.invoke(ctx)                                                                                                                                                               
                                      |    |      -> <click.core.Context object at 0x11cdb9450>                                                                                                                      
                                      |    -> <function MultiCommand.invoke at 0x101b2eb90>                                                                                                                          
                                      -> <TyperGroup >                                                                                                                                                               
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/click/core.py", line 1688, in invoke                                                             
                                 return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                             
                                        |               |       |       |      -> <click.core.Context object at 0x11cdb9d20>                                                                                         
                                        |               |       |       -> <function Command.invoke at 0x101b2e680>                                                                                                  
                                        |               |       -> <TyperCommand run>                                                                                                                                
                                        |               -> <click.core.Context object at 0x11cdb9d20>                                                                                                                
                                        -> <function MultiCommand.invoke.<locals>._process_result at 0x11cd952d0>                                                                                                    
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/click/core.py", line 1434, in invoke                                                             
                                 return ctx.invoke(self.callback, **ctx.params)                                                                                                                                      
                                        |   |      |    |           |   -> {'env_file': '/Users/madhavansridharan/langflow/.env', 'host': '127.0.0.1', 'workers': 1, 'timeout': 300, 'port': 7860,                   
                             'comp...                                                                                                                                                                                
                                        |   |      |    |           -> <click.core.Context object at 0x11cdb9d20>                                                                                                    
                                        |   |      |    -> <function run at 0x11cd95000>                                                                                                                             
                                        |   |      -> <TyperCommand run>                                                                                                                                             
                                        |   -> <function Context.invoke at 0x101b2d3f0>                                                                                                                              
                                        -> <click.core.Context object at 0x11cdb9d20>                                                                                                                                
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/click/core.py", line 783, in invoke                                                              
                                 return __callback(*args, **kwargs)                                                                                                                                                  
                                                    |       -> {'env_file': '/Users/madhavansridharan/langflow/.env', 'host': '127.0.0.1', 'workers': 1, 'timeout': 300, 'port': 7860, 'comp...                      
                                                    -> ()                                                                                                                                                            
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/typer/main.py", line 692, in wrapper                                                             
                                 return callback(**use_params)                                                                                                                                                       
                                        |          -> {'host': '127.0.0.1', 'workers': 1, 'timeout': 300, 'port': 7860, 'components_path': PosixPath('/Users/madhavansridharan/.pye...                               
                                        -> <function run at 0x11cd94670>                                                                                                                                             
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/__main__.py", line 192, in run                                                          
                                 process = run_on_mac_or_linux(host, port, log_level, options, app)                                                                                                                  
                                           |                   |     |     |          |        -> <fastapi.applications.FastAPI object at 0x11cdba170>                                                               
                                           |                   |     |     |          -> {'bind': '127.0.0.1:7860', 'workers': 1, 'timeout': 300, 'worker_class':                                                    
                             'langflow.server.LangflowUvicornWorker', 'logger_cla...                                                                                                                                 
                                           |                   |     |     -> 'critical'                                                                                                                             
                                           |                   |     -> 7860                                                                                                                                         
                                           |                   -> '127.0.0.1'                                                                                                                                        
                                           -> <function run_on_mac_or_linux at 0x11cd944c0>                                                                                                                          
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/__main__.py", line 215, in run_on_mac_or_linux                                          
                                 webapp_process.start()                                                                                                                                                              
                                 |              -> <function BaseProcess.start at 0x10305e050>                                                                                                                       
                                 -> <Process name='Process-1' parent=47191 started>                                                                                                                                  
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/process.py", line 121, in start                                                     
                                 self._popen = self._Popen(self)                                                                                                                                                     
                                 |    |        |    |      -> <Process name='Process-1' parent=47191 started>                                                                                                        
                                 |    |        |    -> <staticmethod(<function Process._Popen at 0x10319f880>)>                                                                                                      
                                 |    |        -> <Process name='Process-1' parent=47191 started>                                                                                                                    
                                 |    -> None                                                                                                                                                                        
                                 -> <Process name='Process-1' parent=47191 started>                                                                                                                                  
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/context.py", line 224, in _Popen                                                    
                                 return _default_context.get_context().Process._Popen(process_obj)                                                                                                                   
                                        |                |                            -> <Process name='Process-1' parent=47191 started>                                                                             
                                        |                -> <function DefaultContext.get_context at 0x10319fa30>                                                                                                     
                                        -> <multiprocess.context.DefaultContext object at 0x102dde020>                                                                                                               
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/context.py", line 281, in _Popen                                                    
                                 return Popen(process_obj)                                                                                                                                                           
                                        |     -> <Process name='Process-1' parent=47191 started>                                                                                                                     
                                        -> <class 'multiprocess.popen_fork.Popen'>                                                                                                                                   
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/popen_fork.py", line 19, in __init__                                                
                                 self._launch(process_obj)                                                                                                                                                           
                                 |    |       -> <Process name='Process-1' parent=47191 started>                                                                                                                     
                                 |    -> <function Popen._launch at 0x11cf8ec20>                                                                                                                                     
                                 -> <multiprocess.popen_fork.Popen object at 0x11cfd8e80>                                                                                                                            
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/popen_fork.py", line 71, in _launch                                                 
                                 code = process_obj._bootstrap(parent_sentinel=child_r)                                                                                                                              
                                        |           |                          -> 6                                                                                                                                  
                                        |           -> <function BaseProcess._bootstrap at 0x10305e950>                                                                                                              
                                        -> <Process name='Process-1' parent=47191 started>                                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/process.py", line 314, in _bootstrap                                                
                                 self.run()                                                                                                                                                                          
                                 |    -> <function BaseProcess.run at 0x10305dfc0>                                                                                                                                   
                                 -> <Process name='Process-1' parent=47191 started>                                                                                                                                  
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/multiprocess/process.py", line 108, in run                                                       
                                 self._target(*self._args, **self._kwargs)                                                                                                                                           
                                 |    |        |    |        |    -> {}                                                                                                                                              
                                 |    |        |    |        -> <Process name='Process-1' parent=47191 started>                                                                                                      
                                 |    |        |    -> ('127.0.0.1', 7860, 'critical', {'bind': '127.0.0.1:7860', 'workers': 1, 'timeout': 300, 'worker_class': 'langflow.server.Lan...                              
                                 |    |        -> <Process name='Process-1' parent=47191 started>                                                                                                                    
                                 |    -> <function run_langflow at 0x11cd94af0>                                                                                                                                      
                                 -> <Process name='Process-1' parent=47191 started>                                                                                                                                  
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/__main__.py", line 437, in run_langflow                                                 
                                 LangflowApplication(app, options).run()                                                                                                                                             
                                 |                   |    -> {'bind': '127.0.0.1:7860', 'workers': 1, 'timeout': 300, 'worker_class': 'langflow.server.LangflowUvicornWorker', 'logger_cla...                        
                                 |                   -> <fastapi.applications.FastAPI object at 0x11cdba170>                                                                                                         
                                 -> <class 'langflow.server.LangflowApplication'>                                                                                                                                    
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/gunicorn/app/base.py", line 72, in run                                                           
                                 Arbiter(self).run()                                                                                                                                                                 
                                 |       -> <langflow.server.LangflowApplication object at 0x103074370>                                                                                                              
                                 -> <class 'gunicorn.arbiter.Arbiter'>                                                                                                                                               
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/gunicorn/arbiter.py", line 202, in run                                                           
                                 self.manage_workers()                                                                                                                                                               
                                 |    -> <function Arbiter.manage_workers at 0x11d049d80>                                                                                                                            
                                 -> <gunicorn.arbiter.Arbiter object at 0x11cfd9690>                                                                                                                                 
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/gunicorn/arbiter.py", line 571, in manage_workers                                                
                                 self.spawn_workers()                                                                                                                                                                
                                 |    -> <function Arbiter.spawn_workers at 0x11d049ea0>                                                                                                                             
                                 -> <gunicorn.arbiter.Arbiter object at 0x11cfd9690>                                                                                                                                 
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/gunicorn/arbiter.py", line 642, in spawn_workers                                                 
                                 self.spawn_worker()                                                                                                                                                                 
                                 |    -> <function Arbiter.spawn_worker at 0x11d049e10>                                                                                                                              
                                 -> <gunicorn.arbiter.Arbiter object at 0x11cfd9690>                                                                                                                                 
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker                                                  
                                 worker.init_process()                                                                                                                                                               
                                 |      -> <function UvicornWorker.init_process at 0x11d2f4940>                                                                                                                      
                                 -> <langflow.server.LangflowUvicornWorker object at 0x11d0d1b40>                                                                                                                    
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/uvicorn/workers.py", line 75, in init_process                                                    
                                 super().init_process()                                                                                                                                                              
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/gunicorn/workers/base.py", line 142, in init_process                                             
                                 self.run()                                                                                                                                                                          
                                 |    -> <function UvicornWorker.run at 0x11d2f4b80>                                                                                                                                 
                                 -> <langflow.server.LangflowUvicornWorker object at 0x11d0d1b40>                                                                                                                    
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/uvicorn/workers.py", line 107, in run                                                            
                                 return asyncio.run(self._serve())                                                                                                                                                   
                                        |       |   |    -> <function LangflowUvicornWorker._serve at 0x11d2f4ca0>                                                                                                   
                                        |       |   -> <langflow.server.LangflowUvicornWorker object at 0x11d0d1b40>                                                                                                 
                                        |       -> <function _patch_asyncio.<locals>.run at 0x11d2f5090>                                                                                                             
                                        -> <module 'asyncio' from '/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/__init__.py'>                                                             
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/runners.py", line 44, in run                                                                            
                                 return loop.run_until_complete(main)                                                                                                                                                
                                        |    |                  -> <coroutine object LangflowUvicornWorker._serve at 0x11d0c1c40>                                                                                    
                                        |    -> <function _patch_loop.<locals>.run_until_complete at 0x11d3a3be0>                                                                                                    
                                        -> <_UnixSelectorEventLoop running=True closed=False debug=False>                                                                                                            
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete                                                        
                                 self.run_forever()                                                                                                                                                                  
                                 |    -> <function _patch_loop.<locals>.run_forever at 0x11d3a3b50>                                                                                                                  
                                 -> <_UnixSelectorEventLoop running=True closed=False debug=False>                                                                                                                   
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/base_events.py", line 603, in run_forever                                                               
                                 self._run_once()                                                                                                                                                                    
                                 |    -> <function _patch_loop.<locals>._run_once at 0x11d3a3c70>                                                                                                                    
                                 -> <_UnixSelectorEventLoop running=True closed=False debug=False>                                                                                                                   
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/nest_asyncio.py", line 133, in _run_once                                                         
                                 handle._run()                                                                                                                                                                       
                                 |      -> <function Handle._run at 0x1032b71c0>                                                                                                                                     
                                 -> <Handle Task.__wakeup(<Future finis... 0x121005a20>>)>                                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/events.py", line 80, in _run                                                                            
                                 self._context.run(self._callback, *self._args)                                                                                                                                      
                                 |    |            |    |           |    -> <member '_args' of 'Handle' objects>                                                                                                     
                                 |    |            |    |           -> <Handle Task.__wakeup(<Future finis... 0x121005a20>>)>                                                                                        
                                 |    |            |    -> <member '_callback' of 'Handle' objects>                                                                                                                  
                                 |    |            -> <Handle Task.__wakeup(<Future finis... 0x121005a20>>)>                                                                                                         
                                 |    -> <member '_context' of 'Handle' objects>                                                                                                                                     
                                 -> <Handle Task.__wakeup(<Future finis... 0x121005a20>>)>                                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/tasks.py", line 315, in __wakeup                                                                        
                                 self.__step()                                                                                                                                                                       
                                 -> <Task pending name='starlette.middleware.base.BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.coro' coro=<BaseHTTPMid...                                                 
                               File "/Users/madhavansridharan/.pyenv/versions/3.10.14/lib/python3.10/asyncio/tasks.py", line 232, in __step                                                                          
                                 result = coro.send(None)                                                                                                                                                            
                                          |    -> <method 'send' of 'coroutine' objects>                                                                                                                             
                                          -> <coroutine object BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.coro at 0x12c2dde00>                                                                          
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro                                                 
                                 await self.app(scope, receive_or_disconnect, send_no_error)                                                                                                                         
                                       |    |   |      |                      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x12c10ff40>                                     
                                       |    |   |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                                    
                                       |    |   -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                                  
                                       |    -> <starlette.middleware.cors.CORSMiddleware object at 0x11d37ee90>                                                                                                      
                                       -> <langflow.main.JavaScriptMIMETypeMiddleware object at 0x11d37ece0>                                                                                                         
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/middleware/cors.py", line 93, in __call__                                              
                                 await self.simple_response(scope, receive, send, request_headers=headers)                                                                                                           
                                       |    |               |      |        |                     -> Headers({'host': '127.0.0.1:7860', 'connection': 'keep-alive', 'content-length': '2', 'sec-ch-ua':              
                             '"Google Chrome";v="125", ...                                                                                                                                                           
                                       |    |               |      |        -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x12c10ff40>                                       
                                       |    |               |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                        
                                       |    |               -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                      
                                       |    -> <function CORSMiddleware.simple_response at 0x104a1a290>                                                                                                              
                                       -> <starlette.middleware.cors.CORSMiddleware object at 0x11d37ee90>                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/middleware/cors.py", line 148, in simple_response                                      
                                 await self.app(scope, receive, send)                                                                                                                                                
                                       |    |   |      |        -> functools.partial(<bound method CORSMiddleware.send of <starlette.middleware.cors.CORSMiddleware object at 0x11d37ee90>>, sen...                  
                                       |    |   |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                                    
                                       |    |   -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                                  
                                       |    -> <starlette.middleware.exceptions.ExceptionMiddleware object at 0x11d37eec0>                                                                                           
                                       -> <starlette.middleware.cors.CORSMiddleware object at 0x11d37ee90>                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__                                        
                                 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)                                                                                                            
                                       |                            |    |    |     |      |        -> functools.partial(<bound method CORSMiddleware.send of <starlette.middleware.cors.CORSMiddleware              
                             object at 0x11d37ee90>>, sen...                                                                                                                                                         
                                       |                            |    |    |     |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                
                                       |                            |    |    |     -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1',            
                             7860), 'cl...                                                                                                                                                                           
                                       |                            |    |    -> <starlette.requests.Request object at 0x12bc80580>                                                                                  
                                       |                            |    -> <fastapi.routing.APIRouter object at 0x11cdb82e0>                                                                                        
                                       |                            -> <starlette.middleware.exceptions.ExceptionMiddleware object at 0x11d37eec0>                                                                   
                                       -> <function wrap_app_handling_exceptions at 0x1049afac0>                                                                                                                     
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                        
                                 await app(scope, receive, sender)                                                                                                                                                   
                                       |   |      |        -> <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x12c1c03a0>                                                            
                                       |   |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                                         
                                       |   -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                                       
                                       -> <fastapi.routing.APIRouter object at 0x11cdb82e0>                                                                                                                          
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__                                                     
                                 await self.middleware_stack(scope, receive, send)                                                                                                                                   
                                       |    |                |      |        -> <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x12c1c03a0>                                          
                                       |    |                |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                       
                                       |    |                -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                     
                                       |    -> <bound method Router.app of <fastapi.routing.APIRouter object at 0x11cdb82e0>>                                                                                        
                                       -> <fastapi.routing.APIRouter object at 0x11cdb82e0>                                                                                                                          
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/routing.py", line 776, in app                                                          
                                 await route.handle(scope, receive, send)                                                                                                                                            
                                       |     |      |      |        -> <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x12c1c03a0>                                                   
                                       |     |      |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                                
                                       |     |      -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                              
                                       |     -> <function Route.handle at 0x1049d9000>                                                                                                                               
                                       -> APIRoute(path='/api/v1/build/{flow_id}/vertices/{vertex_id}', name='build_vertex', methods=['POST'])                                                                       
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle                                                       
                                 await self.app(scope, receive, send)                                                                                                                                                
                                       |    |   |      |        -> <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x12c1c03a0>                                                       
                                       |    |   |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                                    
                                       |    |   -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                                  
                                       |    -> <function request_response.<locals>.app at 0x11ccabb50>                                                                                                               
                                       -> APIRoute(path='/api/v1/build/{flow_id}/vertices/{vertex_id}', name='build_vertex', methods=['POST'])                                                                       
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/routing.py", line 77, in app                                                           
                                 await wrap_app_handling_exceptions(app, request)(scope, receive, send)                                                                                                              
                                       |                            |    |        |      |        -> <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x12c1c03a0>                     
                                       |                            |    |        |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                  
                                       |                            |    |        -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1',              
                             7860), 'cl...                                                                                                                                                                           
                                       |                            |    -> <starlette.requests.Request object at 0x12bc82680>                                                                                       
                                       |                            -> <function request_response.<locals>.app.<locals>.app at 0x12c1c0040>                                                                          
                                       -> <function wrap_app_handling_exceptions at 0x1049afac0>                                                                                                                     
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                        
                                 await app(scope, receive, sender)                                                                                                                                                   
                                       |   |      |        -> <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x12c1c0820>                                                            
                                       |   |      -> <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x12c10f1c0>                                                         
                                       |   -> {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7860), 'cl...                                       
                                       -> <function request_response.<locals>.app.<locals>.app at 0x12c1c0040>                                                                                                       
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/starlette/routing.py", line 72, in app                                                           
                                 response = await func(request)                                                                                                                                                      
                                                  |    -> <starlette.requests.Request object at 0x12bc82680>                                                                                                         
                                                  -> <function get_request_handler.<locals>.app at 0x11cd976d0>                                                                                                      
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app                                                            
                                 raw_response = await run_endpoint_function(                                                                                                                                         
                                                      -> <function run_endpoint_function at 0x1049d9ea0>                                                                                                             
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function                                          
                                 return await dependant.call(**values)                                                                                                                                               
                                              |         |      -> {'chat_service': <langflow.services.chat.service.ChatService object at 0x12c3d1d50>, 'current_user': User(id=UUID('ea4fdc1e-2...                   
                                              |         -> <function build_vertex at 0x10b3f83a0>                                                                                                                    
                                              -> <fastapi.dependencies.models.Dependant object at 0x11ce140a0>                                                                                                       
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/api/v1/chat.py", line 201, in build_vertex                                              
                                 ) = await graph.build_vertex(                                                                                                                                                       
                                           |     -> <function Graph.build_vertex at 0x10b341c60>                                                                                                                     
                                           -> Graph:                                                                                                                                                                 
                                              Nodes: ['ChatInput-17ruO', 'AstraDB-sshfE', 'ParseData-tsWv6', 'Prompt-MEwgd', 'OpenAIModel-vaqVm', 'ChatOutput-GeRH3'...                                              
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/graph/graph/base.py", line 878, in build_vertex                                         
                                 await vertex.build(                                                                                                                                                                 
                                       |      -> <function Vertex.build at 0x10b339ea0>                                                                                                                              
                                       -> Vertex(display_name=Azure OpenAI Embeddings, id=AzureOpenAIEmbeddings-D3MlY, data={'type': 'AzureOpenAIEmbeddings', 'node': {...                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/graph/vertex/base.py", line 713, in build                                               
                                 await step(user_id=user_id, **kwargs)                                                                                                                                               
                                       |            |          -> {'fallback_to_env_vars': False}                                                                                                                    
                                       |            -> UUID('ea4fdc1e-2986-4aa0-8077-f6920cca09cd')                                                                                                                  
                                       -> <bound method Vertex._build of Vertex(display_name=Azure OpenAI Embeddings, id=AzureOpenAIEmbeddings-D3MlY, data={'type': 'Az...                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/graph/vertex/base.py", line 414, in _build                                              
                                 await self._get_and_instantiate_class(user_id, fallback_to_env_vars)                                                                                                                
                                       |    |                          |        -> False                                                                                                                             
                                       |    |                          -> UUID('ea4fdc1e-2986-4aa0-8077-f6920cca09cd')                                                                                               
                                       |    -> <function Vertex._get_and_instantiate_class at 0x10b339b40>                                                                                                           
                                       -> Vertex(display_name=Azure OpenAI Embeddings, id=AzureOpenAIEmbeddings-D3MlY, data={'type': 'AzureOpenAIEmbeddings', 'node': {...                                           
                             > File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/graph/vertex/base.py", line 618, in _get_and_instantiate_class                          
                                 result = await loading.instantiate_class(                                                                                                                                           
                                                |       -> <function instantiate_class at 0x106c2a560>                                                                                                               
                                                -> <module 'langflow.interface.initialize.loading' from '/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-p...                                  
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/interface/initialize/loading.py", line 39, in instantiate_class                         
                                 custom_component, build_results, artifacts = await build_component_and_get_results(                                                                                                 
                                                                                    -> <function build_component_and_get_results at 0x106c2a5f0>                                                                     
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/interface/initialize/loading.py", line 72, in                                           
                             build_component_and_get_results                                                                                                                                                         
                                 return await build_component(params=params_copy, custom_component=custom_component)                                                                                                 
                                              |                      |                             -> <langflow.utils.validate.AzureOpenAIEmbeddingsComponent object at 0x12be05630>                                 
                                              |                      -> {'api_key': '01483a6de7454f2f84b329a12268dd59', 'api_version': '2023-08-01-preview', 'azure_deployment': 'ms-chat-gpt-35-turb...             
                                              -> <function build_component at 0x10b3184c0>                                                                                                                           
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/interface/initialize/loading.py", line 146, in build_component                          
                                 build_results, artifacts = await custom_component.build_results()                                                                                                                   
                                                                  |                -> <function Component.build_results at 0x10b318040>                                                                              
                                                                  -> <langflow.utils.validate.AzureOpenAIEmbeddingsComponent object at 0x12be05630>                                                                  
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 136, in build_results                       
                                 return await self._build_with_tracing()                                                                                                                                             
                                              |    -> <function Component._build_with_tracing at 0x10b16feb0>                                                                                                        
                                              -> <langflow.utils.validate.AzureOpenAIEmbeddingsComponent object at 0x12be05630>                                                                                      
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 125, in _build_with_tracing                 
                                 _results, _artifacts = await self._build_results()                                                                                                                                  
                                                              |    -> <function Component._build_results at 0x10b3180d0>                                                                                             
                                                              -> <langflow.utils.validate.AzureOpenAIEmbeddingsComponent object at 0x12be05630>                                                                      
                               File "/Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 154, in _build_results                      
                                 result = method()                                                                                                                                                                   
                                          -> <bound method AzureOpenAIEmbeddingsComponent.build_embeddings of <langflow.utils.validate.AzureOpenAIEmbeddingsComponent obje...                                        
                               File "<string>", line 75, in build_embeddings                                                                                                                                         
                                                                                                                                                                                                                     
                             ValueError: Could not connect to AzureOpenAIEmbeddings API.                                                                                                                             
                                                                                                                                                                                                                     
                             ╭─────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────╮            
                             │ in build_embeddings:67                                                                                                                                                   │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/pydantic/v1/main.py:341 in __init__                                                       │            
                             │                                                                                                                                                                          │            
                             │    338 │   │   # Uses something other than `self` the first arg to allow "self" as a settable                                                                            │            
                             │        attribute                                                                                                                                                         │            
                             │    339 │   │   values, fields_set, validation_error =                                                                                                                    │            
                             │        validate_model(__pydantic_self__.__class__, data)                                                                                                                 │            
                             │    340 │   │   if validation_error:                                                                                                                                      │            
                             │ ❱  341 │   │   │   raise validation_error                                                                                                                                │            
                             │    342 │   │   try:                                                                                                                                                      │            
                             │    343 │   │   │   object_setattr(__pydantic_self__, '__dict__', values)                                                                                                 │            
                             │    344 │   │   except TypeError as e:                                                                                                                                    │            
                             ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯            
                             ValidationError: 1 validation error for AzureOpenAIEmbeddings                                                                                                                           
                             dimensions                                                                                                                                                                              
                               value is not a valid integer (type=type_error.integer)                                                                                                                                
                                                                                                                                                                                                                     
                             The above exception was the direct cause of the following exception:                                                                                                                    
                                                                                                                                                                                                                     
                             ╭─────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────╮            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/graph/vertex/base.py:618 in _get_and_instantiate_class                           │            
                             │                                                                                                                                                                          │            
                             │   615 │   │   if self.base_type is None:                                                                                                                                 │            
                             │   616 │   │   │   raise ValueError(f"Base type for vertex {self.display_name} not found")                                                                                │            
                             │   617 │   │   try:                                                                                                                                                       │            
                             │ ❱ 618 │   │   │   result = await loading.instantiate_class(                                                                                                              │            
                             │   619 │   │   │   │   user_id=user_id,                                                                                                                                   │            
                             │   620 │   │   │   │   fallback_to_env_vars=fallback_to_env_vars,                                                                                                         │            
                             │   621 │   │   │   │   vertex=self,                                                                                                                                       │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/interface/initialize/loading.py:39 in instantiate_class                          │            
                             │                                                                                                                                                                          │            
                             │    36 │   if not base_type:                                                                                                                                              │            
                             │    37 │   │   raise ValueError("No base type provided for vertex")                                                                                                       │            
                             │    38 │                                                                                                                                                                  │            
                             │ ❱  39 │   custom_component, build_results, artifacts = await build_component_and_get_results(                                                                            │            
                             │    40 │   │   params=params,                                                                                                                                             │            
                             │    41 │   │   vertex=vertex,                                                                                                                                             │            
                             │    42 │   │   user_id=user_id,                                                                                                                                           │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/interface/initialize/loading.py:72 in build_component_and_get_results            │            
                             │                                                                                                                                                                          │            
                             │    69 │   │   if base_type == "custom_components" and isinstance(custom_component,                                                                                       │            
                             │       CustomComponent):                                                                                                                                                  │            
                             │    70 │   │   │   return await build_custom_component(params=params_copy,                                                                                                │            
                             │       custom_component=custom_component)                                                                                                                                 │            
                             │    71 │   │   elif base_type == "component" and isinstance(custom_component, Component):                                                                                 │            
                             │ ❱  72 │   │   │   return await build_component(params=params_copy,                                                                                                       │            
                             │       custom_component=custom_component)                                                                                                                                 │            
                             │    73 │   │   else:                                                                                                                                                      │            
                             │    74 │   │   │   raise ValueError(f"Base type {base_type} not found.")                                                                                                  │            
                             │    75                                                                                                                                                                    │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/interface/initialize/loading.py:146 in build_component                           │            
                             │                                                                                                                                                                          │            
                             │   143 ):                                                                                                                                                                 │            
                             │   144 │   # Now set the params as attributes of the custom_component                                                                                                     │            
                             │   145 │   custom_component.set_attributes(params)                                                                                                                        │            
                             │ ❱ 146 │   build_results, artifacts = await custom_component.build_results()                                                                                              │            
                             │   147 │                                                                                                                                                                  │            
                             │   148 │   return custom_component, build_results, artifacts                                                                                                              │            
                             │   149                                                                                                                                                                    │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/custom/custom_component/component.py:136 in build_results                        │            
                             │                                                                                                                                                                          │            
                             │   133 │                                                                                                                                                                  │            
                             │   134 │   async def build_results(self):                                                                                                                                 │            
                             │   135 │   │   if self.tracing_service:                                                                                                                                   │            
                             │ ❱ 136 │   │   │   return await self._build_with_tracing()                                                                                                                │            
                             │   137 │   │   return await self._build_without_tracing()                                                                                                                 │            
                             │   138 │                                                                                                                                                                  │            
                             │   139 │   async def _build_results(self):                                                                                                                                │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/custom/custom_component/component.py:125 in _build_with_tracing                  │            
                             │                                                                                                                                                                          │            
                             │   122 │   │   inputs = self.get_trace_as_inputs()                                                                                                                        │            
                             │   123 │   │   metadata = self.get_trace_as_metadata()                                                                                                                    │            
                             │   124 │   │   async with self.tracing_service.trace_context(self.trace_name, self.trace_type,                                                                            │            
                             │       inputs, metadata):                                                                                                                                                 │            
                             │ ❱ 125 │   │   │   _results, _artifacts = await self._build_results()                                                                                                     │            
                             │   126 │   │   │   trace_name = self.tracing_service.run_name                                                                                                             │            
                             │   127 │   │   │   self.tracing_service.set_outputs(trace_name, _results)                                                                                                 │            
                             │   128                                                                                                                                                                    │            
                             │                                                                                                                                                                          │            
                             │ /Users/madhavansridharan/.pyenv/versions/langflow/lib/python3.10/site-packages/langflow/custom/custom_component/component.py:154 in _build_results                       │            
                             │                                                                                                                                                                          │            
                             │   151 │   │   │   │   │   if output.cache and output.value != UNDEFINED:                                                                                                 │            
                             │   152 │   │   │   │   │   │   _results[output.name] = output.value                                                                                                       │            
                             │   153 │   │   │   │   │   else:                                                                                                                                          │            
                             │ ❱ 154 │   │   │   │   │   │   result = method()                                                                                                                          │            
                             │   155 │   │   │   │   │   │   # If the method is asynchronous, we need to await it                                                                                       │            
                             │   156 │   │   │   │   │   │   if inspect.iscoroutinefunction(method):                                                                                                    │            
                             │   157 │   │   │   │   │   │   │   result = await result                                                                                                                  │            
                             │ in build_embeddings:75                                                                                                                                                   │            
                             ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯            
                             ValueError: Could not connect to AzureOpenAIEmbeddings API.
``` 

msmygit avatar Jul 08 '24 13:07 msmygit

Hi @msmygit,

Is the problem still there with langflow 1.0.9?

carlosrcoelho avatar Jul 17 '24 21:07 carlosrcoelho

Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to assist you.

carlosrcoelho avatar Jul 22 '24 13:07 carlosrcoelho