Follow-Up Action to OpenAI

Hi all! Happy New Year!

I am currently building an app that sends requests to OpenAI’s GPT3 and receives responses to user input. I watched this video and figured out how to get my initial response set up (i.e. user inputs response, presses button, GPT3 generates a response, prints to a new screen). This is working perfectly, however, I am attempting to set up a follow up response function and having a tough time figuring it out.

What I want it to do is after GPT3 generates the initial response and prints it to a new screen, I would like the user to be able to then respond to that specific generate response to either get answers, more information, explain the topic, etc. I have tried this using the completions JSON request as well as the edit JSON request to GPT3 but have been unable to get it to function. When GPT3 generates the initial response, I am saving that response and initial user inputted question as a database entry. For the follow up, I am attempting to submit that saved GPT3 response AND the new user input to get what the user would like (explanation, answers, etc.).

I noticed that when the GPT3 response saves, there is a good amount of leading/trailing whitespace which I think might be my issue? I copy/pasted the response without the whitespace into chat.OpenAI and it worked, but I am not sure if that is a different query than the JSON one I am trying to make. I tried using JSON syntax to trim the response of the whitespace but that did not work as well.

Would love any tips/help anyone could offer. If I am not explaining this well please let me know and I would be more than happy to explain further.

Thanks so much!!

Hi @cpaexamai are you asking like one to one chat response? if yes you can create a database and like the promt and response request so that the reponse will have continuation give a try. and for the space i am also facing the same thing tried many ways but still i am getting a blank at the top

thanks so much for the reply! yes, I am attempting and one to one chat response. that is how I currently have it set up, but I think the whitespace is preventing GPT3 from generating a follow up response, when I run the custom action and see the results in the custom action setup, there is no actual response, it is blank. So I think the whitespace is causing the issue

yes the same when i try to remove \n and some other command it creating problems, still looking for the issue

Hey, if you are trying to get the Chat to be like OpenAi’s chat GPT3 it’s not actually possible through the API. It will work for short conversations with short answers but as the conversation grows the API call will fail. This is because the limit on the Prompt is 2500 tokens or 4000 tokens Prompt and Response. So at some point, the conversation will fail as part of the API call as it will continue to grow in prompt length. You then need ways to table the information and summarise it to reduce the token count constantly below to be below 2500 (as ultimately you are sending history and new prompts in the same call. To truly make a Chat Model you need to fine-tune the model and constantly summarise. Kinda like how the human brain works, you remember more about the last few conversations, and less about previous conversations to the point that you just about recall the topic.

As for the white space use an API to remove whitespace.

I should add you also need to URL Encode the Prompt to Open AI as part of your API call or it will also fail… Similarly, you should URL decode the response, as sometimes it will come back with responses like this. “Hey%20my%20name%20is%20keith”

I just released my app https://web.ezai.app and came across several issues like this.

@iAppsNi Can you share us the Screenshot or any video so that we can understand the Encoding the Api part

oh that’s very interesting, had no idea there was a token limit. however, even for short prompts/responses well below that token limit it still does not generate properly.

so for example, one of my prompts is to generate a 10 question multiple choice quiz. how would you think the best way for a follow up to get the answers to the quiz should be structured and it probably would not be that easy to summarize?

for the whitespace is there a specific api to remove it that you used?

Could you perhaps share your prompt, I’m developing a text manipulation API that could solve such an issue

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.