You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import panel as pn
from lumen.views import Panel
import holoviews as hv
column = pn.Column(pn.pane.HoloViews(
hv.Curve([0, 1])
))
Panel(object=column).to_spec()
Traceback (most recent call last):
File "/Users/ahuang/repos/panel/panel/io/server.py", line 138, in wrapped
return await func(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/repos/lumen/lumen/ai/coordinator.py", line 245, in use_suggestion
await agent.respond(
File "/Users/ahuang/repos/lumen/lumen/ai/agents.py", line 988, in respond
spec = view.to_spec()
^^^^^^^^^^^^^^
File "/Users/ahuang/repos/lumen/lumen/views/base.py", line 723, in to_spec
spec['object'] = self._serialize_object(self.object)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/repos/lumen/lumen/views/base.py", line 707, in _serialize_object
self._serialize_object(child, objects=objects, refs=refs, depth=depth+1)
File "/Users/ahuang/repos/lumen/lumen/views/base.py", line 711, in _serialize_object
value = obj.param.serialize_value(p)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/site-packages/param/parameterized.py", line 2601, in serialize_value
return serializer.serialize_parameter_value(self_or_cls, pname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/site-packages/param/serializer.py", line 139, in serialize_parameter_value
return cls.dumps(pobj.param[pname].serialize(value))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/site-packages/param/serializer.py", line 81, in dumps
return json.dumps(obj)
^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/Users/ahuang/miniconda3/envs/lumen/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Curve is not JSON serializable
frompydocimporttextimportnumpyasnpimportpandasaspdimportlumen.aiaslmaiimportparamimporthvplot.pandasimportnumpyasnpimportpanelaspnimportpandasaspdimportlumen.aiaslmaifromlumen.sources.duckdbimportDuckDBSourceclassWindAnalysis(lmai.Analysis):
""" Calculates the wind speed and direction from the u and v components of wind, displaying both the table and meteogram. """columns=param.List(default=["time", "u", "v"])
def__call__(self, pipeline):
df=pipeline.datadf["wind_speed"] =np.sqrt(
df["u"] **2+df["v"] **2
)
# Calculate wind direction in degrees (from north)df["wind_direction"] =np.degrees(
np.arctan2(df["u"], df["v"])
)
# Ensure wind direction is in the range [0, 360)df["wind_direction"] = (df["wind_direction"] +360) %360overlay=df.hvplot.line(
x="time",
y="wind_speed",
title="Wind Speed",
ylabel="Wind Speed (m/s)",
)
returnpn.Column(
pn.pane.HoloViews(overlay),
pn.widgets.Tabulator(df)
)
llm=lmai.llm.OpenAI()
uv_df=pd.DataFrame({
"time": pd.date_range('2024-11-11', '2024-11-22'),
"u": np.random.rand(12),
"v": np.random.rand(12)
})
source=lmai.memory["source"] =DuckDBSource.from_df({"uv_df": uv_df})
analysis_agent=lmai.agents.AnalysisAgent(analyses=[WindAnalysis])
ui=lmai.ExplorerUI(llm=llm, agents=[analysis_agent])
ui.servable()
The text was updated successfully, but these errors were encountered:
I thought this would work with #848
The text was updated successfully, but these errors were encountered: