client icon indicating copy to clipboard operation
client copied to clipboard

[Bug]: No Parameters passable for files()->list()

Open bytes-max opened this issue 2 years ago • 1 comments

Description

The documentation describes how you can pass parameters to list calls, and the PHP wrapper has most of it, too.

However, not so much for the files-list. It does not accept parameters which makes querying for pages impossible.

Steps To Reproduce

return $client->vectorStores()->files()->list($vectorStoreId, array_filter([
            'limit' => 100,
            'after' => $after,
        ]));

This works.

return $client->files()->list();

This works only without params. Reason is the way its being built:

public function list(): ListResponse
    {
        $payload = Payload::list('files');

        /** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>}> $response */
        $response = $this->transporter->requestObject($payload);

        return ListResponse::from($response->data(), $response->meta());
    }

Just adapt the method to accept a payload, then pass it to the static method call.

OpenAI PHP Client Version

v0.10.1

PHP Version

8.3

Notes

No response

bytes-max avatar Nov 15 '24 10:11 bytes-max

Opening a new PR with same content since the previous one got rejected and the author wrote that they wouldn't continue working on it.

efpapado avatar Apr 14 '25 10:04 efpapado