Added Prompt for tools #68

Merged
Simo93-rgb merged 5 commits from 64-prompt-for-tools into main 2025-10-31 00:13:02 +01:00
Simo93-rgb commented 2025-10-30 17:28:29 +01:00 (Migrated from github.com)
  • Ho spostato plan_memory_tools.py al percorso src/app/api/tools/plan_memory_tool.py
  • Ho specificato meglio al team leader che è un consulente finanziario
  • Ho precisato un po' meglio agli agenti i proprio tool a disposizione
  • Ho creato dei file per salvare le istruzioni dei tool al percorso src/app/api/tools/instructions
    • Quei file sono letti con un metodo nella rispettiva classe

Avrei voluto testare meglio ma Google ha i modelli saturi oggi e provando con QWEN3 come team leader non ottengo risultati, è stupido e si perde malissimo.

- Ho spostato plan_memory_tools.py al percorso `src/app/api/tools/plan_memory_tool.py` - Ho specificato meglio al team leader che è un consulente finanziario - Ho precisato un po' meglio agli agenti i proprio tool a disposizione - Ho creato dei file per salvare le istruzioni dei tool al percorso `src/app/api/tools/instructions` - Quei file sono letti con un metodo nella rispettiva classe Avrei voluto testare meglio ma Google ha i modelli saturi oggi e provando con QWEN3 come team leader non ottengo risultati, è stupido e si perde malissimo.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-10-30 17:30:49 +01:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR refactors toolkit instruction strings by externalizing them from inline code to dedicated markdown files. It also relocates the PlanMemoryTool to the api/tools directory and significantly enhances agent prompt documentation with detailed tool usage guidance, comprehensive examples, and improved workflow patterns.

  • Extracted hardcoded instruction strings into external markdown files for better maintainability
  • Added new CryptoSymbolsTools integration to team leader workflow for cryptocurrency name resolution
  • Expanded agent prompts with detailed tool documentation, selection strategies, and comprehensive query examples
  • Created extensive documentation file with 500+ lines of query examples and keyword triggers

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/app/api/tools/symbols_tool.py Adds _load_instructions() method to load instructions from external markdown file
src/app/api/tools/social_tool.py Adds _load_instructions() method to externalize social toolkit instructions
src/app/api/tools/plan_memory_tool.py Adds _load_instructions() method to externalize plan memory instructions
src/app/api/tools/news_tool.py Adds _load_instructions() method to externalize news toolkit instructions
src/app/api/tools/market_tool.py Adds _load_instructions() method to externalize market toolkit instructions
src/app/api/tools/instructions/symbols_instructions.md New file containing comprehensive cryptocurrency symbol tool documentation
src/app/api/tools/instructions/social_instructions.md New file containing social media toolkit usage instructions
src/app/api/tools/instructions/plan_memory_instructions.md New file containing plan memory tool usage instructions
src/app/api/tools/instructions/news_instructions.md New file containing news APIs toolkit usage instructions
src/app/api/tools/instructions/market_instructions.md New file containing market APIs toolkit usage instructions
src/app/agents/prompts/team_social.md Enhanced social agent prompt with detailed tool selection strategies
src/app/agents/prompts/team_news.md Enhanced news agent prompt with query formulation guidance and tool selection
src/app/agents/prompts/team_market.md Enhanced market agent prompt with comprehensive tool documentation
src/app/agents/prompts/team_leader.md Major enhancement adding CryptoSymbolsTools integration and detailed workflows
src/app/agents/core.py Updates import path for PlanMemoryTool relocation
docs/Query_Examples.md New comprehensive documentation with 500+ lines of query examples
Comments suppressed due to low confidence (4)

src/app/api/tools/plan_memory_tool.py:23

  • The _load_instructions() method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message.
    src/app/api/tools/instructions/social_instructions.md:1
  • The docstring references 'external text file' but the file is actually a markdown file (.md). Update the comment to say 'external markdown file' for consistency with other tools.
Social Media Toolkit - Usage Instructions

src/app/api/tools/instructions/news_instructions.md:1

  • The docstring references 'external text file' but the file is actually a markdown file (.md). Update the comment to say 'external markdown file' for consistency with other tools.
News APIs Toolkit - Usage Instructions

src/app/api/tools/instructions/market_instructions.md:1

  • The docstring references 'external text file' but the file is actually a markdown file (.md). Update the comment to say 'external markdown file' for consistency with other tools.
Market APIs Toolkit - Usage Instructions

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

## Pull Request Overview This PR refactors toolkit instruction strings by externalizing them from inline code to dedicated markdown files. It also relocates the `PlanMemoryTool` to the `api/tools` directory and significantly enhances agent prompt documentation with detailed tool usage guidance, comprehensive examples, and improved workflow patterns. - Extracted hardcoded instruction strings into external markdown files for better maintainability - Added new `CryptoSymbolsTools` integration to team leader workflow for cryptocurrency name resolution - Expanded agent prompts with detailed tool documentation, selection strategies, and comprehensive query examples - Created extensive documentation file with 500+ lines of query examples and keyword triggers ### Reviewed Changes Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | src/app/api/tools/symbols_tool.py | Adds `_load_instructions()` method to load instructions from external markdown file | | src/app/api/tools/social_tool.py | Adds `_load_instructions()` method to externalize social toolkit instructions | | src/app/api/tools/plan_memory_tool.py | Adds `_load_instructions()` method to externalize plan memory instructions | | src/app/api/tools/news_tool.py | Adds `_load_instructions()` method to externalize news toolkit instructions | | src/app/api/tools/market_tool.py | Adds `_load_instructions()` method to externalize market toolkit instructions | | src/app/api/tools/instructions/symbols_instructions.md | New file containing comprehensive cryptocurrency symbol tool documentation | | src/app/api/tools/instructions/social_instructions.md | New file containing social media toolkit usage instructions | | src/app/api/tools/instructions/plan_memory_instructions.md | New file containing plan memory tool usage instructions | | src/app/api/tools/instructions/news_instructions.md | New file containing news APIs toolkit usage instructions | | src/app/api/tools/instructions/market_instructions.md | New file containing market APIs toolkit usage instructions | | src/app/agents/prompts/team_social.md | Enhanced social agent prompt with detailed tool selection strategies | | src/app/agents/prompts/team_news.md | Enhanced news agent prompt with query formulation guidance and tool selection | | src/app/agents/prompts/team_market.md | Enhanced market agent prompt with comprehensive tool documentation | | src/app/agents/prompts/team_leader.md | Major enhancement adding CryptoSymbolsTools integration and detailed workflows | | src/app/agents/core.py | Updates import path for PlanMemoryTool relocation | | docs/Query_Examples.md | New comprehensive documentation with 500+ lines of query examples | </details> <details> <summary>Comments suppressed due to low confidence (4)</summary> **src/app/api/tools/plan_memory_tool.py:23** * The `_load_instructions()` method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message. **src/app/api/tools/instructions/social_instructions.md:1** * The docstring references 'external text file' but the file is actually a markdown file (.md). Update the comment to say 'external markdown file' for consistency with other tools. ``` Social Media Toolkit - Usage Instructions ``` **src/app/api/tools/instructions/news_instructions.md:1** * The docstring references 'external text file' but the file is actually a markdown file (.md). Update the comment to say 'external markdown file' for consistency with other tools. ``` News APIs Toolkit - Usage Instructions ``` **src/app/api/tools/instructions/market_instructions.md:1** * The docstring references 'external text file' but the file is actually a markdown file (.md). Update the comment to say 'external markdown file' for consistency with other tools. ``` Market APIs Toolkit - Usage Instructions ``` </details> --- 💡 <a href="/Berack96/upo-appAI/new/main/.github?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-30 17:30:49 +01:00

The _load_instructions() method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message.

        try:
            return instructions_path.read_text(encoding="utf-8")
        except OSError:
            return "Market API instructions are unavailable."
The `_load_instructions()` method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message. ```suggestion try: return instructions_path.read_text(encoding="utf-8") except OSError: return "Market API instructions are unavailable." ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-30 17:30:48 +01:00

The _load_instructions() method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message.

        try:
            return instructions_path.read_text(encoding="utf-8")
        except Exception as e:
            # Fallback to a default instruction string if the file is missing or unreadable
            return (
                "News APIs Toolkit instructions could not be loaded. "
                "The instructions file is missing or unreadable. "
                "Please ensure 'news_instructions.md' exists in the 'instructions' directory."
            )
The `_load_instructions()` method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message. ```suggestion try: return instructions_path.read_text(encoding="utf-8") except Exception as e: # Fallback to a default instruction string if the file is missing or unreadable return ( "News APIs Toolkit instructions could not be loaded. " "The instructions file is missing or unreadable. " "Please ensure 'news_instructions.md' exists in the 'instructions' directory." ) ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-30 17:30:48 +01:00

The _load_instructions() method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message.

        try:
            return instructions_path.read_text(encoding="utf-8")
        except Exception as e:
            # Fallback to a default instruction string or log the error
            return (
                "SocialAPIsTool instructions could not be loaded from file. "
                "Default instructions: Use the available tools to retrieve top cryptocurrency-related posts "
                "from supported social media providers. Configure providers in configs.yaml."
            )
The `_load_instructions()` method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message. ```suggestion try: return instructions_path.read_text(encoding="utf-8") except Exception as e: # Fallback to a default instruction string or log the error return ( "SocialAPIsTool instructions could not be loaded from file. " "Default instructions: Use the available tools to retrieve top cryptocurrency-related posts " "from supported social media providers. Configure providers in configs.yaml." ) ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-30 17:30:48 +01:00

The _load_instructions() method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message.

        try:
            return instructions_path.read_text(encoding="utf-8")
        except Exception as e:
            logging.error(f"Could not read instructions file at {instructions_path}: {e}")
            return (
                "Crypto Symbols Tool Instructions:\n"
                "This toolkit provides access to cryptocurrency symbols via Yahoo Finance.\n"
                "Use the available tools to list all symbols or search by name."
            )
The `_load_instructions()` method lacks error handling for missing instruction files. If the markdown file doesn't exist or is unreadable, this will raise an unhandled exception during toolkit initialization. Consider adding a try-except block with a fallback to a default instruction string or a more informative error message. ```suggestion try: return instructions_path.read_text(encoding="utf-8") except Exception as e: logging.error(f"Could not read instructions file at {instructions_path}: {e}") return ( "Crypto Symbols Tool Instructions:\n" "This toolkit provides access to cryptocurrency symbols via Yahoo Finance.\n" "Use the available tools to list all symbols or search by name." ) ```
Berack96 (Migrated from github.com) reviewed 2025-10-30 20:15:04 +01:00
Berack96 (Migrated from github.com) commented 2025-10-30 20:15:04 +01:00

It is as expected since the missing or corrupted instruction must be a blocking error

It is as expected since the missing or corrupted instruction must be a blocking error
Berack96 (Migrated from github.com) requested changes 2025-10-30 20:19:34 +01:00
Berack96 (Migrated from github.com) commented 2025-10-30 20:18:32 +01:00

Esiste già un metodo simile in __init__.py dentro agents/prompt.
Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.

Esiste già un metodo simile in `__init__.py` dentro agents/prompt. Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.
Berack96 (Migrated from github.com) commented 2025-10-30 20:18:45 +01:00

Esiste già un metodo simile in __init__.py dentro agents/prompt.
Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.

Esiste già un metodo simile in `__init__.py` dentro agents/prompt. Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.
@@ -0,0 +8,4 @@
name: str
status: Literal["pending", "completed", "failed"]
result: str | None
Berack96 (Migrated from github.com) commented 2025-10-30 20:18:48 +01:00

Esiste già un metodo simile in __init__.py dentro agents/prompt.
Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.

Esiste già un metodo simile in `__init__.py` dentro agents/prompt. Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.
Berack96 (Migrated from github.com) commented 2025-10-30 20:18:53 +01:00

Esiste già un metodo simile in __init__.py dentro agents/prompt.
Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.

Esiste già un metodo simile in `__init__.py` dentro agents/prompt. Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.
Berack96 (Migrated from github.com) commented 2025-10-30 20:18:58 +01:00

Esiste già un metodo simile in __init__.py dentro agents/prompt.
Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.

Esiste già un metodo simile in `__init__.py` dentro agents/prompt. Bastava richiamare quello o crearne uno universale da mettere da qualche parte, non replicarlo per ogni tool.
Berack96 (Migrated from github.com) approved these changes 2025-10-31 00:09:55 +01:00
Sign in to join this conversation.