Add support for structured outputs via response-schema-file parameter#86
Closed
Copilot wants to merge 4 commits into
Closed
Add support for structured outputs via response-schema-file parameter#86Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for structured outputs via response-schema-file parameter
Add support for structured outputs via response-schema-file parameter
Jul 7, 2025
Owner
|
Move schemas to tests directory Add test case using a schema in .github/workflows/test-action.yml |
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Contributor
Author
Done! I've moved the schemas to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements support for OpenAI's structured outputs feature by adding a new optional
response-schema-fileparameter. This enables users to receive consistent, structured JSON responses from AI models while maintaining full backward compatibility.✨ New Features
Structured Outputs Support
response-schema-file- Path to a JSON Schema file for enforcing structured responsesresponse_formatwithjson_schematype for native structured output support{ [key: string]: unknown }for schema validationUsage Example
Example Schema File
{ "type": "object", "properties": { "summary": { "type": "string", "description": "Brief summary of the analysis" }, "issues": { "type": "array", "items": { "type": "object", "properties": { "severity": { "type": "string", "enum": ["low", "medium", "high", "critical"] }, "description": { "type": "string" }, "line": { "type": "number" } }, "required": ["severity", "description"] } }, "score": { "type": "number", "minimum": 0, "maximum": 100 } }, "required": ["summary", "issues", "score"], "additionalProperties": false }🔧 Implementation Details
Core Changes
action.yml- Added new optionalresponse-schema-fileinputgenerateAIResponse()- Added optional schema parameter with proper typingmain.ts- Added schema file reading, JSON parsing, and comprehensive error handlingresponse_formatwhen schema is providedError Handling
🧪 Testing
Added comprehensive test coverage with 22/22 tests passing and 100% code coverage:
📚 Documentation
Updated README with:
🔒 Backward Compatibility
Zero breaking changes - this is a fully backward-compatible addition:
📁 Files Added
.github/schemas/code-analysis.json- Example schema for code analysis.github/schemas/simple-response.json- Simple response schema example__tests__/test-schema.json- Schema file for integration testingFixes #84.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
img.shields.ionode /home/REDACTED/work/prompt-action/prompt-action/node_modules/.bin/make-coverage-badge --output-path ./badges/coverage.svg(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.