From 7eb2e769cf82c259c33c30e0a158c9fade2302af Mon Sep 17 00:00:00 2001 From: Brian Pham Date: Tue, 12 Dec 2023 23:03:38 +0800 Subject: [PATCH] Move ai handlers to specific folder --- pr_agent/algo/{ => ai_handlers}/base_ai_handler.py | 0 pr_agent/algo/{ => ai_handlers}/litellm_ai_handler.py | 2 +- pr_agent/algo/{ => ai_handlers}/openai_ai_handler.py | 2 +- pr_agent/algo/utils.py | 6 +++--- pr_agent/tools/pr_add_docs.py | 2 +- pr_agent/tools/pr_code_suggestions.py | 2 +- pr_agent/tools/pr_description.py | 2 +- pr_agent/tools/pr_information_from_user.py | 2 +- pr_agent/tools/pr_questions.py | 2 +- pr_agent/tools/pr_reviewer.py | 2 +- pr_agent/tools/pr_update_changelog.py | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) rename pr_agent/algo/{ => ai_handlers}/base_ai_handler.py (100%) rename pr_agent/algo/{ => ai_handlers}/litellm_ai_handler.py (98%) rename pr_agent/algo/{ => ai_handlers}/openai_ai_handler.py (96%) diff --git a/pr_agent/algo/base_ai_handler.py b/pr_agent/algo/ai_handlers/base_ai_handler.py similarity index 100% rename from pr_agent/algo/base_ai_handler.py rename to pr_agent/algo/ai_handlers/base_ai_handler.py diff --git a/pr_agent/algo/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py similarity index 98% rename from pr_agent/algo/litellm_ai_handler.py rename to pr_agent/algo/ai_handlers/litellm_ai_handler.py index 7d88a00d..2e37a592 100644 --- a/pr_agent/algo/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -7,7 +7,7 @@ from openai.error import APIError, RateLimitError, Timeout, TryAgain from retry import retry from pr_agent.config_loader import get_settings from pr_agent.log import get_logger -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler OPENAI_RETRIES = 5 diff --git a/pr_agent/algo/openai_ai_handler.py b/pr_agent/algo/ai_handlers/openai_ai_handler.py similarity index 96% rename from pr_agent/algo/openai_ai_handler.py rename to pr_agent/algo/ai_handlers/openai_ai_handler.py index c521442d..3856f6f7 100644 --- a/pr_agent/algo/openai_ai_handler.py +++ b/pr_agent/algo/ai_handlers/openai_ai_handler.py @@ -1,4 +1,4 @@ -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler import openai from openai.error import APIError, RateLimitError, Timeout, TryAgain from retry import retry diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 14cde04a..824e4b70 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -8,9 +8,9 @@ from datetime import datetime from typing import Any, List import yaml -from pr_agent.algo.litellm_ai_handler import LiteLLMAiHandler -from pr_agent.algo.base_ai_handler import BaseAiHandler -from pr_agent.algo.openai_ai_handler import OpenAIHandler +from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.openai_ai_handler import OpenAIHandler from starlette_context import context from pr_agent.config_loader import get_settings, global_settings from pr_agent.log import get_logger diff --git a/pr_agent/tools/pr_add_docs.py b/pr_agent/tools/pr_add_docs.py index f76baa02..916f479f 100644 --- a/pr_agent/tools/pr_add_docs.py +++ b/pr_agent/tools/pr_add_docs.py @@ -4,7 +4,7 @@ from typing import Dict from jinja2 import Environment, StrictUndefined -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import load_yaml, get_ai_handler diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 96bd79fb..61a382a5 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -4,7 +4,7 @@ from typing import Dict, List from jinja2 import Environment, StrictUndefined -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, get_pr_multi_diffs, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import load_yaml, get_ai_handler diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 58de3b4e..c3db0cef 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -4,7 +4,7 @@ from typing import List, Tuple from jinja2 import Environment, StrictUndefined -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import load_yaml, get_ai_handler diff --git a/pr_agent/tools/pr_information_from_user.py b/pr_agent/tools/pr_information_from_user.py index 78903490..c4240723 100644 --- a/pr_agent/tools/pr_information_from_user.py +++ b/pr_agent/tools/pr_information_from_user.py @@ -2,7 +2,7 @@ import copy from jinja2 import Environment, StrictUndefined -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import get_ai_handler diff --git a/pr_agent/tools/pr_questions.py b/pr_agent/tools/pr_questions.py index 43c276cb..ecaf4d8d 100644 --- a/pr_agent/tools/pr_questions.py +++ b/pr_agent/tools/pr_questions.py @@ -2,7 +2,7 @@ import copy from jinja2 import Environment, StrictUndefined -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import get_ai_handler diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index d68b893e..138ad5ad 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -6,7 +6,7 @@ import yaml from jinja2 import Environment, StrictUndefined from yaml import SafeLoader -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import convert_to_markdown, get_ai_handler, load_yaml, try_fix_yaml diff --git a/pr_agent/tools/pr_update_changelog.py b/pr_agent/tools/pr_update_changelog.py index febe6fec..33ba941d 100644 --- a/pr_agent/tools/pr_update_changelog.py +++ b/pr_agent/tools/pr_update_changelog.py @@ -5,7 +5,7 @@ from typing import Tuple from jinja2 import Environment, StrictUndefined -from pr_agent.algo.base_ai_handler import BaseAiHandler +from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.algo.utils import get_ai_handler