Question

Issues with OpenAI assistant and other API questions

  • 18 March 2024
  • 3 replies
  • 112 views

  1. I’ve developed an integration to OpenAI using both the Assistant and the completions modes. initially tried assistant mode but it is taking far too long since it needs to first set up new/update assistant if the context has changed , set up a new/check for existing thread, send message and run, then check for response. each of the api calls that require response needed to be put on a timer loop to check for completion. minimum smart delay with manychat is 10 sec which means i’m losing far too much time in all these processes. conclusion: using the assistant mode is resulting in the response taking about 12-13 sec to come through.

alternatively, if i use completions, i get a response in about 4 sec but the downside is the entire prompt has to be sent each time which results in high token usage.

is there something i’m missing here about how these integrations could work?

  1. is there a method  to remove or replace certain characters from text fields in   manychat? for example if the user or chatgpt message contains “” then it messes up the api call as it reads that as the end of the content variable. I have not been able to find a way to remove or replace such characters berfore feeding them into the api body.  so it’s likely going to happen at the very least if a user uses the characters in their response it will break the api call. is there a way around this?

3 replies

Userlevel 6
Badge +4

Hey @TeeCee 

  1. No, you’re not missing anything. The only way to make it faster is to develop your own application that acts between Manychat and the Assistants API, shortening the 10s delay. If you’re using Manychat then you have the 10s minimum delay, and nothing you can do about it. We’ve asked several times to decrease those 10s, but I don’t think it’ll be changed anytime soon.
  2. I have the solution for this. On the external request, remove the “ ” from your text variable, and check the ‘Encode to JSON’ option, like the image:

 

That should sort it out ;)

(This took me several years working with the Manychat API to figure out and get clarity on!)

Hope this helps.

Hey @TeeCee 

  1. No, you’re not missing anything. The only way to make it faster is to develop your own application that acts between Manychat and the Assistants API, shortening the 10s delay. If you’re using Manychat then you have the 10s minimum delay, and nothing you can do about it. We’ve asked several times to decrease those 10s, but I don’t think it’ll be changed anytime soon.
  2. I have the solution for this. On the external request, remove the “ ” from your text variable, and check the ‘Encode to JSON’ option, like the image:

 

That should sort it out ;)

(This took me several years working with the Manychat API to figure out and get clarity on!)

Hope this helps.

ah great, thank you re the encode to json part. i was wondering what that was all about! thank you

Regarding issue 1, I am using a workaround, so far it is working. 

In my pythod program which is managing the threads for assistant API, i have a loop which check if the time windows from the start of the API call has exceeded 10 seconds window. 
in manychat I have two checks first one check if the response was ‘timeout’, which python program sends if output is not yet generated. If python program fails to send output within 10 second I have another check, which will check if the response was blank and would run the step “check thread again”.

 

 

Reply