Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method: tunedModels.list returns 400 Bad Request when Query Parameter is passed #77

Closed
derrickobedgiu1 opened this issue Apr 17, 2024 · 0 comments

Comments

@derrickobedgiu1
Copy link

Hello, listing tuned models returns 400 Bad Request when I pass the optional query parameters with documentation at: https://ai.google.dev/api/rest/v1beta/tunedModels/list
All other tuning end points, including listing the tuned models without parameters work fine but not with parameters passed.

Successful:

$request = $gemini->listTunedModels();

print_r($request);

400 Bad Request:

$request = $gemini->listTunedModels([
    'page_size' => 20,
    'filter' => 'owner:me'
]);

print_r($request);

The Code:

public function listTunedModels(?array $params = null): string
    {
        if (!$this->accountCredentialStatus) {
            throw new \Exception('Service or OAuth 2.0 Credential required to list tuned models');
        }

        $url = Url::tunedModelsUrl();
        if (!is_null($params)) {
            $response = $this->client->get($url, [
                'headers' => [
                    'Content-Type' => 'application/json',
                    'x-goog-user-project' => $this->projectid,
                    'Authorization' => 'Bearer ' . $this->getAccessToken(),
                ],
                'json' => $params
            ]);

        } else {
            $response = $this->client->get($url, [
                'headers' => [
                    'Content-Type' => 'application/json',
                    'x-goog-user-project' => $this->projectid,
                    'Authorization' => 'Bearer ' . $this->getAccessToken(),
                ]
            ]);
        }

        return $response->getBody()->getContents();
    }

Is there another way of passing the parameters? Because this is the only endpoint so far failing (passing the paramters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant