holoviz-topics / panel-chat-examples

Examples of Chat Bots using Panels chat features: Traditional, LLMs, AI Agents, LangChain, OpenAI etc
https://holoviz-topics.github.io/panel-chat-examples/
MIT License
107 stars 34 forks source link

Add an openai with function calls example #110

Closed MarcSkovMadsen closed 11 months ago

MarcSkovMadsen commented 11 months ago

This adds an openai with function calls example.

I've based it on hvPlot. A lot could be invested in polishing the tool_hvplot.json file such that most of hvplots api would be available.

Bugs and Feature Requests identified

When the bugs below are fixed or features implemented it would be possible to make this even more awesome.

Assets

chat-with-hvplot

ahuang11 commented 11 months ago

Looking to be great! Maybe @sophiamyang can write a blog post about this too :)

MarcSkovMadsen commented 11 months ago

This is ready for review.

One day someone with more time might

MarcSkovMadsen commented 11 months ago

All the openai tests fails. My guess is the OPENAI_API_KEY is no longer valid @ahuang11

ahuang11 commented 11 months ago

I refreshed the key.

Seems like it doesn't recognize the actions env key.

packages/bokeh/application/handlers/code_runner.py", line 229, in run
    exec(self._code, module.__dict__)
  File "/home/runner/work/panel-chat-examples/panel-chat-examples/docs/examples/openai/openai_authentication.py", line 58, in <module>
    aclient = AsyncOpenAI()
  File "/home/runner/.local/share/hatch/env/virtual/panel-chat-examples/wGgBc7bP/panel-chat-examples/lib/python3.9/site-packages/openai/_client.py", line 303, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
ahuang11 commented 11 months ago

Trying to fix it here. https://github.com/holoviz-topics/panel-chat-examples/pull/112

ahuang11 commented 11 months ago

I will review this in detail tomorrow.

MarcSkovMadsen commented 11 months ago

Try adding a hvPlot argument to the tool_hvplot.json file and then play around with it in the chat interface. Its quite fun and a good learning experience.

ahuang11 commented 11 months ago

Okay looks good to me!