chore(genkit-tools): update model and middleware types#4785
chore(genkit-tools): update model and middleware types#4785MichaelDoyle wants to merge 1 commit intomainfrom
Conversation
Summary of ChangesHello @MichaelDoyle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on refining and expanding the type definitions within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request updates model and middleware types, and introduces a new common.ts file for MiddlewareDescSchema. It also refactors PartSchema in model.ts and parts.ts to improve clarity and consistency. Additionally, ModelReferenceSchema is added, and GenerationCommonConfigSchema is enhanced with descriptions and an apiKey field. The genkit-schema.json file is updated to reflect these changes, including the addition of resources to GenerateActionOptions and a more detailed content definition for GenerateResponseChunk.
|
@huangjeff5 what do we need to do about the python errors? I don't think this should necessarily be causing an error. Either there is a problem in the translation step, or the rule needs to be relaxed? |
99442ef to
60dc9a6
Compare
42c50d2 to
6b27c03
Compare
Looking |
3d7b8b2 to
3b0adae
Compare
c89d0ef to
0295800
Compare
0295800 to
16c120a
Compare
| */ | ||
| export type ToolResponse = z.infer<typeof ToolResponseSchemaBase> & { | ||
| content?: Part[]; | ||
| content?: DocumentPart[]; |
There was a problem hiding this comment.
There is a collision with multiple definitions of Part (models.ts, parts.ts) as both get exported, which causes an issue for the JSON schema generation.
Previously this was isolated to documents.ts, but after things got refactored out into parts.ts it became a broader issue.
There was a problem hiding this comment.
This means we are downgrading from a generic part to only text/media parts, it this intentional?
There was a problem hiding this comment.
Not quite. Both Document (via document.ts) and Tools (via parts.ts) have Part as defined TextPart | MediaPart. This was my/gemini's attempt to consolidate the two.
Probably it will be least confusing to just let each file redefine Part as it was doing before, but give them a different name in each place?
The issue we have is we do export * filename for every files types. So we have 3 definitions of Part. document.ts, model.ts and parts.ts, which will not work.
There was a problem hiding this comment.
cb7ad0e to
58fa0d5
Compare
| export const MultipartToolResponseSchema = z.object({ | ||
| output: z.unknown().optional(), | ||
| content: z.array(PartSchema).optional(), | ||
| content: z.array(DocumentPartSchema).optional(), |
There was a problem hiding this comment.
9d18900 to
67c9dc8
Compare
67c9dc8 to
fd50787
Compare
|
I broke this out into 3 PRs to make it easier to review and merge, since I touched things from 3 different areas. |
js/ai/src/model.tsandjs/ai/src/parts.tsas well.