Skip to content
6 changes: 4 additions & 2 deletions config/params.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"auto_update": false,
"print_llm_output": false,
"model": "gpt-4o",
"aider_model": "gpt-4o"
"file_assistant_model": "gpt-4o",
"edit_assistant_model": "gpt-4o",
"summary_assistant_model": "gpt-4o",
"feedback_assistant_model": "gpt-4o"
}
7 changes: 3 additions & 4 deletions src/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@ def create_user_agent():

def create_agent(agent_name: str, llm_config: dict) -> AssistantAgent:
"""Create and configure the autogen agents"""

agent_config = llm_config.get(agent_name, {})
agent_config = llm_config.get(agent_name, {})
agent = AssistantAgent(
name=agent_name,
llm_config=llm_config,
llm_config=agent_config,
system_message=agent_system_messages[agent_name],
)

agent = register_functions(agent, register_how="llm")

return agent

############################################################
Expand Down
6 changes: 4 additions & 2 deletions src/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
return list(repo.get_issues(state='all', labels=[query]))


def write_issue_response(issue: Issue, response_text: str) -> IssueComment:
def write_issue_response(issue: Issue, response_text: str, agent_name: str) -> IssueComment:
"""
Write a response to an issue with the blech_bot signature

Expand All @@ -166,7 +166,9 @@
# Import the model info from response_agent if available
try:
from response_agent import llm_config
signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {llm_config['model']}*"
agent_model = llm_config.get(

Check warning on line 169 in src/git_utils.py

View check run for this annotation

Codecov / codecov/patch

src/git_utils.py#L169

Added line #L169 was not covered by tests
agent_name, {}).get('model', 'default-model')
signature = f"\n\n---\n*This response was automatically generated by blech_bot using model {agent_model}*"

Check warning on line 171 in src/git_utils.py

View check run for this annotation

Codecov / codecov/patch

src/git_utils.py#L171

Added line #L171 was not covered by tests
except (ImportError, KeyError):
signature = basic_signature
response_text += signature
Expand Down
23 changes: 20 additions & 3 deletions src/response_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,26 @@
raise ValueError("OpenAI API key not found in environment variables")

llm_config = {
"model": params.get("model", "gpt-4o"),
"api_key": api_key,
"temperature": random.uniform(0, 0.2),
"file_assistant": {
"model": params.get("file_assistant_model", "gpt-4o"),
"api_key": api_key,
"temperature": random.uniform(0, 0.2),
},
"edit_assistant": {
"model": params.get("edit_assistant_model", "gpt-4o"),
"api_key": api_key,
"temperature": random.uniform(0, 0.2),
},
"summary_assistant": {
"model": params.get("summary_assistant_model", "gpt-4o"),
"api_key": api_key,
"temperature": random.uniform(0, 0.2),
},
"feedback_assistant": {
"model": params.get("feedback_assistant_model", "gpt-4o"),
"api_key": api_key,
"temperature": random.uniform(0, 0.2),
},
}
############################################################
# Response patterns
Expand Down
32 changes: 32 additions & 0 deletions tests/test_git_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import unittest
from unittest.mock import patch, Mock
from src.git_utils import get_github_client, get_repository, get_open_issues


class TestGitUtils(unittest.TestCase):

@patch('src.git_utils.Github')
def test_get_github_client(self, MockGithub):
mock_instance = MockGithub.return_value
client = get_github_client()
self.assertEqual(client, mock_instance)

@patch('src.git_utils.Github')
def test_get_repository(self, MockGithub):
mock_instance = MockGithub.return_value
mock_repo = Mock()
mock_instance.get_repo.return_value = mock_repo
repo = get_repository(mock_instance, 'owner/repo')
self.assertEqual(repo, mock_repo)

@patch('src.git_utils.Repository')
def test_get_open_issues(self, MockRepository):
mock_repo = MockRepository.return_value
mock_issue = Mock()
mock_repo.get_issues.return_value = [mock_issue]
issues = get_open_issues(mock_repo)
self.assertEqual(issues, [mock_issue])


if __name__ == '__main__':
unittest.main()