-
Notifications
You must be signed in to change notification settings - Fork 145
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
Moving the dotprompt package into a plugin #80
Conversation
maxl0rd
commented
May 8, 2024
- Dotprompt should now be configured as a plugin but has fallback behavior to look in a default prompts folder so no existing code should break.
- Async init used to load the entire prompts folder even if prompts are not explicitly referenced in code.
72e3c71
to
1815bb6
Compare
): Promise<void> { | ||
const promptsPath = resolve(dir); | ||
return new Promise<void>((resolve, reject) => { | ||
readdir( |
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.
Optional: there's a readdirSync
variant... that you can use to avoid all this boilerplate with Promises.
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.
I looked at that, but it was slightly harder to resolve the initialization at the right place.
Any samples that need to get updated based on this new plugin? I see the dev-ui one, for some reason I was expecting a few more. |
- Dotprompt should now be configured as a plugin but has fallback behavior to look in a default prompts folder so no existing code should break. - Async init used to load the entire prompts folder even if prompts are not explicitly referenced in code.
One clarification: as long as the prompts are in the default location, the library has exactly the same behavior as before even when the plugin isn't initialized due to a friendly fallback behavior. But for correctness, you should begin adding the plugin to genkit.conf |