Skip to content

Conversation

markacianfrani
Copy link
Contributor

resolves #16

@markacianfrani markacianfrani requested a review from a team as a code owner October 6, 2025 19:40
@Copilot Copilot AI review requested due to automatic review settings October 6, 2025 19:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables structured outputs support for GitHub Models chat models by adding the supportsStructuredOutputs: true configuration option to the base options.

Key Changes

  • Added supportsStructuredOutputs: true to the base configuration for GitHub Models chat models
  • Added test coverage to verify the structured outputs configuration is properly set

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/provider.ts Added supportsStructuredOutputs: true to the base options configuration
src/provider.test.ts Added test to verify structured outputs are enabled for chat models

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@maraisr maraisr left a comment

Choose a reason for hiding this comment

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

Thank you so much 🙏 there may be some models that do not support structuredOutputs. I do wonder if there is a way to use something similar to https://github.com/github/models-ai-sdk/blob/main/script/sync-model-id.ts to pull this information too, and to default to true as youre doing.

@maraisr maraisr merged commit 97e4fa4 into github:main Oct 7, 2025
4 checks passed
@markacianfrani
Copy link
Contributor Author

I had a version baked into that with a call like:

    const response = await fetch(`${baseURL}/v1/chat/completions`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        model: modelId,
        messages: [{role: 'user', content: 'Generate a person with name and age.'}],
        response_format: {
          type: 'json_schema',
          json_schema: {
            name: 'person',
            schema: {
              type: 'object',
              properties: {
                name: {type: 'string'},
                age: {type: 'number'},
              },
              required: ['name', 'age'],
            },
          },
        },
      }),
    })

and just looped through the models. but it took forever and, to be completely honest, I actually have no idea what the rate limits and usage limits actually are for the free GitHub Models.

Another thought: we could make it configurable at least as a providerOption or something so a consumer can at least always pass it in themselves but if the model doesn't support it, there's not really anything you can do anyway.

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

Successfully merging this pull request may close these issues.

structured output support

2 participants