Blog image

Deploying my very own ChatGPT

Author image

Jakob Bjelvér

Sep 25, 20244 min

ChatbotAI

Not long ago, I had a dream about an AI chatbot application that was open source, even more powerful than ChatGPT, had support for multi-model deployment, knowledge-bases and customizable assistant roles.

Then I woke up.

As soon as I had remembered that coffee is keeping me alive, I started lazily browsing some trending GitHub libraries, just to gain enough consciousness to get started for the day. That's when I stumbled upon Lobe-Chat.

What's Lobe-Chat?

Lobe-chat is the exact application that I had in my definitely-true dream! Or just hear it from themselves:

An open-source, modern-design ChatGPT/LLMs UI/Framework.

Taken from their repo, they have these awesome features:

  • File Upload/Knowledge Base
  • Multi-Model Service Provider Support
  • Local Large Language Model (LLM) Support
  • Model Visual Recognition
  • TTS & STT Voice Conversation
  • Text to Image Generation
  • Plugin System (Function Calling)
  • Agent Market (GPTs)
  • Support Local / Remote Database
  • Support Multi-User Management
  • Progressive Web App (PWA)
  • Mobile Device Adaptation
  • Custom Themes

That's a lot. So, of course I had to give it a try!

Setting it up

It's possible to deploy Lobe-Chat with one click, and while that is great for getting started, the docs recommend an upstream rebase/merge approach to a patch/fork branch. This is so that you are able to add your own modifications to the code, while still enabling future updates from the original library source.

Then it went fast. I simply entered some API keys to an object database (S3), a relational database (Postgres), an auth service (Auth0), and voilà - it just worked. Well, actually I made some small changes to the source code, not because I had to, but because I was curious to learn its fundamentals and also wanting to customize the branding a bit.

How to use it

Using it is as easy as using ChatGPT - which it is obviously inspired from. Although with Lobe-Chat, the possibilities are many more. As of now, I have already integrated OpenAI's GPT-4, Google's Gemini 1.5 Pro, and Claude 3.5 Sonnet. I also created a knowledge base with all the Next.js docs, which makes the chatbot a sincere master in React SSR development. Although there are lots of more features to try out, as listed above, I am already satisfied and ready to declare it superior over ChatGPT and my $25 monthly premium subscription. And best of all - everything is self-deployed and fully within my own control.

Furthermore, there's also the option to self-host AI models and databases, making it the perfect application for enterprise use when privacy and cost are important aspects.

The benefits

I think this part is pretty self-explanatory, but since there are so many use-cases for self-deploying this software it has to be brought up separately.

First of all, is the possibility to make using "ChatGPT" practically free of charge. For those who have seen the bills that go for Copilot, or, like myself, had a running ChatGPT Premium subscription for too long, this is a huge benefit.

Secondly, the advanced features are something that is rarely seen with such cost-efficient solutions (usually it is the other way around). Being able to switch models mid-conversation, while having access to basically unlimited knowledge bases, while also enjoying AI's latest advancements in terms of multi-modal support for voice and image recognition, AND customized agents/assistants/roles/whatever-you-want-to-call-them is just fantastic.

Then there is the community support. Being open-source, you can imagine the number of versions, pull requests and closed issues this library has already seen. And, I found the documentation to also be sufficient enough for an intermediate-skilled user like myself.

There's always a catch

The hard but well-known truth is that companies exist to make money. While open-source can sometimes be the result of passionate individuals, this is at least not the exact case with Lobe-Chat and its creator LobeHub. They have a service called Lobe Cloud, which basically deploys the service for you, making the set-up time a short blink and also takes care of all the connections and back-office APIs. Also, if you're releasing your self-deployed application to the public, they charge a fee.

This is exactly what I love. The freemium model is great, and in combination with open-source projects that offer completely optional cloud services, this makes for an amazing developer experience.

Wrapping it up

So, I deployed my own, highly sophisticated, AI chatbot. It did not take more than an afternoon, and could've probably gone quicker than that. Yet, I've already realized the enormous gains of this and hope to be contributing to the library very soon.

If you are interested in checking out my deployment, please reach out to me at jakob@messerstudios.dev and I will add you to the allow list. I am not planning on distributing this tool, as I am happy enough using it internally, but if you are thinking of deploying it yourself I would be glad to inspire that.