top of page

Steps to a ChatGPT Bot

- It's actually really easy to create a ChatGPT Bot.

The first step is to install a text editor, like Notepad++, and an IDE, like Anaconda.

Next, make a file in your text editor and then add in code that is provided by OpenAI. It should look something like this:


openai.api_key = "yourkey"


import openai

import gradio as gr


messages = [{"role": "system", "content": "You are an AI that..."}]


def chatbot(input):

if input:

messages.append({"role": "user", "content": input})

chat = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages)

reply = chat.choices[0].message.content

messages.append({"role": "assistant", "content": reply})

return reply

inputs = gr.inputs.Textbox(lines=7, label="Chat with AI")

outputs = gr.outputs.Textbox(label="Reply")


gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot",

description="Ask anything you want",

theme="compact").launch(share=True)


- All you have to edit is one thing, which is what you want your bot to do. For example, if you want it to specialize in cheese, you could write:


messages = [{"role": "system", "content": "You are an AI that is an expert in everything cheese."}]


- Lastly, run your code on your IDE. Doing this could look something like this:



- Dont forget to be in the right directory or it won't work.

Have fun with your new bot!




4 views0 comments

Recent Posts

See All

Tai Chi on Parkinson’s Disease

In the serene dance of Tai Chi, an unexpected ally has emerged in the battle against Parkinson's disease. Parkinson's Disease, a neurodegenerative disorder, often robs individuals of their motor contr

Dementia: Sudden Decline

Dementia, a progressive and debilitating neurological disorder, has emerged as a global health challenge, affecting millions of individuals worldwide. One of the perplexing aspects of dementia is the

An overview of Neurodegenerative disorders

Neurodegenerative disorders encompass a diverse group of conditions characterized by the gradual deterioration of the nervous system. This essay explores the definition, classification, causes, and cl

Comments


bottom of page