Spaces:
Sleeping
Sleeping
Download scripts/chat.py from pchalasani/langroid-app: direct link, hf CLI and curl.
- Browser
- Download file 657 Bytes
-
https://huggingface.co/spaces/pchalasani/langroid-app/resolve/main/scripts/chat.py
- Command line
-
hf download hf://spaces/pchalasani/langroid-app/scripts/chat.py
-
curl -L -o chat.py https://huggingface.co/spaces/pchalasani/langroid-app/resolve/main/scripts/chat.py
657 Bytes
| """ | |
| Absolute bare-bones way to set up a simple chatbot using all default settings, | |
| using a Langroid Task + callbacks. | |
| After setting up the virtual env as in README, | |
| and you have your OpenAI API Key in the .env file, run like this: | |
| chainlit run examples/chainlit/simplest.py | |
| """ | |
| import langroid as lr | |
| import langroid.language_models as lm | |
| import chainlit as cl | |
| async def on_chat_start(): | |
| lm_config = lm.OpenAIGPTConfig() | |
| agent = lr.ChatAgent(lr.ChatAgentConfig(llm=lm_config)) | |
| task = lr.Task(agent, interactive=True) | |
| msg = "Help me with some questions" | |
| lr.ChainlitTaskCallbacks(task) | |
| await task.run_async(msg) | |