feat(tools): support middlware in dotprompt export#5223
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for a use field in prompt frontmatter and API requests to handle middleware references. It also includes a new cleanupFrontmatter utility to remove empty or null values from the generated YAML and refactors message part stringification for better maintainability. Feedback was provided to correct the schema type for the use field in CreatePromptRequestSchema, suggesting the use of MiddlewareRefSchema instead of ModelReferenceSchema to maintain consistency across the API.
135279e to
81c71af
Compare
81c71af to
cba9c03
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for middleware in prompt frontmatter and enhances the rendering of messages in Dotprompt templates. Key changes include adding a "use" field to the prompt schemas and refactoring the "fromMessages" utility to gracefully handle unsupported message parts, such as tool requests and responses, by omitting them with descriptive comments. Additionally, a new "cleanupFrontmatter" function ensures cleaner YAML output by removing empty or null values. I have no feedback to provide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces middleware support to prompt frontmatter and refactors the prompt rendering logic to handle unsupported message parts and clean up frontmatter metadata. The reviewer suggested improving the consistency of the anyOmitted flag to account for partially omitted messages and recommended using more idiomatic TypeScript patterns, such as the in operator for property checks and Object.keys() for object iteration.
ssbushi
left a comment
There was a problem hiding this comment.
LGTM. +1 to gemini-code-review comments.
ea7a9a0 to
d2264c1
Compare
d2264c1 to
0ebaca0
Compare
Added support for middleware in the
createPromptendpoint for dev-ui (i.e. prompt export).Made some clean-up/improvements to YAML rendering.
I think this strikes the right balance. Nota bene, Dev UI can always choose to omit these types (and does in some scenarios).
Checklist (if applicable):