holoviz / lumen

Illuminate your data.
https://lumen.holoviz.org
BSD 3-Clause "New" or "Revised" License
173 stars 19 forks source link

Add mistral support #697

Closed ahuang11 closed 1 week ago

ahuang11 commented 1 month ago

Seems to work, even with mistral-small; haven't tested the Azure one though.

Maybe can use codestral for the SQL https://docs.mistral.ai/getting-started/models/#overview


import lumen.ai as lmai
import panel as pn

from lumen.sources.duckdb import DuckDBSource
from lumen.ai.analysis import Join

pn.extension(
    "tabulator",
    "codeeditor",
    "vega",
    inline=False,
    template="fast",
    notifications=True,
)

llm = lmai.llm.MistralAI()

cs = lmai.memory["current_source"] = DuckDBSource(
    tables=["windturbines.parquet"],
    uri=":memory:",
    initializers=["INSTALL httpfs;", "LOAD httpfs;"],
)

custom_agent = lmai.agents.AnalysisAgent(analyses=[Join])

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,
        custom_agent,
    ],
)
assistant.servable("Lumen.ai")
assistant.controls().servable(area="sidebar")
image image
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 62 lines in your changes missing coverage. Please review.

Project coverage is 56.33%. Comparing base (fdbfc66) to head (e726d28). Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lumen/ai/llm.py 0.00% 62 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #697 +/- ## ========================================== - Coverage 56.61% 56.33% -0.28% ========================================== Files 98 98 Lines 11694 11751 +57 ========================================== Hits 6620 6620 - Misses 5074 5131 +57 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.