CustomGPT.ai Blog

Envision the Possibilities: A Beginner’s Guide to the CustomGPT.ai RAG API (Part 1)

[This is Part 1 of a Multi-Part Series on the CustomGPT.ai RAG API]

Beginner’s Guide to the CustomGPT.ai RAG API

In the dynamic world of technology, the API serves as bridges connecting otherwise disconnected software systems. Short for “Application Programming Interfaces,” these APIs are like digital negotiators, establishing a set of rules—or “contracts”—that allow for the smooth exchange of information.

They simplify complexity, much like a messaging app does when you text a friend: you type your message, press send, and it’s delivered, all without needing to know the technicalities of the transmission process.

APIs work under a similar premise. They’re the invisible messengers, relaying requests and responses back and forth between applications and systems. These “contracts” ensure that all parties involved agree on how to structure the requests and what to expect in response, making it possible for different software to integrate and function as a cohesive unit without the end-user having to manage or even understand the underlying code and protocols.

Universal API Access Across All Plans ????

At CustomGPT.ai, we stand firm in the belief that the power of AI should be readily accessible to all, regardless of the plan you choose. This is why we’ve made our API available across all our subscription tiers – Basic, Standard, Premium, and Enterprise. Our conviction is that by granting every customer this level of access, we’re not just opening a door to advanced technology; we’re providing a gateway to endless possibilities.

Understanding the CustomGPT.ai RAG API

CustomGPT.ai RAG API connects different software systems to chat with each other, similar to how your messenger apps share information. 

The cool part? As mentioned above, every CustomGPT.ai plan (Basic, Standard, Premium, and Enterprise) comes with access to this RAG API, making it available to everyone. 

image 118

It means you can smoothly connect CustomGPT.ai with your existing tools and processes, making your operations smarter and more efficient.

But wait, there’s more – if you’re into integrating apps, CustomGPT.ai has a handy Zapier app that links the RAG API with over 5,000+ different systems. This fantastic flexibility is why RAG API access is part of all CustomGPT.ai plans. It’s about giving you the power to make your technology work better together, effortlessly.

To further explore CustomGPT.ai RAG API let’s have a look at how you can programmatically build a chatbot and query it. In this article, we will help you create your CustomGPT.ai account, get your RAG API key, and make your first RAG API call. Let’s get started! 

CustomGPT.ai RAG API: A Step-by-Step Guide to Building and Querying Your Chatbot

Create CustomGPT.ai account

To set up your CustomGPT.ai account, you need to follow a few steps:

create account
  • Now fill the blocks with the required work email. 
registration page
  • Click on Signup and your account will be created.
sign up

Get your API key

  • To get your API key go to your profile and click on API.
api
  • Now click on the Create API key.
create api key
  • And your RAG API key will be generated. You have to save this key somewhere safe because CustomGPT.ai takes security and privacy as its priority. So, the key will not be visible to your CustomGPT.ai account.
copy api
  • In some cases, if you lose your RAG API key, you can generate a new RAG API key.
copy api key

Make your First RAG API Call

Now let’s have a look at how you can build and query your chatbot programmatically using CustomGPT.ai RAG API.

Step 1: Select your environment

In this post, I am using Jupyter Notebook. It’s a free web-based tool you can use to write and run your Python code. Alternatively, you could other free tools, like Google Collab, Kaggle or even on your command line. Sign up for an account before continuing.

Step 2: Install all the dependencies

Use !pip install customgpt client to download all the dependencies.

image 109

Now Run this command in Jupyter Notebook and it will download and install the necessary files for using the CustomGPT.ai API through Python code.

image 116

Step 3: Use your CustomGPT.ai RAG API key

The next step is to import the CustomGPT.ai class from the customgpt-client library. 

  • from customgpt_client import CustomGPT
  • CustomGPT.api_key = “YOUR_API_TOKEN”
image 113

In ‘YOUR API TOKEN’, place the actual RAG API key. That we generated from the CustomGPT.ai account.

Step 4: Creating Chatbot using CustomGPT.ai RAG API

The next step is to create a chatbot using a sitemap. 

image 120

The above code is creating a chatbot project using the CustomGPT.ai RAG API. Here’s a simple explanation:

Project Name: The variable project_name gives a name to the chatbot project, in this case, it’s named ‘Example ChatBot using Sitemap.’

Sitemap: The variable sitemap_path specifies the sitemap on which the chatbot will be trained.

Create Project: The CustomGPT.Project.create function create the chatbot with the given chatbot name and sitemap_path.

Print Result: The print(create_project) line displays the result of creating the project. It includes information about the project status and project_id details.

In simple terms, this code sets up a chatbot project named ‘Example ChatBot using Sitemap’ and uses a specific sitemap to help the chatbot understand the content of a website. The print statement shows the result of this setup.

I am creating a chatbot by giving it the name My Assistant and using the sitemap of an entrepreneur’s website to train my chatbot. 

image 121

After running the lines of code with Name and Sitemap, the chatbot is successfully created. You can see the generated response after running the code. This generated response also contains your project_id.

Step 5: Check if the Chatbot is Created/Active

Now it’s time to check if the chatbot is active or not. To do this enter your project_id that we get from previous generated responses and place it in the following lines of code. 

Write your project_id like this

  • project_id = 12778

Check if the chatbot is active using the `is_chat_active` flag in the project detail response

  • get_project = CustomGPT.Project.get(project_id=project_id)
  • project_data = get_project.parsed
  • is_chat_active = project_data.data.is_chat_active

print(is_chat_active)

  • If the chatbot is Active the print function then generates the answer as True and if the chatbot is not active the responses generated will be False
image 112

Now run the code to check if the chatbot ‘My Assistant’ is active or not.

image 115

The response generated is True which shows that chatbot My Assistant is working. You can also see in the CustomGPT.ai interface that the chatbot is created.

ask

You can also see the sitemap that I used in my Python code to generate the chatbot.

add website

Let’s Recap!

Whew! We covered a lot of ground. We’ve covered what APIs are and how they work, introduced you to CustomGPT.ai’s RAG API, and walked you through the initial steps of creating a chatbot—from setting up your account to crafting your first chatbot with a sitemap.

You’ve seen how accessible and straightforward it is to start integrating AI into your operations with CustomGPT.ai!

In Part Two, we’ll explore querying your chatbot and the nuances of streaming responses. Plus, we’ll break down the request and response structure for clear communication with your CustomGPT.ai chatbot.

See you in the next post!

Build a Custom GPT for your business, in minutes.

Deliver exceptional customer experiences and maximize employee efficiency with custom AI agents.

Trusted by thousands of organizations worldwide

Related posts

Leave a reply

Your email address will not be published. Required fields are marked *

*

3x productivity.
Cut costs in half.

Launch a custom AI agent in minutes.

Instantly access all your data.
Automate customer service.
Streamline employee training.
Accelerate research.
Gain customer insights.

Try 100% free. Cancel anytime.