openai gpt-3 is asking random question in return of user query when using apis - openai-api

I am using Open AI api with these parameters
resp = OpenAIBot.__openai_instance__.Completion.create(model="text-davinci-003",
prompt=prompt,
temperature=0.9,
max_tokens=250,
top_p=1,
frequency_penalty=0,
presence_penalty=0.6,
user=botRequest.senderId,
stop=[" Human:", " AI:"]
)
this is first prompt that I am sending
"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 are you feeling today?"
to which user answers with good
to which bot replies like this
The following is a conversation with an AI assistant. The assistant is helpful,
creative, clever, and very friendly.\n\n
Human: Hello, who are you?\n
AI: I am an AI created by OpenAI. How are you feeling today?\n
Human: good\n
AI: , thanks for asking. What do you do?\n
AI: I specialize in providing helpful, creative, and intelligent
assistance for people who need it. From searching the web for information to
helping you stay organized and productive, I'm here to make your life easier.
it automatically appends the questions like thanks for asking. What do you do which are not relative.
If i chat on open ai playground with same parameters that I am using, it behaves properly and maintains the context.
Same query context that open ai playground uses I am sending to open ai api. What can be the issue how can I fix this?

Related

Dialogflow works in test console, but not via google assistant

I have a smart home dialogflow webhook working from the google actions test console, but when I speak to a google home device, there is no sign that my intents are being recognized. E.g., I enter “Home temperature?” in the console, I can see it calling my webhook, executing my script, and responding with “The temperature is 72 degrees.”
But when I say: “Hey Google, Home temperature” to my google home device, it says my nest device is not registered, or something like that. I.e., it is what it would say if I did not have smart home action intents registered with google actions.
I am unable to find anything in the docs or by web searches which says what I am supposed to do to get my google assistant devices to recognize my custom intent phrases.
Does anyone have this working? The Smart Home integration is not supposed to require a lead in, like “Hey Google, Ask whoever, Home temperature”, Right? That is only for “conversation mode” integrations, correct? My understanding is that “Smart Home” mode does not require a lead-in. Please correct me if that is incorrect…
Either way, my voice requests through my Google Home are not recognized.
Please, any advice for what I am missing or how I can troubleshoot this?
Thanks!
P.S. I'm new to Stack Overflow, and I didn't find this "dialogflow" group until posting in another group. So I am reposting here. Sorry if this is redundant. I could not find how to delete the original post...
It sounds like I was wrong about the "Hey Google, talk to ..." requirement for Dialogflow.
The "Smart Home" mode does not preclude this. You cannot just say, "Hey Google, home temperature?", you have to say, "Hey Google, ask [my dialogflow app], home temperature?"
Furthermore, unless you Publish your app, the response will always say, "Alright, here's the test version of [my dialogflow app]...
Between the two, it pretty much ruins it for me... Off to the drawing board.

The words "not working" always trigger the default intent in Google Assistant

I have been working with Google Dialogflow to create a Google Assistant experience.
My GA Action is to Raise Support tickets and those tickets are raised in our system via API.
We ask the user to describe the Issue they are facing, We have used a fallback Intent to capture the Issue/Ticket Description(Since the reply can be any free text, is this the best way to capture free text?).
Once the user gives a description, A webhook is called and the results are sent to our backend to capture.
We have noticed that when the user uses the words "not working" as a part of the issue description, it always calls the welcome intent, instead of going to the follow up Intent. If the user describes the Issue without using those words, it works fine. Below are 2 different responses.
I personally feel that this is a bug in GA, is there any way to solve it?
I think you're doing some things wrong. I don't have enough information to understand 100% what you are doing, but I will try to give you some general advice:
A fallback intent is used to 'fall back' to this intent when a user asks something that is nowhere provided in one of your other intents. That's why your fallback intent has the 'input.unknown' set as action. It will be triggered when the user gives some input that is unknown for your application. F.e. I don't think your '(Pazo) Support Action' will provide an answer if the user asks to book a plane to Iceland, so that's when your fallback intent comes in to give an answer such as 'Sorry, I can't answer that question. Pazo is here to give you support in... What can I do for you?'
Your user can either register a complaint or raise a support ticket if I'm getting this right? I recommend you to make two seperate intents. One to handle the complaints and one to handle the support tickets.
Before developing advanced actions with a seperate webhook and a lot of logic with calling an API etc., I recommend to go through the documentation of Actions on Google:
https://developers.google.com/actions/extending-the-assistant

How to ensure my Google Home Assistant application is not rejected?

During our testing, we were unable to complete at least one of the behaviors or actions advertised by your app. Please make sure that a user can complete all core conversational flows listed in your registration information or recommended by your app.
Thank you for submitting your assistant app for review!
During testing, your app was unable to complete a function detailed in the app’s description. The reviewer interacted with the app by saying: “how many iphones were sold in the UK?” and app replied “I didn't get that. Can you try with other question?" and left conversation.
How can I resolve the above point to approve my Google Assistant action skills?
Without seeing the code in question or the intent you think should be handling this in Dialogflow, it is pretty difficult - but we can generalize.
It sounds like you have two issues:
Your fallback intent that generated the "I didn't get that" message is closing the conversation. This means that either the "close conversation" checkbox is checked in Dialogflow, you're using the app.tell() method when you should be using app.ask() instead, or the JSON you're sending back has close conversation set to true.
You don't have an intent to handle the question about how many iPhones were sold in the UK. This could be because you just don't list anything like that as a sample phrase, or the two parameters (the one for object type and the one for location) aren't using entity types that would match.
It means that somewhere, either in your app description or in a Dialogflow intent(they have full access to see what's in your intents) you hinted that “how many iphones were sold in the UK?” would be a valid question. Try changing the description/intents to properly match the restrictions of your app.

Control your device with custom commands using Actions in Google

just getting started with Assistant features in RPi and I am able to successfully implement upto this point and wondering few thing.
Scenario:
user: hey google "please turn on my living room Lights"
List item my code in horword.py : has a function to perform same action based on ON_RECOGNIZING_SPEACH_FINISHED
RPi/google home: I am not sure how respond to that
I was able to capture the request query asked by user using ON_RECOGNIZING_SPEACH_FINISHED = Args.text(str) and use it in my logic to perform the task. However, at the same time, "ok google" is responding with this answer.
to mitigate this problem, I created an google-actions, now it understands my query and respond with intention from api.ai. However, didn't acts on turn lights ON. So, wondering how can I read response from google home/api.ai in text and change code to act on it locally.
appreciate it.
You will not get response as text.
For getting response to client app use webhook in API.AI and send message using fcm to client app.
Read the fcm message in client app and do the corresponding actions.
finally was able to figure out multiple ways. answered this in other stack question. find more details in this post.
Multiple ways to handle this since google doesn't gives voices transcript and we let google say our transcript which is kind off solution for now.

Alexa Node Skill Questions / Prompts

So after scavenging the web, I am unable to find an answer to my problem.
Basically, I want to produce the following result in Alexa, and I want to know if its possible and the direction I should be looking in on how to achieve.
Skill / Intent Init
"Hey Alexa.. ask to find a restaurant near me"
Prompt
"What's your favorite cuisine?"
Response
"Italian"
Prompt
"Are you looking to spend a lot of money?"
Response
"No"
The intent logic goes somewhere in the middle of this
"Okay I found a restaurant near you called
This looks like a fairly standard Alexa custom skill. Most of the Alexa examples and tutorials would show you how to do this. I suggest looking at the Amazon developer site for their Alexa custom skill examples and tutorials, or just searching on "Alexa tutorial".
You will collecting 3 bits of information:
The user's location
The type of food
Expensive
These will need to be persisted between questions, so look at examples that either use a database to store the info (DynamoDB is about the easiest to use) or that persist information in the session object (this would be my recommendation).
You can either ask the user for their location using the built in city slot type, or obtain the address of the alexa device using the device address API.
Good luck. I hope this helps give you some pointers on how/where to start.

Resources