Skip to content

[Bug]: Azure Asynchronous Filter #407

@beliven-daniele-sarnari

Description

Description

Enabling Asynchronous Filter will cause a Undefined array key "delta" error

ErrorException

  Undefined array key "delta"

  at vendor/openai-php/client/src/Responses/Chat/CreateStreamedResponseChoice.php:23
     19▕     public static function from(array $attributes): self
     20▕     {
     21▕         return new self(
     22▕             $attributes['index'],
  ➜  23▕             CreateStreamedResponseDelta::from($attributes['delta']),
     24▕             $attributes['finish_reason'] ?? null,
     25▕         );
     26▕     }
     27▕

      +2 vendor frames

  3   [internal]:0
      OpenAI\Responses\Chat\CreateStreamedResponse::OpenAI\Responses\Chat\{closure}()
      +2 vendor frames

Steps To Reproduce

  1. Enable Asynchronous Filter on Azure OpenAI Studio
    image

  2. Create a OpenAI client that works with Azure

$this->clientGPT4 = OpenAI::factory()
            ->withBaseUri("{$endpoint}/openai/deployments/{$deploymentIdGPT4}")
            ->withHttpHeader('api-key', $apiKey)
            ->withQueryParam('api-version', $apiVersion)
            ->make();
  1. Use the chat()->createStreamed() function
return $this->clientGPT4->chat()->createStreamed([
            'messages' => $messages,
        ]);

OpenAI PHP Client Version

v0.9.1

PHP Version

8.3.6

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions