Skip to content

Fix FunctionDeclarationSchema type not allowing strings #279

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 1 commit into
base: main
Choose a base branch
from

Conversation

hapticdata
Copy link
Member

If I use Google's AI Studio and edit my functions. It will give me an object like this:

[
  {
    "name": "getWeather",
    "description": "get the weather for a location",
    "parameters": {
      "type": "object",
      "properties": {
        "location": {
          "type": "string"
        }
      }
    }
  }
]

TypeScript will throw an error for this because I used "object" instead of SchemaType.OBJECT for "type". It will however work fine in Javascript.

This pull request simply allows FunctionDeclarationSchema to accept any value from the SchemaType enum or its string equivalent.

type: "string" | "number" | "boolean" | "object" | SchemaType | "integer" | "array"

@Annhiluc Annhiluc added status:triaged Issue/PR triaged to the corresponding sub-team p1 p2 and removed p1 labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 status:triaged Issue/PR triaged to the corresponding sub-team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants