openai-php / laravel

⚡️ OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with OpenAI API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I use Theads with stream?

muriloeliaseinov opened this issue · comments

Hello friends,

I looked for the same question and couldn't find it, it may seem silly, but I would really appreciate it if someone could help me.

In the openaiphp project there is an example of how to call a thead with the stream option. (https://github.com/openai-php/client?tab=readme-ov-file#create-streamed-2)

Is there a way to do this through Laravel's openai-php library?

I tried the following way but it gave me an error.

           $stream  = OpenAI::threads()->runs()->create(
                threadId: $aiAssistentCheck->thread_external_id,
                parameters: [
                    'assistant_id' => $aiAssistentCheck->external_id,
                    'additional_instructions' => $aiAssistentCheck->additional_instructions,
                    'stream ' => true,
                ],
            );

Within runs() the createStreamed option did not appear as it did in chat()->createStreamed

Thank you for your attention

Hi @muriloeliaseinov

There is a ->threads()->runs()->createStreamed() function.

Are you using the latest version?

Hi @gehrisandro, no 0.8.5 😶‍🌫️🫣

  • Upgrading openai-php/client (v0.8.5 => v0.9.2): Extracting archive
  • Upgrading openai-php/laravel (v0.8.1 => v0.9.1): Extracting archive

Now ok, Sorry for wasting your time friend.