Dealing with Streaming Chat Completion: possible blocking function? #361
Unanswered
HunterProduction
asked this question in
Q&A
Replies: 1 comment 4 replies
-
@HunterProduction can you dig into that profiler hierarchy and show me exactly what is taking so long? you only show the top level item. Feel free to DM me the profiler data on Discord as well |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
Still me, from the #358, here for something else!
I am using your very good API port to realize an higher level wrapper library to implement AI-based feature in my projects. When testing the Streamed Chat Completion feature, I'm experiencing a kind of freeze in the app execution, of unpredictable duration (sometimes is a really long delay).
I took a snapshot of the profiler which shows that spike of about 60 seconds:

Now I'll describe my implementation so that you can have a context.
I have a sort of "service" class I call Processor that directly manages your OpenAI Client. Here there are these 2 methods:
Then, in my desired MonoBehaviour I instantiate that processor and use it at higher level to perform the specific task (example: SimpleChatAssistant MonoBehaviour uses an AIConversationalProcessor to retrieve an ai-based response to a user message). Here is the method in the MonoBehaviour:
Now, I have the same twin methods using non-streamed chat completion, and the execution does not causes that freeze. Am I missing something? I wonder if there could be any possible blocking function call in the asynchronous pipeline of the streamed chat completion.
To mention another problem I'm facing, as you can see in the commented section of the partial response handler, I tried mimicing your audio delta management as you did in the
RealtimeBehaviour
sample using your customStreamAudioSource
, but the API throws me a sequence of null pointer exceptions even with those explicit null checks. I think I am wrong on something, just let me know if you have an answer for this.Beta Was this translation helpful? Give feedback.
All reactions