Basic chatGPT chatbot

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:

  1. use firestore client side and listen to a document
  2. send the document uid with the question to the server
  3. 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”.

Happy coding :wink:

6 Likes

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?

2 Likes

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.

1 Like

You could offer it without the openai key, just make it with “ENTER_KEY_HERE”, no?

4 Likes

Sir, can you share its clone?

I don’t have a clone ready as its part of a larger application.
But if you get one started, im sure that someone will help you if question arise for you.

But can you please briefly tell me how to implement it?

He and others already have:

I put this in show and tell a while back: Anvil UI for OpenAI