💬Your first Chat Interaction

Have a chat conversation with your entity through APIs

If you have ever made a chatbot with the OpenAI API you will see that the basis is very similar.

Because OpenAI is so popular we wanted to create something more familiar and functional than private ;-)

Creating a Chatbot with MeetYou API and Gradio

Prerequisites To follow this guide, you will need:

  1. Basic understanding of Python programming.

  2. A Heritage or Infinity subscription in MeetYou.

  3. Python and pip installed on your machine.

  4. Access to a Terminal or Command Prompt.

Step 1: Setting up your MeetYou Account

Firstly, you will need to sign up for an account with MeetYou or log in to your existing account. Once you have access to your account:

  1. Go to the API section in your MeetYou Dashboard.

  2. Create a new API key and keep it safe. This is a crucial component that will allow your program to communicate with the MeetYou API.

Step 2: Setting up the Python Environment

Before proceeding, ensure you have Python installed on your machine. If not, you can download Python from their official website: https://www.python.org/downloads/. Once Python is installed, you can use pip to install the necessary Python packages.

  1. Open a Terminal or Command Prompt.

  2. Run the following commands to install the required Python packages:

shellCopy codepip install https://username:[email protected]/repo/python_module
pip install gradio

Step 3: Writing the Chatbot Code

Now, we will use Python to write a simple chatbot using the MeetYou API and Gradio.

Create a new Python file (for example, chatbot.py) and add the following Python code:

pythonCopy codeimport meetyou
import gradio as gr

# Set MeetYou API key
meetyou.api_key = 'your-api-key'

def chatbot(message):
    response = meetyou.chat.create(
        entity="name-of-your-entity",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": message}
        ]
    )
    return response.choices[0].message['content']

iface = gr.Interface(
    fn=chatbot,
    inputs="text",
    outputs="text",
    title="Chatbot",
    description="This is a interaction with my Entity by MeetYou.",
)
iface.launch()

Make sure to replace 'your-api-key' with your actual MeetYou API key and the 'name-of-your-entity' with the Entity you want to interact with.

Step 4: Running the Chatbot

To run your chatbot:

  1. Save your Python file.

  2. Open a Terminal or Command Prompt.

  3. Navigate to the directory containing your Python file.

  4. Run your Python file using the following command:

shellCopy codepython chatbot.py

You should now see a URL outputted to your Terminal or Command Prompt. Open this URL in a web browser to interact with your chatbot.

Please note that the text you input will be sent to MeetYou's API, and the resulting response from the API will be displayed as the chatbot's response.

Congratulations, you have successfully created a chatbot using the MeetYou API and Gradio!

Important Note

Please ensure you do not share or expose your API key in a public or insecure environment. It is a sensitive piece of information that could grant someone else access to your MeetYou account.

Last updated