I have created an openAI API using python, to respond to any type of prompt.
I want to make the API respond to requests that are only related to Ad from product description and greetings requests only and if the user sends a request that's not related to this task, the API should send a message like I'm not suitable for tasks like this.
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="Write a creative ad for the following product to run on Facebook aimed at parents:\n\nProduct: Learning Room is a virtual environment to help students from kindergarten to high school excel in school.",
temperature=0.5,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.0
)
I want to update the code to generate a chat like this. make bot understand generating ADs and greetings requests and ignoring the others
EX:-
user:- Hello
api:- Hello, How can I assist you today with your brand?
user:- Write a social media post for the following product to run on Facebook aimed at parents:\n\nProduct: Learning Room is a virtual environment to help students from kindergarten to high school excel in school.
api:- Are you looking for a way to give your child a head start in school? Look no further than Learning Room! Our virtual environment is designed to help students from kindergarten to high school excel in their studies. Our unique platform offers personalized learning plans, interactive activities, and real-time feedback to ensure your child is getting the most out of their education. Give your child the best chance to succeed in school with Learning Room!
user:- where is the united states located?
api:- I'm not suitable for this type of tasks.
So, How can update my code?