Skip to content

[Workers AI] SchemaGetResponse type is unknown #2692

@mattrothenberg

Description

@mattrothenberg

Confirm this is a Typescript library issue and not an underlying Cloudflare API issue

  • This is an issue with the Typescript library

Describe the bug

When fetching a model's schema via client.ai.models.schema.get, the return type is SchemaGetResponse which unfortunately resolves to unknown.

I think this field can (and should) be typed properly to what the REST API returns, an object that looks like the following.

{
    "success": true,
    "result": {
        "input": {
            "type": "object",
            "properties": {
                "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "A text description of the image you want to generate."
                },
                "steps": {
                    "type": "integer",
                    "default": 4,
                    "maximum": 8,
                    "description": "The number of diffusion steps; higher values can improve quality but take longer."
                }
            },
            "required": [
                "prompt"
            ]
        },
        "output": {
            "type": "object",
            "contentType": "application/json",
            "properties": {
                "image": {
                    "type": "string",
                    "description": "The generated image in Base64 format."
                }
            }
        }
    }
}

It looks like these types are generated automagically via Stainless, so perhaps an upstream change to the OpenAPI Spec is needed. I'm happy to take care of this myself, if you can point me in the right direction!

Thank you! 🧡

To Reproduce

  1. Instantiate a cloudflare client
  2. Call ai.models.schema.get
  3. See that the response is unknown

Code snippets

OS

macOS

Runtime version

Typescript 5.7.2

Library version

v5.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugCategorizes issue or PR as related to a bug.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions