-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: Structured output for recipes #3188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ructured-output * origin/main: (22 commits) feat(desktop): Prioritize suffix when truncating path in header (#3110) chore(release): release version 1.0.31 (#3185) feat: additional sub recipes via command line (#3163) Add Internal Recipes To Recipes Cookbook (#3179) pipe the argument to storage (#3184) docs: removing comment (#3183) docs: add generator option to create recipe (#3182) update the path for temporal (#3131) docs: add link to Square MCP (#3181) attempt to fix build #3 (#3180) attempt fix folde permissions for windows build (#3178) attempt to fix windows cli permission issue (#3177) allow to use dev/null for no-session mode (#3176) feat: change naming of recipe creation in more menu links (#3175) Docs: Add Recipe video to landing page (#3173) Docs: Create new directory when starting new session (#3174) fixes cron parsing issues (#3172) fix: handle Windows package subdirectory in CLI installation script (#3171) fixed the npx/uvx content (#3170) Mark helper scripts as executable (#3169) ...
DOsinga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also update the recipe documentation?
| return (request_id, Ok(ToolCallResult::from(result))); | ||
| } | ||
|
|
||
| if tool_call.name == FINAL_OUTPUT_TOOL_NAME { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof this function is a bit of a mess! your addition is of course in line with what the rest looks like, but we should fix this at some point so if you feel the itch ...
| pub struct Response { | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub json_schema: Option<serde_json::Value>, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have a strong preference about making this nested? in the ticket we talk about just having a output_json_schema field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think we should leave ourselves open to alternative response formats and extra controls (I expect someone will ask for a 'max_attempts' option to prevent unlimited attempts at some stage... I'm building a MAX_TURNS option into goose atm which I think is a better version).
| } | ||
| }, | ||
| "required": ["final_output"] | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't we just insert the json schema at this point? asking the llm to do it in this format probably works, but since the tool takes a json schema, why not use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 Very nice, that cleans up the code a bit too.
| "Invalid JSON format: {}\n\nExpected format:\n{}\n\nPlease provide valid JSON that matches the expected schema.", | ||
| e, | ||
| serde_json::to_string_pretty(self.response.json_schema.as_ref().unwrap()).unwrap_or_else(|_| "Invalid schema".to_string()) | ||
| )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it recover from this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I managed to fudge the agent to do it wrong the first time to test with goose. I've implemented this pattern a few times and it has worked pretty well.
| } | ||
| } | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a lot of tests here. I would suggest to remove the ones that will never find a bug. the tests in the recipe mod feel more useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old TDD habits 🙃 . Removing some.
|
* main: feat: Structured output for recipes (#3188) Fix cost tracking accuracy and OpenRouter model pricing (#3189) docs: update cli install instructions for windows (#3205) Docs: Cost tracking on the desktop app (#3204) feat: Adding streamable-http transport support for backend, desktop and cli (#2942) fix: use the correct `contains` syntax on create-recipe-pr.yml (#3193)
* main: fix: Pass Google AI API key in HTTP header, not query param (block#3192) docs: add linter to CONTRIBUTING.md (block#3168) feat: Structured output for recipes (block#3188) Fix cost tracking accuracy and OpenRouter model pricing (block#3189) docs: update cli install instructions for windows (block#3205) Docs: Cost tracking on the desktop app (block#3204) feat: Adding streamable-http transport support for backend, desktop and cli (block#2942) fix: use the correct `contains` syntax on create-recipe-pr.yml (block#3193)
* main: (37 commits) fix: fix desktop recipe url generation (block#3209) feat: improve UX for saving recipes (block#3214) fix: Pass Google AI API key in HTTP header, not query param (block#3192) docs: add linter to CONTRIBUTING.md (block#3168) feat: Structured output for recipes (block#3188) Fix cost tracking accuracy and OpenRouter model pricing (block#3189) docs: update cli install instructions for windows (block#3205) Docs: Cost tracking on the desktop app (block#3204) feat: Adding streamable-http transport support for backend, desktop and cli (block#2942) fix: use the correct `contains` syntax on create-recipe-pr.yml (block#3193) Temporarily Remove GH Copilot Provider (block#3199) docs: fix tab navigation (block#3201) feat: use tiktoken-rs instead of tokenizers, single global tokenizer (block#3115) add playwright-mcp server to extensions list (block#3010) Add `/extension` path for extension installation (block#3011) feat(desktop): Prioritize suffix when truncating path in header (block#3110) chore(release): release version 1.0.31 (block#3185) feat: additional sub recipes via command line (block#3163) Add Internal Recipes To Recipes Cookbook (block#3179) pipe the argument to storage (block#3184) ...
* main: (150 commits) Defend against invalid sessions (block#3229) Clean up session file optionality for --no-session (block#3230) Feat: Support Recipe Parameters in Goose desktop app (block#3155) docs: update recipe example (block#3222) Add native OAuth 2.0 authentication support to MCP client (block#3213) build: Check in Cargo.lock changes (block#3220) fix: fix desktop recipe url generation (block#3209) feat: improve UX for saving recipes (block#3214) fix: Pass Google AI API key in HTTP header, not query param (block#3192) docs: add linter to CONTRIBUTING.md (block#3168) feat: Structured output for recipes (block#3188) Fix cost tracking accuracy and OpenRouter model pricing (block#3189) docs: update cli install instructions for windows (block#3205) Docs: Cost tracking on the desktop app (block#3204) feat: Adding streamable-http transport support for backend, desktop and cli (block#2942) fix: use the correct `contains` syntax on create-recipe-pr.yml (block#3193) Temporarily Remove GH Copilot Provider (block#3199) docs: fix tab navigation (block#3201) feat: use tiktoken-rs instead of tokenizers, single global tokenizer (block#3115) add playwright-mcp server to extensions list (block#3010) ...
Signed-off-by: Adam Tarantino <[email protected]>
Signed-off-by: Soroosh <[email protected]>
Signed-off-by: Kyle Santiago <[email protected]>
Main Changes
response.json_schemakey in recipe yaml.goose runwith recipes currently.Other Details
final_toolto output the expected messageThis PR does not add support to use structured output when running a recipe that defines it via the Desktop app. Future PR.
Example
Recipe
Usage