Skip to content

refactor: Externalize configuration and update repository tracking#95

Open
abuzarmahmood wants to merge 180 commits intomainfrom
93-put-llm_config-in-a-separate-file
Open

refactor: Externalize configuration and update repository tracking#95
abuzarmahmood wants to merge 180 commits intomainfrom
93-put-llm_config-in-a-separate-file

Conversation

@abuzarmahmood
Copy link
Owner

No description provided.

@abuzarmahmood abuzarmahmood linked an issue Mar 9, 2025 that may be closed by this pull request
@abuzarmahmood
Copy link
Owner Author

Generated edit command:

  • Summary of User's Issues and Requests:

    • The user wants to address the last comment in the GitHub issue, which suggests focusing on the [ develop_issue ] comment. This involves creating a separate configuration file for llm_config and organizing repository names as a dictionary. Additionally, the code should be updated to import tracked repositories correctly from the updated configuration file.
  • Overview of Plan to Address the Issues:

    1. Create a new configuration file to store the llm_config dictionary and repository names.
    2. Modify existing code in agents.py and response_agent.py to import and use the configuration from the new file.
    3. Update the import for tracked repositories to use the new configuration file.
  • Specific Details of Changes to be Made:

    1. Create a Configuration File:

      • File: /home/exouser/Desktop/blech_github_bot/src/repos/abuzarmahmood/blech_github_bot/src/config.py
      • Description: New Python file to store the llm_config dictionary and repository names.
      • Code snippet:
        import os
        import random
        from dotenv import load_dotenv
        
        # Load environment variables
        load_dotenv()
        
        # Define the LLM configuration
        llm_config = {
            "model": "gpt-4o",
            "api_key": os.getenv('OPENAI_API_KEY'),
            "temperature": random.uniform(0, 0.2),
        }
        
        # Define repository names as a dictionary
        repo_names = {
            "repo1": "owner/repo1",
            "repo2": "owner/repo2",
            # Add more repositories as needed
        }
    2. Modify agents.py:

      • File: /home/exouser/Desktop/blech_github_bot/src/repos/abuzarmahmood/blech_github_bot/src/agents.py
      • Line: 134-139
      • Description: Import llm_config from the new configuration file and remove the existing inline definition.
      • Code snippet:
        # Import the llm_config from the new config file
        from config import llm_config
        
        def create_agent(agent_name: str) -> AssistantAgent:
            """Create and configure the autogen agents"""
        
            agent = AssistantAgent(
                name=agent_name,
                llm_config=llm_config,
                system_message=agent_system_messages[agent_name],
            )
    3. Modify response_agent.py:

      • File: /home/exouser/Desktop/blech_github_bot/src/repos/abuzarmahmood/blech_github_bot/src/response_agent.py
      • Line: 55-59
      • Description: Remove the inline llm_config definition and import it from the new configuration file.
      • Code snippet:
        # Import the llm_config from the new config file
        from config import llm_config
        
        # Remove the existing llm_config definition
    4. Update Import for Tracked Repositories:

      • File: /home/exouser/Desktop/blech_github_bot/src/repos/abuzarmahmood/blech_github_bot/src/response_agent.py
      • Line: 708
      • Description: Update the import to use repo_names from the new configuration file.
      • Code snippet:
        # Import the repo_names from the new config file
        from config import repo_names
        
        # Use repo_names instead of bot_tools.get_tracked_repos()
        tracked_repos = repo_names.values()

By implementing these changes, the llm_config and repository names will be externalized into a separate configuration file, enhancing the maintainability and organization of the codebase. Additionally, the tracked repositories will be correctly imported from the updated configuration file.

TERMINATE

Aider output:

View Aider Output
Aider v0.75.2
Main model: anthropic/claude-3-7-sonnet-20250219 with diff edit format, infinite output
Weak model: anthropic/claude-3-5-haiku-20241022
Git repo: .git with 11 files
Repo-map: using 4096 tokens, auto refresh


src/agents.py

src/response_agent.py
I'll implement the changes to create a separate configuration file for llm_config and repository names. Here are the specific changes:                                                        

 1 First, let's create a new configuration file:                                                                                                                                              

src/config.py                                                                                                                                                                                 

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
 =======                                                                                                                                                                                      
 """                                                                                                                                                                                          
 Configuration file for the GitHub bot                                                                                                                                                        
 """                                                                                                                                                                                          
 import os                                                                                                                                                                                    
 import random                                                                                                                                                                                
 from dotenv import load_dotenv                                                                                                                                                               
                                                                                                                                                                                              
 # Load environment variables                                                                                                                                                                 
 load_dotenv()                                                                                                                                                                                
                                                                                                                                                                                              
 # Define the LLM configuration                                                                                                                                                               
 llm_config = {                                                                                                                                                                               
     "model": "gpt-4o",                                                                                                                                                                       
     "api_key": os.getenv('OPENAI_API_KEY'),                                                                                                                                                  
     "temperature": random.uniform(0, 0.2),                                                                                                                                                   
 }                                                                                                                                                                                            
                                                                                                                                                                                              
 # Define repository names as a dictionary                                                                                                                                                    
 repo_names = {                                                                                                                                                                               
     "repo1": "owner/repo1",                                                                                                                                                                  
     "repo2": "owner/repo2",                                                                                                                                                                  
     # Add more repositories as needed                                                                                                                                                        
 }                                                                                                                                                                                            
                                                                                                                                                                                              
 def get_tracked_repos():                                                                                                                                                                     
     """                                                                                                                                                                                      
     Get list of tracked repositories from the repo_names dictionary                                                                                                                          
                                                                                                                                                                                              
     Returns:                                                                                                                                                                                 
         List of repository names in format owner/repo                                                                                                                                        
     """                                                                                                                                                                                      
     return list(repo_names.values())                                                                                                                                                         
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

 2 Now, let's modify the response_agent.py file to use the configuration:                                                                                                                     

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
 """                                                                                                                                                                                          
 Agent for generating responses to GitHub issues using pyautogen                                                                                                                              
 """                                                                                                                                                                                          
 from typing import Optional, Tuple                                                                                                                                                           
                                                                                                                                                                                              
 from dotenv import load_dotenv                                                                                                                                                               
 import string                                                                                                                                                                                
 import triggers                                                                                                                                                                              
 from agents import (                                                                                                                                                                         
     create_user_agent,                                                                                                                                                                       
     create_agent,                                                                                                                                                                            
     generate_prompt,                                                                                                                                                                         
     parse_comments                                                                                                                                                                           
 )                                                                                                                                                                                            
 import agents                                                                                                                                                                                
 from autogen import AssistantAgent                                                                                                                                                           
 import bot_tools                                                                                                                                                                             
                                                                                                                                                                                              
 from git_utils import (                                                                                                                                                                      
     get_github_client,                                                                                                                                                                       
     get_repository,                                                                                                                                                                          
     write_issue_response,                                                                                                                                                                    
     get_issue_details,                                                                                                                                                                       
     clone_repository,                                                                                                                                                                        
     update_repository,                                                                                                                                                                       
     get_issue_comments,                                                                                                                                                                      
     create_pull_request_from_issue,                                                                                                                                                          
     get_development_branch,                                                                                                                                                                  
     has_linked_pr,                                                                                                                                                                           
     push_changes_with_authentication,                                                                                                                                                        
 )                                                                                                                                                                                            
 from github.Repository import Repository                                                                                                                                                     
 from github.Issue import Issue                                                                                                                                                               
 from branch_handler import (                                                                                                                                                                 
     checkout_branch,                                                                                                                                                                         
     back_to_master_branch,                                                                                                                                                                   
     delete_branch                                                                                                                                                                            
 )                                                                                                                                                                                            
 import autogen                                                                                                                                                                               
 import subprocess                                                                                                                                                                            
 import os                                                                                                                                                                                    
 from pprint import pprint                                                                                                                                                                    
 from collections.abc import Callable                                                                                                                                                         
 import random                                                                                                                                                                                
 import traceback                                                                                                                                                                             
 import json                                                                                                                                                                                  
 import re                                                                                                                                                                                    
 from urlextract import URLExtract                                                                                                                                                            
                                                                                                                                                                                              
 load_dotenv()                                                                                                                                                                                
                                                                                                                                                                                              
 api_key = os.getenv('OPENAI_API_KEY')                                                                                                                                                        
 if not api_key:                                                                                                                                                                              
     raise ValueError("OpenAI API key not found in environment variables")                                                                                                                    
                                                                                                                                                                                              
 llm_config = {                                                                                                                                                                               
     "model": "gpt-4o",                                                                                                                                                                       
     "api_key": api_key,                                                                                                                                                                      
     "temperature": random.uniform(0, 0.2),                                                                                                                                                   
 }                                                                                                                                                                                            
 =======                                                                                                                                                                                      
 """                                                                                                                                                                                          
 Agent for generating responses to GitHub issues using pyautogen                                                                                                                              
 """                                                                                                                                                                                          
 from typing import Optional, Tuple                                                                                                                                                           
                                                                                                                                                                                              
 import string                                                                                                                                                                                
 import triggers                                                                                                                                                                              
 from agents import (                                                                                                                                                                         
     create_user_agent,                                                                                                                                                                       
     create_agent,                                                                                                                                                                            
     generate_prompt,                                                                                                                                                                         
     parse_comments                                                                                                                                                                           
 )                                                                                                                                                                                            
 import agents                                                                                                                                                                                
 from autogen import AssistantAgent                                                                                                                                                           
 import bot_tools                                                                                                                                                                             
                                                                                                                                                                                              
 from git_utils import (                                                                                                                                                                      
     get_github_client,                                                                                                                                                                       
     get_repository,                                                                                                                                                                          
     write_issue_response,                                                                                                                                                                    
     get_issue_details,                                                                                                                                                                       
     clone_repository,                                                                                                                                                                        
     update_repository,                                                                                                                                                                       
     get_issue_comments,                                                                                                                                                                      
     create_pull_request_from_issue,                                                                                                                                                          
     get_development_branch,                                                                                                                                                                  
     has_linked_pr,                                                                                                                                                                           
     push_changes_with_authentication,                                                                                                                                                        
 )                                                                                                                                                                                            
 from github.Repository import Repository                                                                                                                                                     
 from github.Issue import Issue                                                                                                                                                               
 from branch_handler import (                                                                                                                                                                 
     checkout_branch,                                                                                                                                                                         
     back_to_master_branch,                                                                                                                                                                   
     delete_branch                                                                                                                                                                            
 )                                                                                                                                                                                            
 import autogen                                                                                                                                                                               
 import subprocess                                                                                                                                                                            
 import os                                                                                                                                                                                    
 from pprint import pprint                                                                                                                                                                    
 from collections.abc import Callable                                                                                                                                                         
 import traceback                                                                                                                                                                             
 import json                                                                                                                                                                                  
 import re                                                                                                                                                                                    
 from urlextract import URLExtract                                                                                                                                                            
 from config import llm_config                                                                                                                                                                
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

 3 Now, let's update the create_agent function in response_agent.py:                                                                                                                          

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
     # Create base agents                                                                                                                                                                     
     user = create_user_agent()                                                                                                                                                               
     file_assistant = create_agent("file_assistant", llm_config)                                                                                                                              
     edit_assistant = create_agent("edit_assistant", llm_config)                                                                                                                              
     summary_assistant = create_agent("summary_assistant", llm_config)                                                                                                                        
 =======                                                                                                                                                                                      
     # Create base agents                                                                                                                                                                     
     user = create_user_agent()                                                                                                                                                               
     file_assistant = create_agent("file_assistant")                                                                                                                                          
     edit_assistant = create_agent("edit_assistant")                                                                                                                                          
     summary_assistant = create_agent("summary_assistant")                                                                                                                                    
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

 4 Let's update the other instances of create_agent in response_agent.py:                                                                                                                     

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
     comment_summary_assistant = create_agent(                                                                                                                                                
         "comment_summary_assistant", llm_config)                                                                                                                                             
 =======                                                                                                                                                                                      
     comment_summary_assistant = create_agent(                                                                                                                                                
         "comment_summary_assistant")                                                                                                                                                         
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
     feedback_assistant = create_agent("feedback_assistant", llm_config)                                                                                                                      
 =======                                                                                                                                                                                      
     feedback_assistant = create_agent("feedback_assistant")                                                                                                                                  
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
     generate_edit_command_assistant = create_agent(                                                                                                                                          
         "generate_edit_command_assistant", llm_config)                                                                                                                                       
 =======                                                                                                                                                                                      
     generate_edit_command_assistant = create_agent(                                                                                                                                          
         "generate_edit_command_assistant")                                                                                                                                                   
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

 5 Now, let's modify the create_agent function in agents.py:                                                                                                                                  

src/agents.py                                                                                                                                                                                 

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
 def create_agent(agent_name: str, llm_config: dict) -> AssistantAgent:                                                                                                                       
     """Create and configure the autogen agents"""                                                                                                                                            
                                                                                                                                                                                              
     agent = AssistantAgent(                                                                                                                                                                  
         name=agent_name,                                                                                                                                                                     
         llm_config=llm_config,                                                                                                                                                               
         system_message=agent_system_messages[agent_name],                                                                                                                                    
     )                                                                                                                                                                                        
                                                                                                                                                                                              
     agent = register_functions(agent, register_how="llm")                                                                                                                                    
                                                                                                                                                                                              
     return agent                                                                                                                                                                             
 =======                                                                                                                                                                                      
 def create_agent(agent_name: str) -> AssistantAgent:                                                                                                                                         
     """Create and configure the autogen agents"""                                                                                                                                            
     from config import llm_config                                                                                                                                                            
                                                                                                                                                                                              
     agent = AssistantAgent(                                                                                                                                                                  
         name=agent_name,                                                                                                                                                                     
         llm_config=llm_config,                                                                                                                                                               
         system_message=agent_system_messages[agent_name],                                                                                                                                    
     )                                                                                                                                                                                        
                                                                                                                                                                                              
     agent = register_functions(agent, register_how="llm")                                                                                                                                    
                                                                                                                                                                                              
     return agent                                                                                                                                                                             
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

 6 Finally, let's update the code that gets tracked repositories:                                                                                                                             

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
 if __name__ == '__main__':                                                                                                                                                                   
     # Get list of repositories to process                                                                                                                                                    
     tracked_repos = bot_tools.get_tracked_repos()                                                                                                                                            
     print(f'Found {len(tracked_repos)} tracked repositories')                                                                                                                                
     pprint(tracked_repos)                                                                                                                                                                    
 =======                                                                                                                                                                                      
 if __name__ == '__main__':                                                                                                                                                                   
     # Get list of repositories to process                                                                                                                                                    
     from config import get_tracked_repos                                                                                                                                                     
     tracked_repos = get_tracked_repos()                                                                                                                                                      
     print(f'Found {len(tracked_repos)} tracked repositories')                                                                                                                                
     pprint(tracked_repos)                                                                                                                                                                    
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

These changes will:                                                                                                                                                                           

 1 Create a new configuration file with the llm_config and repository names                                                                                                                   
 2 Remove the inline llm_config definition from response_agent.py                                                                                                                             
 3 Update the create_agent function to not require the llm_config parameter                                                                                                                   
 4 Update all calls to create_agent to remove the llm_config parameter                                                                                                                        
 5 Update the code to get tracked repositories from the new configuration file                                                                                                                

You can test these changes by running:                                                                                                                                                        

                                                                                                                                                                                              
 python src/response_agent.py                                                                                                                                                                 
                                                                                                                                                                                              

Tokens: 12k sent, 1.5k received. Cost: $0.06 message, $0.06 session.

src/config.py
Applied edit to src/agents.py
Applied edit to src/config.py
Applied edit to src/response_agent.py
Commit 1e3e3f5 refactor: Externalize configuration and update repository tracking

python src/response_agent.py

This response was automatically generated by blech_bot

@abuzarmahmood
Copy link
Owner Author

In response_agent.py, keep imports at top of file

@abuzarmahmood
Copy link
Owner Author

Applied changes based on comment:

View Aider Output
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Aider v0.75.2
Main model: anthropic/claude-3-7-sonnet-20250219 with diff edit format, infinite output
Weak model: anthropic/claude-3-5-haiku-20241022
Git repo: .git with 12 files
Repo-map: using 4096 tokens, auto refresh


src/config.py

src/response_agent.py
I'll modify the response_agent.py file to ensure all imports are at the top of the file, specifically importing llm_config from the existing config.py file.                                  

Here are the changes:                                                                                                                                                                         

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
 """                                                                                                                                                                                          
 Agent for generating responses to GitHub issues using pyautogen                                                                                                                              
 """                                                                                                                                                                                          
 from typing import Optional, Tuple                                                                                                                                                           
                                                                                                                                                                                              
 import string                                                                                                                                                                                
 import triggers                                                                                                                                                                              
 from agents import (                                                                                                                                                                         
     create_user_agent,                                                                                                                                                                       
     create_agent,                                                                                                                                                                            
     generate_prompt,                                                                                                                                                                         
     parse_comments                                                                                                                                                                           
 )                                                                                                                                                                                            
 import agents                                                                                                                                                                                
 from autogen import AssistantAgent                                                                                                                                                           
 import bot_tools                                                                                                                                                                             
                                                                                                                                                                                              
 from git_utils import (                                                                                                                                                                      
     get_github_client,                                                                                                                                                                       
     get_repository,                                                                                                                                                                          
     write_issue_response,                                                                                                                                                                    
     get_issue_details,                                                                                                                                                                       
     clone_repository,                                                                                                                                                                        
     update_repository,                                                                                                                                                                       
     get_issue_comments,                                                                                                                                                                      
     create_pull_request_from_issue,                                                                                                                                                          
     get_development_branch,                                                                                                                                                                  
     has_linked_pr,                                                                                                                                                                           
     push_changes_with_authentication,                                                                                                                                                        
 )                                                                                                                                                                                            
 =======                                                                                                                                                                                      
 """                                                                                                                                                                                          
 Agent for generating responses to GitHub issues using pyautogen                                                                                                                              
 """                                                                                                                                                                                          
 from typing import Optional, Tuple                                                                                                                                                           
                                                                                                                                                                                              
 import string                                                                                                                                                                                
 import triggers                                                                                                                                                                              
 from agents import (                                                                                                                                                                         
     create_user_agent,                                                                                                                                                                       
     create_agent,                                                                                                                                                                            
     generate_prompt,                                                                                                                                                                         
     parse_comments                                                                                                                                                                           
 )                                                                                                                                                                                            
 import agents                                                                                                                                                                                
 from autogen import AssistantAgent                                                                                                                                                           
 import bot_tools                                                                                                                                                                             
                                                                                                                                                                                              
 from git_utils import (                                                                                                                                                                      
     get_github_client,                                                                                                                                                                       
     get_repository,                                                                                                                                                                          
     write_issue_response,                                                                                                                                                                    
     get_issue_details,                                                                                                                                                                       
     clone_repository,                                                                                                                                                                        
     update_repository,                                                                                                                                                                       
     get_issue_comments,                                                                                                                                                                      
     create_pull_request_from_issue,                                                                                                                                                          
     get_development_branch,                                                                                                                                                                  
     has_linked_pr,                                                                                                                                                                           
     push_changes_with_authentication,                                                                                                                                                        
 )                                                                                                                                                                                            
 from config import llm_config                                                                                                                                                                
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

Now let's update all the signature lines that use llm_config:                                                                                                                                 

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
     signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                                       
 =======                                                                                                                                                                                      
     signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                                       
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
     signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                                       
 =======                                                                                                                                                                                      
     signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                                       
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
                         signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                   
 =======                                                                                                                                                                                      
                         signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                   
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

src/response_agent.py                                                                                                                                                                         

                                                                                                                                                                                              
 <<<<<<< SEARCH                                                                                                                                                                               
                 signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                           
 =======                                                                                                                                                                                      
                 signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"                                                           
 >>>>>>> REPLACE                                                                                                                                                                              
                                                                                                                                                                                              

The changes above add the import for llm_config from the config.py file at the top of the file. The signature lines that use llm_config remain unchanged since they're already correctly using
the variable that will now be imported.                                                                                                                                                       

Tokens: 8.9k sent, 703 received. Cost: $0.04 message, $0.04 session.
Applied edit to src/response_agent.py
Commit 202e3bf refactor: Import llm_config from config.py in response_agent.py


This response was automatically generated by blech_bot

abuzarmahmood and others added 17 commits March 17, 2025 06:10
…ctions to response_agent

- Removed unused functions related to file modification and git operations in `bot_tools.py`.
- Moved essential functions `get_tracked_repos` and `is_tool_related` from `bot_tools.py` to `response_agent.py`.
- Updated `response_agent.py` to use the functions internally, removing dependency on `bot_tools.py` for these operations.
- Added a cautionary comment in `bot_tools.py` for safe usage by agents.
…fficiency

- Sanitized issue titles by removing punctuation and spaces, improving branch name prediction.
- Replaced iteration over remote references with a more efficient `ls-remote` command to fetch heads.
- Commented out the old remote branch checking logic for potential future reference.
- Modified import of BeautifulSoup: switched from `from bs4 import BeautifulSoup` to `import bs4` to address module usage issue.
- Introduced `src_dir` and `base_dir` in `response_agent.py` to standardize path handling after recent project reorganization.

This commit resolves import errors and enhances directory path management post-reorganization.
…-given-as-part-of-issues' of https://github.com/abuzarmahmood/blech_github_bot into 9-add-util-to-scrape-text-from-urls-which-are-sometimes-given-as-part-of-issues
- Removed `scrape_text_from_url` and `summarize_text` from `bot_tools.py` to streamline module responsibilities.
- Transferred these functions to `response_agent.py` to consolidate scraping capabilities.
- Updated function calls in `response_agent.py` to use the relocated local versions, ensuring seamless operation.
- Cleaned up `agents.py` by removing outdated system messages related to URL scraping.
- Removed unused imports `requests` and `bs4` from `src/bot_tools.py`.
- Added necessary imports `requests` and `bs4` to `src/response_agent.py`.
- Removed duplicate definition of `extract_urls_from_issue` function in `src/response_agent.py`.
- Cleaned up comments in `src/agents.py` by removing redundant lines about `read_merged_summary` and `read_merged_docstrings`.
…rom-urls-which-are-sometimes-given-as-part-of-issues

9 add util to scrape text from urls which are sometimes given as part of issues
changes to max turns and local repo handling
…t-on-every-run' of https://github.com/abuzarmahmood/blech_github_bot into 22-auto-update-blech_github_bot-by-pulling-latest-commit-on-every-run
- Initialize GitHub client and determine the default branch using the GitHub API.
- Remove fallback mechanism for determining the default branch locally.
- Introduce reading configuration from `params.json` to control auto-update behavior.
- Modify bot initialization to conditionally update the repository based on `auto_update` parameter.
…rspy

test: Add comprehensive unit tests for triggers.py module
…tests

feat: Add code coverage reporting with pytest-cov and Codecov integration
 into 120-in-summarize_text-instead-of-truncating-pass-text-to-summary_agent
…ead-of-truncating-pass-text-to-summary_agent

feat: Implement intelligent text summarization using summary agent
- Removed duplicate "summary_agent" system message in `agents.py`.
- Updated reference to "summary_agent" to "summary_assistant" in `response_agent.py` to ensure consistency and correct usage.
- Add installation of `setuptools` and `wheel` for improved package management.
- Ensure dependencies are up-to-date for testing environment setup.
- The pytest and pytest-cov dependencies are removed from the workflow as they are presumably already included in the `requirements.txt` file.
- Removed version constraints for pytest and pytest-cov in requirements.txt to allow installation of the latest compatible versions.
- Added `numpy==1.18.2` to the `requirements.txt` file to manage numpy as a dependency for the project.
- Updated the `actions/checkout` action from version 2 to 4.
- Updated the `actions/setup-python` action from version 2 to 5.
- Ensures compatibility with newer GitHub Actions features and security updates.
- Removed specific version pinning for numpy to allow flexibility in version upgrades.
- Added `aider_install.sh` for streamlined installation using `aider-install`.
- Removed `aider-chat` and `numpy` from `requirements.txt` as they are no longer necessary.
- Changed `make install-deps` to `make install` in the GitHub Actions workflow to properly install dependencies before running tests.
- Removed push event trigger for branches and limited it to pull requests only.
- Simplified the workflow configuration by removing unnecessary branch filters.
- Renamed `run_response_agent.sh` and updated the virtual environment activation logic.
- Commented out code handling directory change and echo statement for debugging.
- Adjusted paths in `triggers.py` for module import efficiency.
- Standardized import ordering in `triggers.py`.
- Commented out unnecessary path adjustments in `test_triggers.py`.
- Created an `__init__.py` for the tests directory to facilitate module discovery.
- Added missing import statement for `os` and `sys`, ensuring compliance with style guidelines.
- Removed duplicate appendix of `sys.path` entry to avoid redundancy.
feat(setup): simplify installation process with aider-install script

- Added `aider_install.sh` for streamlined installation using `aider-install`.
- Removed `aider-chat` and `numpy` from `requirements.txt` as they are no longer necessary.

build: add Makefile for project installation and management

Move commands from aider_intall to Makefile

chore: update workflow to use makefile for dependency installation

fix(ci): correct make command for installing dependencies

- Changed `make install-deps` to `make install` in the GitHub Actions workflow to properly install dependencies before running tests.
@codecov
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 43.33333% with 204 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@c39d758). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/git_utils.py 4.95% 192 Missing ⚠️
src/branch_handler.py 0.00% 10 Missing ⚠️
tests/test_triggers.py 98.58% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #95   +/-   ##
=======================================
  Coverage        ?   42.08%           
=======================================
  Files           ?        4           
  Lines           ?      575           
  Branches        ?       65           
=======================================
  Hits            ?      242           
  Misses          ?      331           
  Partials        ?        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Put llm_config in a separate file

1 participant