Skip to content

[VertexAI] Fix typings for functionDeclaration.parameters. #8948

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hsubox76
Copy link
Contributor

Fixes #8944

This fix allows passing an ObjectSchema created by Schema.object() to functionDeclaration.parameters without any TS errors. It also forbids passing a plain JSON object to functionDeclaration.parameters if it has an optionalProperties property, as that is a convenience input method and should not be passed to the backend request. Users can still use the required property.

I experimented with intercepting plain JSON objects passed to functionDeclaration.parameters and processing the optionalProperties into a required array but concluded there are too many places this needs to be done (on getGenerativeModel and on each of its methods, possibly on getImagenModel and others in the future) and it adds a lot of unneeded code for a case that can be handled simply by using Schema.object() or manually filling out the required field.

Copy link

changeset-bot bot commented Apr 18, 2025

🦋 Changeset detected

Latest commit: 24d05ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@firebase/vertexai Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Vertex AI Mock Responses Check ⚠️

A newer major version of the mock responses for Vertex AI unit tests is available. update_vertexai_responses.sh should be updated to clone the latest version of the responses: v10.0

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 18, 2025

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 18, 2025

@hsubox76 hsubox76 marked this pull request as ready for review April 29, 2025 18:10
@hsubox76 hsubox76 requested review from a team as code owners April 29, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants