-
Notifications
You must be signed in to change notification settings - Fork 147
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
feat(py): generate types.py from genkit-schema.json using datamodel-codegen #1807 #1808
base: main
Are you sure you want to change the base?
Conversation
5cbb967
to
8959150
Compare
8959150
to
2c1dd96
Compare
) | ||
text: Any | None = None | ||
media: Any | None = None | ||
toolRequest: Any | None = None |
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.
Ignore if this is still in progress/intentional, but these types look off?
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.
Weird. This is autogenerated, but let me take a look.
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.
Good catch Alex!
from pydantic import BaseModel, ConfigDict, Field, RootModel | ||
|
||
|
||
class Model(RootModel[Any]): |
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.
Could you please double check, but I believe this one was causing runtime errors before. Had to manually remove it.
totalTokens: float | None = None | ||
inputCharacters: float | None = None | ||
outputCharacters: float | None = None | ||
inputImages: float | None = None |
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.
These seem off too.
b24d67f
to
7723ab8
Compare
…el-codegen #1807 ISSUE: #1807 CHANGELOG: - [ ] Add a bin/generate_schema_types script that generates the Pydantic types.py module. - [ ] Update the pre-commit hooks to ensure this file gets regenerated routinely. - [ ] Remove timestamp to ensure we do not treat a file with identical content differently preventing the hassles of updating this file per commit.
7723ab8
to
2735ceb
Compare
index: float | ||
message: Message | ||
usage: Optional[GenerationUsage] = None | ||
usage: GenerationUsage | None = None |
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.
just a question: is GenerationUsage | None
preferable to Optional[GenerationUsage]
?
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.
It's the same thing in Python. The newer way of writing this is using type unions.
feat: generate
types.py
fromgenkit-schema.json
using datamodel-codegen #1807ISSUE: #1807
CHANGELOG:
types.py module.
routinely.
content differently preventing the hassles of updating this file per
commit.
Checklist (if applicable):