Skip to content

add missing model catalogue search parameters (search, task, author, source)#13901

Merged
petebacondarwin merged 8 commits into
cloudflare:mainfrom
bghira:feature/model-catalogue-query
May 15, 2026
Merged

add missing model catalogue search parameters (search, task, author, source)#13901
petebacondarwin merged 8 commits into
cloudflare:mainfrom
bghira:feature/model-catalogue-query

Conversation

@bghira
Copy link
Copy Markdown
Contributor

@bghira bghira commented May 12, 2026

Adding public model search API parameters to the ai models via a new subcommand, ai models list:

  • --search
  • --task
  • --author
  • --source

The parameters map to their corresponding API parameters.

This enables public model search via wrangler-cli, in addition to the existing functionality to search the users' own models.

The schema subcommand is added to this pull request now for completeness as ai models schema.


A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@bghira bghira requested a review from workers-devprod as a code owner May 12, 2026 16:32
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

🦋 Changeset detected

Latest commit: dbb10bc

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

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Major
@cloudflare/vitest-pool-workers 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

@workers-devprod workers-devprod requested review from a team and petebacondarwin and removed request for a team May 12, 2026 16:33
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented May 12, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@bghira
Copy link
Copy Markdown
Contributor Author

bghira commented May 13, 2026

NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js ai models schema "@cf/meta/llama-3.3-70b-instruct-fp8-fast"

is now working to check model schema:

JSON output from ai models schema command
{
  "input": {
    "type": "object",
    "oneOf": [
      {
        "title": "Prompt",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "The input text prompt for the model to generate a response."
          },
          "lora": {
            "type": "string",
            "description": "Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model."
          },
          "response_format": {
            "title": "JSON Mode",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "json_object",
                  "json_schema"
                ]
              },
              "json_schema": {}
            }
          },
          "raw": {
            "type": "boolean",
            "default": false,
            "description": "If true, a chat template is not applied and you must adhere to the specific model's expected formatting."
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "If true, the response will be streamed back incrementally using SSE, Server Sent Events."
          },
          "max_tokens": {
            "type": "integer",
            "default": 256,
            "description": "The maximum number of tokens to generate in the response."
          },
          "temperature": {
            "type": "number",
            "default": 0.6,
            "minimum": 0,
            "maximum": 5,
            "description": "Controls the randomness of the output; higher values produce more random results."
          },
          "top_p": {
            "type": "number",
            "minimum": 0.001,
            "maximum": 1,
            "description": "Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses."
          },
          "top_k": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "description": "Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises."
          },
          "seed": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9999999999,
            "description": "Random seed for reproducibility of the generation."
          },
          "repetition_penalty": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "Penalty for repeated tokens; higher values discourage repetition."
          },
          "frequency_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "description": "Decreases the likelihood of the model repeating the same lines verbatim."
          },
          "presence_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "description": "Increases the likelihood of the model introducing new topics."
          }
        },
        "required": [
          "prompt"
        ]
      },
      {
        "title": "Messages",
        "properties": {
          "messages": {
            "type": "array",
            "description": "An array of message objects representing the conversation history.",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "description": "The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool')."
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "The content of the message as a string."
                    },
                    {
                      "type": "array",
                      "description": "Array of text content parts.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Type of the content (text)"
                          },
                          "text": {
                            "type": "string",
                            "description": "Text content"
                          }
                        }
                      }
                    }
                  ]
                }
              },
              "required": [
                "role",
                "content"
              ]
            }
          },
          "functions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "code"
              ]
            }
          },
          "tools": {
            "type": "array",
            "description": "A list of tools available for the assistant to use.",
            "items": {
              "type": "object",
              "oneOf": [
                {
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The name of the tool. More descriptive the better."
                    },
                    "description": {
                      "type": "string",
                      "description": "A brief description of what the tool does."
                    },
                    "parameters": {
                      "type": "object",
                      "description": "Schema defining the parameters accepted by the tool.",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "The type of the parameters object (usually 'object')."
                        },
                        "required": {
                          "type": "array",
                          "description": "List of required parameter names.",
                          "items": {
                            "type": "string"
                          }
                        },
                        "properties": {
                          "type": "object",
                          "description": "Definitions of each parameter.",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "The data type of the parameter."
                              },
                              "description": {
                                "type": "string",
                                "description": "A description of the expected parameter."
                              }
                            },
                            "required": [
                              "type",
                              "description"
                            ]
                          }
                        }
                      },
                      "required": [
                        "type",
                        "properties"
                      ]
                    }
                  },
                  "required": [
                    "name",
                    "description",
                    "parameters"
                  ]
                },
                {
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "Specifies the type of tool (e.g., 'function')."
                    },
                    "function": {
                      "type": "object",
                      "description": "Details of the function tool.",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "The name of the function."
                        },
                        "description": {
                          "type": "string",
                          "description": "A brief description of what the function does."
                        },
                        "parameters": {
                          "type": "object",
                          "description": "Schema defining the parameters accepted by the function.",
                          "properties": {
                            "type": {
                              "type": "string",
                              "description": "The type of the parameters object (usually 'object')."
                            },
                            "required": {
                              "type": "array",
                              "description": "List of required parameter names.",
                              "items": {
                                "type": "string"
                              }
                            },
                            "properties": {
                              "type": "object",
                              "description": "Definitions of each parameter.",
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "description": "The data type of the parameter."
                                  },
                                  "description": {
                                    "type": "string",
                                    "description": "A description of the expected parameter."
                                  }
                                },
                                "required": [
                                  "type",
                                  "description"
                                ]
                              }
                            }
                          },
                          "required": [
                            "type",
                            "properties"
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "description",
                        "parameters"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "function"
                  ]
                }
              ]
            }
          },
          "response_format": {
            "title": "JSON Mode",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "json_object",
                  "json_schema"
                ]
              },
              "json_schema": {}
            }
          },
          "raw": {
            "type": "boolean",
            "default": false,
            "description": "If true, a chat template is not applied and you must adhere to the specific model's expected formatting."
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "If true, the response will be streamed back incrementally using SSE, Server Sent Events."
          },
          "max_tokens": {
            "type": "integer",
            "default": 256,
            "description": "The maximum number of tokens to generate in the response."
          },
          "temperature": {
            "type": "number",
            "default": 0.6,
            "minimum": 0,
            "maximum": 5,
            "description": "Controls the randomness of the output; higher values produce more random results."
          },
          "top_p": {
            "type": "number",
            "minimum": 0.001,
            "maximum": 1,
            "description": "Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses."
          },
          "top_k": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "description": "Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises."
          },
          "seed": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9999999999,
            "description": "Random seed for reproducibility of the generation."
          },
          "repetition_penalty": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "Penalty for repeated tokens; higher values discourage repetition."
          },
          "frequency_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "description": "Decreases the likelihood of the model repeating the same lines verbatim."
          },
          "presence_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "description": "Increases the likelihood of the model introducing new topics."
          }
        },
        "required": [
          "messages"
        ]
      },
      {
        "title": "Async Batch",
        "type": "object",
        "properties": {
          "requests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "external_reference": {
                  "type": "string",
                  "description": "User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique."
                },
                "prompt": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Prompt for the text generation model"
                },
                "stream": {
                  "type": "boolean",
                  "default": false,
                  "description": "If true, the response will be streamed back incrementally using SSE, Server Sent Events."
                },
                "max_tokens": {
                  "type": "integer",
                  "default": 256,
                  "description": "The maximum number of tokens to generate in the response."
                },
                "temperature": {
                  "type": "number",
                  "default": 0.6,
                  "minimum": 0,
                  "maximum": 5,
                  "description": "Controls the randomness of the output; higher values produce more random results."
                },
                "top_p": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 2,
                  "description": "Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses."
                },
                "seed": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9999999999,
                  "description": "Random seed for reproducibility of the generation."
                },
                "repetition_penalty": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 2,
                  "description": "Penalty for repeated tokens; higher values discourage repetition."
                },
                "frequency_penalty": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 2,
                  "description": "Decreases the likelihood of the model repeating the same lines verbatim."
                },
                "presence_penalty": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 2,
                  "description": "Increases the likelihood of the model introducing new topics."
                },
                "response_format": {
                  "title": "JSON Mode",
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "json_object",
                        "json_schema"
                      ]
                    },
                    "json_schema": {}
                  }
                }
              }
            }
          }
        }
      }
    ]
  },
  "output": {
    "oneOf": [
      {
        "type": "object",
        "contentType": "application/json",
        "properties": {
          "response": {
            "type": "string",
            "description": "The generated text response from the model"
          },
          "usage": {
            "type": "object",
            "description": "Usage statistics for the inference request",
            "properties": {
              "prompt_tokens": {
                "type": "number",
                "description": "Total number of tokens in input",
                "default": 0
              },
              "completion_tokens": {
                "type": "number",
                "description": "Total number of tokens in output",
                "default": 0
              },
              "total_tokens": {
                "type": "number",
                "description": "Total number of input and output tokens",
                "default": 0
              }
            }
          },
          "tool_calls": {
            "type": "array",
            "description": "An array of tool calls requests made during the response generation",
            "items": {
              "type": "object",
              "properties": {
                "arguments": {
                  "type": "object",
                  "description": "The arguments passed to be passed to the tool call request"
                },
                "name": {
                  "type": "string",
                  "description": "The name of the tool to be called"
                }
              }
            }
          }
        },
        "required": [
          "response"
        ]
      },
      {
        "type": "string",
        "contentType": "text/event-stream",
        "format": "binary"
      },
      {
        "type": "object",
        "contentType": "application/json",
        "title": "Async response",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "The async request id that can be used to obtain the results."
          }
        }
      }
    ]
  }
}

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 14, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13901

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13901

miniflare

npm i https://pkg.pr.new/miniflare@13901

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13901

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13901

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13901

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13901

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13901

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13901

wrangler

npm i https://pkg.pr.new/wrangler@13901

commit: dbb10bc

Comment thread packages/wrangler/src/ai/listCatalog.ts Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk May 14, 2026
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. This makes much more sense.

Since the ai models command was marked as "stable" we can't actually drop it straight up. I think we need to have a legacy mode where if you just do wrangler ai models it will delegate through to wrangler ai models list until we can do a breaking change major release of Wrangler (e.g. v5).

Comment thread packages/wrangler/src/ai/modelSchema.ts Outdated
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for iterating on this.

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from In Review to Approved in workers-sdk May 15, 2026
@petebacondarwin petebacondarwin merged commit aac7ca0 into cloudflare:main May 15, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk May 15, 2026
@bghira bghira deleted the feature/model-catalogue-query branch May 15, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants