Fix missing prompt keys in prompts_pt.py#25
Open
JoseTorquato wants to merge 1 commit into
Open
Conversation
…upport Portuguese ad and keyword generation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Still need readability approvals from:
|
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.
Summary
This PR adds two new sections—GENERATION and KEYWORDS_GENERATION—to prompts_pt.py so that Portuguese-language campaigns no longer fail with KeyError when generating ad copy or keywords.
Background
Our code always expects prompts[language]['GENERATION'] and prompts[language]['KEYWORDS_GENERATION'] to exist.
Without these entries in prompts_pt.py, any request to generate headlines, descriptions or keywords in Portuguese crashes.
Changes
GENERATION:
Added templates for both “with associative term” (titles & descriptions) and “without associative term” (titles-only & descriptions-only).
All templates output valid JSON lists, matching the patterns used in the English/Spanish files.
KEYWORDS_GENERATION:
Added a single template to generate up to 10 Portuguese keywords in the exact format expected by the generator.
Retained the existing SIZE_ENFORCEMENT section without modification.
Testing
Switched config.json to "language": "PT".
Ran the “headline generation” and “keyword generation” pipelines against a sample term—both now return valid JSON arrays instead of throwing errors.
Verified that English/Spanish pipelines remain unaffected.
Impact
Fixes all KeyError: 'GENERATION' and KeyError: 'KEYWORDS_GENERATION' for Portuguese.
Enables full support for Portuguese campaigns in the Topic Mine project without altering behavior for other languages.