LogoLogo
  • 👋Welcome to Gaia
    • 🌍Translations
  • 👣First Steps
  • Getting Started as a Developer
    • ✍️Contribute to the Open Source Project
      • 👩‍💻Code
      • 📄Documentation
      • 👯Community
    • ⌨️Setting up your Node
      • Customizing your node
      • Joining the protocol
      • 🔨Agent Integrations and Plugins
      • Troubleshooting your node
    • 💵Apply for a bounty
    • 📑Guides and Tutorials
      • 🏁Creating a Formula 1 Chatbot
  • About GaiaNet
    • 🎯Mission, Values & Goals
    • 🔧Network Components
    • ⚖️Governance Process
    • 🔐Privacy & Security
Powered by GitBook
On this page
  • Overview
  • What is Gaia?
  • Installing a Gaia Node on your system
  • Building a Knowledge Base
  • Preparing the F1 Data
  • Building your knowledge base and embedding model
  • Configuring your GaiaNet node
  • Testing your F1 Agent

Was this helpful?

  1. Getting Started as a Developer
  2. Guides and Tutorials

Creating a Formula 1 Chatbot

Use this tutorial to learn how to build a chatbot customized with Formula 1 data.

PreviousGuides and TutorialsNextMission, Values & Goals

Last updated 8 months ago

Was this helpful?

Overview

This guide will help you develop a specialized AI agent using Gaia. In this example, we are building a chatbot specializing in Formula 1 data that will respond to inquiries around its history, competitions, and regulations. This guide will show you how to set up a Gaia node, build a knowledge base, and launch a customized LLM chatbot. By the end of this guide, we will have a live chatbot that will answer F1 inquiries.

What is Gaia?

Gaia is a decentralized computing infrastructure that enables everyone to create, deploy, scale, and monetize their own AI agents that reflect their styles, values, knowledge, and expertise. It allows individuals and businesses to create AI agents.

Each GaiaNet node provides:

  • a web-based chatbot UI

  • an OpenAI compatible API

Installing a Gaia Node on your system

Before we begin building our F1 chatbot, we must first install a node on your system. A Gaia node can be installed on a variety of devices and operating systems. For more information, check out the

Let’s quickly get a node installed on your system.

  1. Using your terminal, run this script to download the latest version of the GaiaNet node:

curl -sSfL 'https://github.com/GaiaNet-AI/gaianet-node/releases/latest/download/install.sh' | bash`
Image displaying a successful node installation
  • After you run the script, you will see the following in your terminal:

    • Node ID

    • A command that will make the GaiaNet CLI tool available within the shell

    • A command that will allow you to initialize the node.

  1. Run the command that will make the CLI tool available, it will begin with source.

  2. Initialize your node by using the gaianet init command. The CLI tool will help you download the models and recover the knowledge embeddings.

  3. After you’ve initialized the node, start it by using the gaianet start command.

Congrats! You’ve installed and started your GaiaNet node! Now that we have completed our initial step, we can start preparing our F1 chatbot.

Building a Knowledge Base

Preparing the F1 Data

Our Gaia node is up and running, so now we need to prepare our F1 data. Data preparation takes the following steps:

  1. Aggregating data sources

  2. Creating a .txt file and adding data.

  3. Segmenting the data

For this tutorial, we will be using the following data sources to train our chatbot:

Your .txt file must be structured with clear sections under 768 words.

Example

The following example demonstrates the structure of the .txt file and how it should be formatted. If your file is under 768 words, then you do not need line breaks. If your file is over 768 words then you will need line breaks.

What is Formula One or F1 or FIA World Championship?
Formula One, commonly known as Formula 1 or F1, is the highest class of international racing for open-wheel single-seater formula racing cars sanctioned by the Fédération Internationale de l'Automobile (FIA). The FIA Formula One World Championship has been one of the world's premier forms of racing since its inaugural running in 1950. The word formula in the name refers to the set of rules all participants' cars must follow. A Formula One season consists of a series of races, known as Grands Prix. Grands Prix take place in multiple countries and continents on either purpose-built circuits or closed public roads. A point-system is used at Grands Prix to determine two annual World Championships: one for the drivers, and one for the constructors (the teams). 
What is Formula One or F1 or FIA World Championship?
Each driver must hold a valid Super Licence, the highest class of racing licence the FIA issues, and the races must be held on grade one tracks, the highest grade rating the FIA issues for tracks. Formula One cars are the world's fastest regulated road-course racing cars, owing to very high cornering speeds achieved by generating large amounts of aerodynamic downforce. Much of this downforce is generated by front and rear wings, which have the side effect of causing severe turbulence behind each car. The turbulence reduces the downforce the cars following directly behind generate, making it hard to overtake. 
What is Formula One or F1 or FIA World Championship?
Major changes made to the cars for the 2022 season have resulted in greater use of ground effect aerodynamics and modified wings to reduce the turbulence behind the cars, with the goal of making overtaking easier. The cars depend on electronics, aerodynamics, suspension, and tyres. Traction control, launch control, and automatic shifting, and other electronic driving aids were first banned in 1994. They were briefly reintroduced in 2001, and have more recently been banned since 2004 and 2008, respectively. With the average annual cost of running a team—designing, building, and maintaining cars, pay, transport—at approximately £220,000,000 (or $265,000,000), Formula One's financial and political battles are widely reported. 
What is Formula One or F1 or FIA World Championship?
The Formula One Group is owned by Liberty Media, which acquired it in 2017 from private-equity firm CVC Capital Partners for £6.4 billion ($8 billion).

Building your knowledge base and embedding model

Now that the data has been aggregated, it will be converted into a vector database. For this tutorial, we will be using the GaiaNet tool that was developed to make vector collection snapshot files. This tool makes it easy for everyone to create their own knowledge base.

  1. First, you’ll upload the .txt file created earlier into the tool by either dragging the file or uploading it.

  2. In the “snapshot_name” section, provide a name for the snapshot.

The snapshot name should not have any special characters or spaces

  1. Click “Make a RAG,” this process can take a few minutes depending on the size of your file.

  2. After the RAG has been created, a JSON response will be generated and will look something like this:

{
"embedding": "https://huggingface.co/gaianet/nomic-embed-text-gguf/resolve/main/nomic-embed-text-v1.5.f16.gguf",
"embedding_ctx_size": "8192",
"embedding_batch_size": "8192",
"snapshot": "https://huggingface.co/datasets/max-id/gaianet-qdrant-snapshot/resolve/main/formula1-b38b0f78-374b-44cc-a7ad-5157e7867760/formula1-b38b0f78-374b-44cc-a7ad-5157e7867760.snapshot"
}

Congrats, you’ve made your RAG and we will proceed to configuring your node!

Configuring your GaiaNet node

So far, we’ve installed a node on our system, built a knowledge base, and made a RAG for our Formula 1 data. We now have to configure our node to use our F1 knowledge base.

gaianet config \
--snapshot https://huggingface.co/datasets/max-id/gaianet-qdrant-snapshot/resolve/main/formula1-b38b0f78-374b-44cc-a7ad-5157e7867760/formula1-b38b0f78-374b-44cc-a7ad-5157e7867760.snapshot \
--embedding-url https://huggingface.co/gaianet/nomic-embed-text-gguf/resolve/main/nomic-embed-text-v1.5.f16.gguf \
--embedding-ctx-size 8192 \
--chat-url https://huggingface.co/gaianet/Meta-Llama-3.1-8B-Instruct-GGUF/resolve/main/Meta-Llama-3.1-8B-Instruct-Q5_K_M.gguf \
--chat-ctx-size 8192 \
--prompt-template llama-3-chat \
--system-prompt "You are an expert in Formula 1, with deep knowledge of race history, driver statistics and team strategies. Provide brief and accurate answers to questions about F1. Pay special attention to formatting-use bullet points, bolding and line breaks to make the text easier to read." \
--rag-prompt "The following text is the context for the user question. \n----------------\n"
  1. Update the configuration changes:

gaianet init
gaianet start

Now that your node is restarted and configured with the Formula 1 data, the fun now begins!

Testing your F1 Agent

Use the node URL that was generated when your node was first created, to access the agent and test it out.

Image displaying a successful node initialization

Update the LLM model, we will use a model with better performance than the default. Run this code to update with :

Voila! You now have a Gaia node that has been configured to be a Formula 1 chatbot!
📑
🏁
https://en.wikipedia.org/wiki/List_of_Formula_One_World_Drivers%27_Champions
https://en.wikipedia.org/wiki/Formula_One_regulations
https://en.wikipedia.org/wiki/List_of_Formula_One_drivers_who_set_a_fastest_lap
https://en.wikipedia.org/wiki/Formula_One
Meta Llama 3.1-8B
System Requirements.
Gaianet Tools
Image displaying GaiaNet web tool