Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Name : Sahil Singh

PRN No. 120A1110


Batch : D2

API BASED AI Chatbot

Executive Summary:

The rapid growth of chatbots in recent years has led to the development
of more advanced and sophisticated bots, powered by Artificial
Intelligence (AI). OpenAI API-based Chat Bots are one such type of bot
that utilizes the OpenAI API to generate natural language responses.
These chatbots can be customized to meet specific business needs, and
they have the potential to improve customer engagement and
satisfaction.

Introduction:

The purpose of this report is to provide an overview of OpenAI API-based


Chat Bots. The report will cover the benefits of using OpenAI API for
chatbots, its features, and how it works. We will also examine the
potential use cases of OpenAI chatbots and explore the future of this
technology.

Benefits of OpenAI API-based Chat Bots:

OpenAI API-based Chat Bots have several benefits over traditional


chatbots. Firstly, they can provide more natural and engaging
conversations, thanks to the advanced natural language processing
capabilities of the OpenAI API. This allows for a more seamless
customer experience that can improve customer satisfaction and
retention rates.

Secondly, OpenAI API-based Chat Bots can be easily customized to meet


specific business needs. Companies can train the chatbot to understand
their industry-specific language, and provide relevant and accurate
responses to their customers.

Thirdly, OpenAI API-based Chat Bots are scalable and can handle a large
volume of customer queries. This can save time and resources for
businesses, as they can handle a high volume of customer inquiries
without requiring additional staff.

Features of OpenAI API-based Chat Bots:

OpenAI API-based Chat Bots have several key features that make them
unique. These include:

Natural Language Processing: The chatbot can understand and respond


to natural language, making conversations more engaging and seamless.

Customizable Responses: The chatbot can be trained to understand


specific industry language, and provide relevant and accurate responses
to customer queries.

Scalability: OpenAI chatbots can handle a large volume of customer


queries, reducing the need for additional customer service staff.
Multichannel Support: OpenAI API-based Chat Bots can be deployed
across multiple channels, including websites, social media platforms,
and messaging apps.

How OpenAI API-based Chat Bots Work:

OpenAI API-based Chat Bots work by using advanced natural language


processing techniques to generate responses to customer inquiries. The
bot can be trained on a specific dataset to understand industry-specific
language and respond accurately to customer queries.

The bot can be integrated with various channels such as a company's


website, social media platforms, and messaging apps. When a customer
sends a query, the bot processes the input and generates a response
based on the dataset and training it has received.

Potential Use Cases:

OpenAI API-based Chat Bots can be used in a wide range of industries,


including retail, finance, healthcare, and more. Some potential use cases
include:

Customer Service: OpenAI chatbots can be used to handle customer


queries and provide support to customers.

Sales and Marketing: OpenAI chatbots can be used to provide product


recommendations and upsell opportunities to customers.

Healthcare: OpenAI chatbots can be used to provide medical advice and


support to patients.
Finance: OpenAI chatbots can be used to provide financial advice and
support to customers.

Future of OpenAI API-based Chat Bots:


The future of OpenAI API-based Chat Bots is bright, with continued
growth and development expected in the coming years. With the
increased adoption of AI and machine learning in businesses, chatbots
are expected to become even more advanced, personalized, and human-
like. This technology will continue to revolutionize the way businesses
engage with their customers and provide support.

Code:-
import os
import openai
import gradio as gr

openai.api_key = "sk-
459iFC6LsffytoLApp9hT3BlbkFJdna7vghyBVxLsiSU1UlU"

start_sequence = "\nAI:"
restart_sequence = "\nHuman: "

prompt = "The following is a conversation with an AI assistant. The


assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello,
who are you?\nAI: I am an AI created by OpenAI. How can I help you
today?\nHuman: "
def openai_create(prompt):

response = openai.Completion.create(
model="text-davinci-003",
prompt=prompt,
temperature=0.9,
max_tokens=150,
top_p=1,
frequency_penalty=0,
presence_penalty=0.6,
stop=[" Human:", " AI:"]
)

return response.choices[0].text

def chatgpt_clone(input, history):


history = history or []
s = list(sum(history, ()))
s.append(input)
inp = ' '.join(s)
output = openai_create(inp)
history.append((input, output))
return history, history
block = gr.Blocks()

with block:
gr.Markdown("""<h1><center>ChatBot with OpenAI API &
Gradio</center></h1>
""")
chatbot = gr.Chatbot()
message = gr.Textbox(placeholder=prompt)
state = gr.State()
submit = gr.Button("SEND")
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot,
state])

block.launch(debug = True)

Output:-
Conclusion:-

In conclusion, OpenAI API-based Chat Bots are an innovative and


powerful tool for businesses looking to improve their customer
experience and streamline their operations. With their advanced natural
language processing capabilities and customizable responses, they
offer a more personalized and engaging experience for customers. As
the technology continues to evolve and develop, we can expect to see
even more exciting applications of this technology in the future.

You might also like