Skip to content

Refactor Metadata Generation to Use YAML-Based Prompt Management#14

Open
KunalScriptz wants to merge 3 commits intoQiuYannnn:mainfrom
KunalScriptz:add-prompts-folder
Open

Refactor Metadata Generation to Use YAML-Based Prompt Management#14
KunalScriptz wants to merge 3 commits intoQiuYannnn:mainfrom
KunalScriptz:add-prompts-folder

Conversation

@KunalScriptz
Copy link
Copy Markdown

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.

@QiuYannnn
Copy link
Copy Markdown
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.

@KunalScriptz
Copy link
Copy Markdown
Author

Sure, ill work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants