Skip to content

Fix missing prompt keys in prompts_pt.py#25

Open
JoseTorquato wants to merge 1 commit into
google-marketing-solutions:mainfrom
JoseTorquato:fix/prompt_pt
Open

Fix missing prompt keys in prompts_pt.py#25
JoseTorquato wants to merge 1 commit into
google-marketing-solutions:mainfrom
JoseTorquato:fix/prompt_pt

Conversation

@JoseTorquato

Copy link
Copy Markdown

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.

@google-cla

google-cla Bot commented Jul 4, 2025

Copy link
Copy Markdown

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.

@gps-readability-bot

Copy link
Copy Markdown

Still need readability approvals from:

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant