Refactor Metadata Generation to Use YAML-Based Prompt Management#14
Open
KunalScriptz wants to merge 3 commits intoQiuYannnn:mainfrom
Open
Refactor Metadata Generation to Use YAML-Based Prompt Management#14KunalScriptz wants to merge 3 commits intoQiuYannnn:mainfrom
KunalScriptz wants to merge 3 commits intoQiuYannnn:mainfrom
Conversation
Owner
|
Thank you for the update. I find the modifications very useful. Could you please pull the latest version from the main branch and modify the code again? I released a new version yesterday with some structural updates. |
Author
|
Sure, ill work on it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR refactors the metadata generation process for images and text documents by introducing YAML-based prompt management. Instead of hardcoding prompts directly in the code, all prompts are stored in a prompts.yaml file, which is loaded once and used throughout the application. This enhances maintainability and makes it easier to update or extend prompts in the future.
Changes:
Added prompts.yaml file in the prompts directory, containing structured prompts for image and text processing.
Created a load_prompts function to load YAML prompts at runtime.
Refactored the generate_image_metadata and generate_text_metadata functions to utilize the YAML-based prompts.
Improved dynamic content handling by replacing placeholders (e.g., {{ description }}) in prompts.
Motivation and Context:
This change addresses the need for better prompt management and easier scalability when modifying or adding new prompts. Centralizing the prompt management in a YAML file reduces code duplication and improves the clarity of prompt definitions.