Skip to content

Add Google Financial News Analysis Prompt Generator#43

Open
ewdlop wants to merge 1 commit intomainfrom
add-financial-news-prompt-16652745256423206052
Open

Add Google Financial News Analysis Prompt Generator#43
ewdlop wants to merge 1 commit intomainfrom
add-financial-news-prompt-16652745256423206052

Conversation

@ewdlop
Copy link
Owner

@ewdlop ewdlop commented Jan 31, 2026

Implemented a Python script to generate the "Google Financial News Analysis" prompt as requested. The script accepts CLI arguments for keyword, time range, region, and focus area, and outputs the filled-in prompt. Included unit tests to verify functionality.


PR created automatically by Jules for task 16652745256423206052 started by @ewdlop

- Created `Finance/generate_news_prompt.py`: A CLI tool to generate a structured financial news analysis prompt based on user inputs.
- Created `Finance/test_generate_news_prompt.py`: Unit tests for the prompt generator.
- The prompt is designed for professional, neutral, and fact-oriented financial analysis.

Co-authored-by: ewdlop <25368970+ewdlop@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 31, 2026 04:32
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a reusable Python-based generator for the “Google Financial News Analysis” prompt plus basic unit tests, enabling both programmatic and CLI-driven creation of the prompt with customizable parameters.

Changes:

  • Implemented generate_news_prompt.py with a formatted prompt template and an argparse-based CLI that accepts keyword, time range, region, and focus area.
  • Added test_generate_news_prompt.py to verify default and custom parameter substitution and to check that key structural sections of the prompt are present.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Finance/generate_news_prompt.py Defines the financial news analysis prompt template, parameterized by keyword, time range, region, and focus, and exposes a CLI entry point.
Finance/test_generate_news_prompt.py Provides unit tests to validate prompt content for default/custom arguments and ensure core structural sections appear in the generated prompt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,117 @@
import argparse
import sys
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys is imported but never used in this module, which adds unnecessary clutter; consider removing the unused import to keep the script clean and avoid lint warnings.

Suggested change
import sys

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +109
def generate_prompt(keyword, time_range="7 天", region="全球", focus="宏觀經濟"):
return PROMPT_TEMPLATE.format(
keyword=keyword,
time_range=time_range,
region=region,
focus=focus
)

def main():
parser = argparse.ArgumentParser(description="Generate Google Financial News Prompt")
parser.add_argument("keyword", help="查詢關鍵字")
parser.add_argument("--time_range", default="7 天", help="時間範圍")
parser.add_argument("--region", default="全球", help="地區")
parser.add_argument("--focus", default="宏觀經濟", help="關注面向")
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default values for time_range, region, and focus are duplicated between the generate_prompt function signature and the argparse add_argument(..., default=...) calls, which can drift out of sync if one is changed without the other; it would be more maintainable to define these defaults in a single place and have both the function and CLI reuse them.

Copilot uses AI. Check for mistakes.
import os

# Add the directory containing the script to sys.path
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sys.path.append(...) means the test directory is added to the end of sys.path, so if there is an installed module named generate_news_prompt elsewhere, the tests may import that module instead of the local file; using sys.path.insert(0, ...) (or another approach that prefers the local path) would ensure the tests actually cover this script.

Suggested change
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

Copilot uses AI. Check for mistakes.
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