Closed droumis closed 2 months ago
I think the case o
isn't assigned to is if obj
is empty. I think it would need len(obj) > 0
, but strange that it broke on running the dashboard.
def _serialize(self, obj):
if isinstance(obj, (Tabs, Column)) and len(obj) > 0:
for o in obj:
if hasattr(o, "visible") and o.visible:
break
return self._serialize(o)
The actual error was a missing openai API key
lumen/ai/assistant.py
python 3.12
In the code below, if
obj
itself has the 'visible' attribute True, then this breaks aso
never is assigned to.All I did was run the dashboard and click on a prompt to generate this issue
Code
```python import pathlib import lumen as lm import lumen.ai as lmai import panel as pn from lumen.sources.duckdb import DuckDBSource pn.extension("tabulator", "codeeditor", inline=False, template="fast") llm = lmai.llm.OpenAI() lmai.memory["current_source"] = DuckDBSource( tables=["read_parquet('windturbines.parq')"], uri=":memory:", initializers=["INSTALL httpfs;", "LOAD httpfs;"], ) assistant = lmai.Assistant( llm=llm, agents=[ lmai.agents.SourceAgent, lmai.agents.TableAgent, lmai.agents.TableListAgent, lmai.agents.SQLAgent, lmai.agents.PipelineAgent, lmai.agents.hvPlotAgent, lmai.agents.ChatAgent, ], ) assistant.servable("Lumen.ai") assistant.controls().servable(area="sidebar") ```