Introduction to Anthropic and Claude
I expect you will have heard of OpenAI and ChatGPT. But have you heard of Anthropic and Claude? Claude is Anthropic's response to ChatGPT, and it is a text generative tool powered by AI. I'm going to demo to you how to set it up with your Bubble app. I've not tried this before - I'm going to be following the API documentation, maybe making some mistakes along the way, but let's see how far I get.
Setting Up the API in Bubble
I've got a Bubble app here and I'm going to add in a new API and call this Anthropic. I'm going to authenticate in the header of the call. If I go into the documentation and look at authentication, I need to put the API key in the header. Okay, there we go. And what are some of the basic parameters that I need? Let's just use their example.
Configuring the API Call
So I have to add in another header of content type application/json. Let's just name this AI text generation. I think it's going to have to be post. And the endpoint is here - just that bit there. And then here's the data. I'm just going to put these on new lines so that it spaces it out a bit more.
Testing the API Call
Okay, right. I think I've now got everything there to test it out so let's initialize the call and see if we get any errors. No, we get a response and the response here is: "A haiku about trees: Rushing branches are reaching to the open sky, sheltering all below." There we go. There we have a working implementation of Claude's engine version 1 into a Bubble app.
Next Steps and Recommendations
From this point on, you could follow any of our other tutorials where we focus on using the Bubble API connector and how to get this to work in the front end. I would suggest that if you have access to Anthropic's API, you would carefully read through their API documentation here as there's a lot of very similar ways that it works compared to OpenAI, such as the use of tokens and stop sequences and temperature. But there are things I think you'd want to account for.
Comparing Anthropic to OpenAI
They basically give you very specific advice on how you lay out the content and your prompts that you send through. To be honest, it seems a little bit less versatile than OpenAI and ChatGPT, especially GPT-3.5 turbo and GPT-4. But this is definitely a company to keep an eye on, and that's one reason why we wanted to get a Bubble tutorial out there ASAP.
Conclusion and Feedback Request
So yeah, let me know - leave a message in the comments if you have used the Anthropic API or you've used their chat tool within the account. Let me know if you think that there is a difference. What differences do you notice between Anthropic and OpenAI? Leave it down in the comments. I'd be really interested to know.