Skip to content

Conversation

@sgoedecke
Copy link
Collaborator

@sgoedecke sgoedecke commented Jul 21, 2025

The current json schema support reads the schema from YML, but it should be a string (like in the Models UI). This PR updates the code to expect a string.

@sgoedecke sgoedecke marked this pull request as ready for review July 21, 2025 04:31
Copilot AI review requested due to automatic review settings July 21, 2025 04:31
@sgoedecke sgoedecke requested a review from a team as a code owner July 21, 2025 04:31
Copy link
Contributor

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 changes the JSON schema format in prompt files from YAML object structure to JSON string format, aligning with the Models UI implementation. The change affects how JSON schemas are parsed, validated, and used throughout the codebase.

  • Updates JsonSchema struct to store raw JSON string and parsed data separately
  • Implements custom YAML unmarshaling to handle JSON string format
  • Modifies validation logic to work with parsed schema data
  • Updates all test files and examples to use the new JSON string format

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/prompt/prompt.go Core implementation changes for JsonSchema struct and parsing logic
pkg/prompt/prompt_test.go Updated test cases to use JSON string format and verify parsing
examples/json_schema_prompt.yml Example file converted from YAML to JSON string format
cmd/run/run_test.go Test data updated to use JSON string format
cmd/eval/eval_test.go Test data updated to use JSON string format
Comments suppressed due to low confidence (2)

pkg/prompt/prompt.go:205

  • [nitpick] Removing this helpful comment reduces code readability. Consider keeping comments that explain the purpose of code sections.
	if f.ModelParameters.MaxTokens != nil {

pkg/prompt/prompt.go:215

  • [nitpick] Removing this helpful comment reduces code readability. Consider keeping comments that explain the purpose of code sections.
	if f.ResponseFormat != nil {

@sgoedecke sgoedecke merged commit 79f1655 into main Jul 21, 2025
5 checks passed
@sgoedecke sgoedecke deleted the sgoedecke/json-schema-string-format branch July 21, 2025 04:57
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.

3 participants