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 environment widget example #10

Closed MarcSkovMadsen closed 1 year ago

MarcSkovMadsen commented 1 year ago

Builds on #3 and #26. Review those ones first!

The EnvironmentWidgetBase class enables you to manage variable values from a combination of

(listed by order of precedence)

For example you might not have the resources to provide an OPENAI_API_KEY, WEAVIATE_API_KEY or LANGCHAIN_API_KEY. In that case you would would like to ask the user for it.

Inherit from this widget to create your own custom EnvironmentWidget.

This widget can make it easy to run the app in different environments

image

After setting the WEAVIATE_API_KEY it looks like

image

See https://github.com/holoviz/panel/issues/5562 for more detail. Long term I think it could be useful if something like this was included in the Panel chat components.

ahuang11 commented 1 year ago

I wasn't aware that there's a langchain API key.

MarcSkovMadsen commented 1 year ago

Me neither. I just saw it in an example

ahuang11 commented 1 year ago

I don't think there's an api key for langchain. Couldn't find any docs for it; it's for OpenAI if that's what you meant. https://python.langchain.com/docs/get_started/quickstart#environment-setup

MarcSkovMadsen commented 1 year ago

At least Langchain puts an API key in their own docs. This is where I saw it. The key is probably for LangSmith. Have not tried it yet.

https://github.com/langchain-ai/chat-langchain

image

MarcSkovMadsen commented 1 year ago

I've merged with the current main branch. And everything should be ready to merge.

If you want, I can change the example to use another variable than the LANGCHAIN_API_KEY. Let me know.

If anything else is needed let me know.

codecov-commenter commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

:exclamation: No coverage uploaded for pull request base (main@d3b1d74). Click here to learn what that means.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #10 +/- ## ======================================= Coverage ? 93.65% ======================================= Files ? 2 Lines ? 63 Branches ? 0 ======================================= Hits ? 59 Misses ? 4 Partials ? 0 ```

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

ahuang11 commented 1 year ago

Thanks for contributing this! I'd love to migrate this into Panel too if Philipp agrees!