Welcome to part 2 of building with ChatGPT, where I try to build a ChatGPT powered app... with the help of ChatGPT. If you've missed part 1 of this personal blog series, go check it out here:
TL;DR? Here's a short recap:
- We want to build an app that is powered by ChatGPT.
- The idea is that solo startup founders can ask different experts - like marketing experts or technology experts - for advice for their startup.
- The app essentially is a frontend for ChatGPT, in which the user can talk to different AI experts that have been initialised with well-written prompts and have been given contextual information about the startup.
Using ChatGPT for Coding
At first I wanted to code the app in Python, but I realised about after half an hour that it would be more interesting to create the application using a programming language that I am not familar with and having ChatGPT help me to learn how effective ChatGPT is at coding. What I wanted to get from ChatGPT was fully working node.js code that I could just use inside of a software development environment.
Here's the initial prompt I sent:
Please create a node.js and react application. Broadly speaking, the app should integrate with OpenAI's ChatGPT and provide the user with a way to interact with a few different ChatGPT "personas" (similar to how you would interact with different people in a chat application). I want the application to consist of these windows: 1) A sidebar, containing the different personas that the user can click on to start a "chat" with that persona 2) A main area, containing the chat history and a way for the user to send input Please optimise the app for desktop usage.
What I got back was helpful, but not what I was looking for: ChatGPT told me that it can't build fully functioning graphical applications and instead gave me very broad instructions and a list of resources for me to look at to create a node.js application.
But I really don't want to learn node.js... so let's try another prompt. This time I'm specifiying that I want server-side code since the first response indicated that ChatGPT had problems with the graphical user interface. I resend the previous prompt with one added line:
Please provide all the server-side code.
And we're now getting some code back! Unfortunately ChatGPT has a character limit when it comes to responses, so it just stopped in the middle. I wrote
and ChatGPT continued giving me code, but it messed up the formatting a little bit (which doesn't really matter that much, more of an annoyance).
What is more interesting is that ChatGPT now doesn't just provide the server-side code, but also the graphical user interface! That just goes to show that sometimes you need to send in multiple similar prompt if you're not getting the response you expected.
After I copy-pasted all the code that was provided into my Visual Code project I wanted to to start the app that ChatGPT developed. But since I know next to nothing about web development, I had to ask ChatGPT:
how do I start the server
And 🥁... it does not work. I had to fix one small error with how the created code called the OpenAI API (I assume that this is because ChatGPT has no knowledge beyond 2021 and that the API was changed after that). Still, this is quite remarkable - even though this is just a bare-bones app without much actual functionality.
Next I wanted to use ChatGPT to get the app fully functional, but instead I got distrcated by everything that was happening on Twitter in the AI world.
BabyAGI, AutoGPT and Langchain
AI has moved at lighting speed in recent weeks. Multiple new AI tools are being released every day and it seems like every week there's something more revolutionary created by someone. Probably the three most important projects are BabyAGI, AutoGPT and Langchain.
BabyAGI is a task-driven autonomous agent. The main concept behind these agents is that they run in a loop - creating tasks based on the results of the previous instructions. Here's a quick & simplified sketch of what that looks like at a high level:
BabyAGI itself is a Python script that is usable with Docker. Here's two interesting examples that show what people have used it for:
AutoGPT is very similar to BabyAGI, with the main difference being that AutoGPT can also interact with the "world" - it can for example connect to the internet & use Google (giving it access to up-to-date information) or execute Python code.
Here's someone who used AutoGPT to get the best 5 waterproof shoes - with AutoGPT going as far as checking for fake reviews by itself:
LangChain is a framework for developing AI applications. It's objectives are to enable data-aware and agentic apps, meaning:
- Apps that are data aware - eg letting ChatGPT answer questions about your companies internal Notion pages.
- Apps that interact with the environment - eg allowing ChatGPT to interact with weather APIs on the internet.
Langchain also abstracts different parts of the "AI stack" by for example allowing you to quickly replace OpenAI's LLM with HuggingFace's. Both BabyAGI and AutoGPT are built using Langchain.
Here's some more things that people have used Langchain for:
If you'd like to know more about BabyAGI, AutoGPT and Langchain, go and check out our reading recommendation:
Next week we'll do a a quick experiment with Langchain to see if we can make use of it in our app!