Has anyone encountered a decent implementation of a chatGPT based conversational chatbot based on Anvil?
The best I could find is
which is (1) broken with bugs (2) pretty poor implementation
If Anvil wants to stay on par with its competitors (streamlit, gradio, etc) with the buzz around chatbots, I think its time to have a basic implementation.
One simple way to get a full chat gpt feeling in anvil is:
- use firestore client side and listen to a document
- send the document uid with the question to the server
- start a server call/background-task where you stream the openai answer to the firestore document.
Thats scalabe, fast & relatively easy to set up.
(Did it myself and works like a charm)
Also some friendly advice, the chance of getting an answer will (1) be higher if you don’t shit on other peoples implementations and (2) if you don’t threat people with their “competitors”.
It would be nice to have a tutorial or updated example but there are no Anvil enhancements needed to make this work. It is a matter of using the relevant Python library in the server code to get responses to questions.
I created a chatbot with LangChain in the server code and streamed responses via background tasks, similar to Mark’s approach but without Firestore. See this thread: How to stream data from server to client?
ive built one for myself which i dont make public because its on my own api key which i pay for. It is trivial to make using the openai python module. more so than this I think it would be a gamechanger to integrate the ide with chatgpt. i already use it to help write my anvil apps where i paste in some example code so it understands the structure and components that are available and then i ask it to write functions.
You could offer it without the openai key, just make it with “ENTER_KEY_HERE”, no?