Skip to content

Conversation

@maxl0rd
Copy link
Contributor

@maxl0rd 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.
@maxl0rd maxl0rd force-pushed the dotprompt_plugin branch from f4ba7e5 to b9df14f Compare May 8, 2024 20:54
@maxl0rd maxl0rd requested a review from mbleigh May 8, 2024 20:58
@maxl0rd maxl0rd force-pushed the dotprompt_plugin branch from b9df14f to c059619 Compare May 8, 2024 21:14
@maxl0rd maxl0rd force-pushed the dotprompt_plugin branch 3 times, most recently from 72e3c71 to 1815bb6 Compare May 9, 2024 13:28
Copy link
Collaborator

@pavelgj pavelgj May 9, 2024

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.

Copy link
Contributor Author

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.

@MichaelDoyle
Copy link
Member

MichaelDoyle commented May 9, 2024

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.
@maxl0rd maxl0rd force-pushed the dotprompt_plugin branch from 1815bb6 to 9df4ddd Compare May 9, 2024 14:13
@maxl0rd
Copy link
Contributor Author

maxl0rd commented May 9, 2024

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

@maxl0rd maxl0rd merged commit f2c3fd3 into main May 9, 2024
@maxl0rd maxl0rd deleted the dotprompt_plugin branch May 9, 2024 14:21
cabljac pushed a commit to invertase/genkit that referenced this pull request Nov 25, 2025
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants