Closed scezen closed 2 months ago
This PR addresses issue #377.
ApiConfig: Updated GenAiCompletionService bean to include PromptConfig as parameter. Added PromptConfig bean.
GenAiCompletionService
PromptConfig
GenAiCompletionService: Updated and added applyRateLimit method for rate limiting.
applyRateLimit
AiService: Refactored and enhanced following clean code principles:
prompt
generatePromptResponse
complete
generateDescriptionsForProduct
shouldSkipDescriptionGeneration
createAiDescriptions
storeGeneratedDescriptions
Configuration Files: Created AiPromptsConfig to handle root prompts and list of PromptConfig. Added rateLimitDelay attribute to PromptConfig.
AiPromptsConfig
rateLimitDelay
tv.yml: Updated aiConfigs for the new meta template structure.
aiConfigs
forceOverride
Thanks @scezen for this work ! Document and code are excellent, congrats.
Issue Reference
This PR addresses issue #377.
Objective
Summary of Changes
ApiConfig: Updated
GenAiCompletionService
bean to includePromptConfig
as parameter. AddedPromptConfig
bean.GenAiCompletionService: Updated and added
applyRateLimit
method for rate limiting.AiService: Refactored and enhanced following clean code principles:
prompt
method togeneratePromptResponse
for clarity.complete
method to use the newgenerateDescriptionsForProduct
method.generateDescriptionsForProduct
: Handles the generation of descriptions for a product.shouldSkipDescriptionGeneration
: Checks if description generation should be skipped based on existing data and configurations.createAiDescriptions
: Generates AI descriptions for a product using the root prompt and individual prompts.storeGeneratedDescriptions
: Stores the generated AI descriptions in the product.Configuration Files: Created
AiPromptsConfig
to handle root prompts and list ofPromptConfig
. AddedrateLimitDelay
attribute toPromptConfig
.tv.yml: Updated
aiConfigs
for the new meta template structure.Additional Notes
generatePromptResponse
method ensures a consistent style for all generated texts.forceOverride
is enabled.PromptConfig
to manage timing between API calls.