diff --git a/chatgpt_tool_hub/apps/__init__.py b/chatgpt_tool_hub/apps/__init__.py index 6d910eb..6ba0faf 100644 --- a/chatgpt_tool_hub/apps/__init__.py +++ b/chatgpt_tool_hub/apps/__init__.py @@ -1,2 +1,7 @@ -from chatgpt_tool_hub.apps.app import App -from chatgpt_tool_hub.apps.app_factory import AppFactory +from .app import App +from .app_factory import AppFactory + +__all__ = [ + "App", + "AppFactory" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/apps/app.py b/chatgpt_tool_hub/apps/app.py index 3d347d4..a926271 100644 --- a/chatgpt_tool_hub/apps/app.py +++ b/chatgpt_tool_hub/apps/app.py @@ -2,9 +2,9 @@ from typing import List -from chatgpt_tool_hub.engine.tool_engine import ToolEngine -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools.base_tool import BaseTool +from ..engine.tool_engine import ToolEngine +from ..common.log import LOG +from ..tools.base_tool import BaseTool class App: diff --git a/chatgpt_tool_hub/apps/app_factory.py b/chatgpt_tool_hub/apps/app_factory.py index 20d1162..12ca395 100644 --- a/chatgpt_tool_hub/apps/app_factory.py +++ b/chatgpt_tool_hub/apps/app_factory.py @@ -2,12 +2,12 @@ from rich.console import Console -from chatgpt_tool_hub.apps import App -from chatgpt_tool_hub.common.constants import TRUE_VALUES_SET -from chatgpt_tool_hub.common.log import refresh -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.tools import dynamic_tool_loader +from . import App +from ..common.constants import TRUE_VALUES_SET +from ..common.log import refresh +from ..common.utils import get_from_dict_or_env +from ..models import build_model_params +from ..tools import dynamic_tool_loader class AppFactory: @@ -55,13 +55,13 @@ def create_app(self, app_type: str = 'victorinox', tools_list: list = None, cons self.init_env(**kwargs) if app_type == 'lite': - from chatgpt_tool_hub.apps.lite_app import LiteApp + from ..apps.lite_app import LiteApp app = LiteApp(**build_model_params(kwargs)) app.create(tools_list, **kwargs) return app elif app_type == 'victorinox': - from chatgpt_tool_hub.apps.victorinox import Victorinox + from ..apps.victorinox import Victorinox for default_tool in self.default_tools_list: if default_tool not in tools_list: diff --git a/chatgpt_tool_hub/apps/lite_app.py b/chatgpt_tool_hub/apps/lite_app.py index f24b4b1..0ebc927 100644 --- a/chatgpt_tool_hub/apps/lite_app.py +++ b/chatgpt_tool_hub/apps/lite_app.py @@ -1,9 +1,9 @@ -from chatgpt_tool_hub.apps import App -from chatgpt_tool_hub.apps import AppFactory -from chatgpt_tool_hub.chains import LLMChain -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.prompts import PromptTemplate +from ..apps import App +from ..apps import AppFactory +from ..chains import LLMChain +from ..common.log import LOG +from ..models.model_factory import ModelFactory +from ..prompts import PromptTemplate class LiteApp(App): diff --git a/chatgpt_tool_hub/apps/victorinox.py b/chatgpt_tool_hub/apps/victorinox.py index e2910dc..b826e5c 100644 --- a/chatgpt_tool_hub/apps/victorinox.py +++ b/chatgpt_tool_hub/apps/victorinox.py @@ -2,17 +2,17 @@ from rich.console import Console -from chatgpt_tool_hub.apps import App -from chatgpt_tool_hub.apps import AppFactory -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.database import ConversationTokenBufferMemory -from chatgpt_tool_hub.engine.initialize import init_tool_engine as init_engine -from chatgpt_tool_hub.models import MEMORY_MAX_TOKENS_NUM -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.load_tools import load_tools +from ..apps import App +from ..apps import AppFactory +from ..common.log import LOG +from ..common.utils import get_from_dict_or_env +from ..database import ConversationTokenBufferMemory +from ..engine.initialize import init_tool_engine as init_engine +from ..models import MEMORY_MAX_TOKENS_NUM +from ..models.model_factory import ModelFactory +from ..tools.all_tool_list import main_tool_register +from ..tools.base_tool import BaseTool +from ..tools.load_tools import load_tools class Victorinox(App): diff --git a/chatgpt_tool_hub/bots/__init__.py b/chatgpt_tool_hub/bots/__init__.py index c033eab..b6b4b96 100644 --- a/chatgpt_tool_hub/bots/__init__.py +++ b/chatgpt_tool_hub/bots/__init__.py @@ -1,5 +1,5 @@ -from chatgpt_tool_hub.bots.chat_bot.base import ChatBot -from chatgpt_tool_hub.bots.qa_bot.base import QABot +from .chat_bot.base import ChatBot +from .qa_bot.base import QABot __all__ = [ "ChatBot", diff --git a/chatgpt_tool_hub/bots/all_bot_list.py b/chatgpt_tool_hub/bots/all_bot_list.py index ad6dc8e..393ff7a 100644 --- a/chatgpt_tool_hub/bots/all_bot_list.py +++ b/chatgpt_tool_hub/bots/all_bot_list.py @@ -1,7 +1,6 @@ """Functionality for loading bots.""" -from chatgpt_tool_hub.bots import ChatBot -from chatgpt_tool_hub.bots import QABot +from . import ChatBot, QABot BOT_TO_CLASS = { diff --git a/chatgpt_tool_hub/bots/chat_bot/base.py b/chatgpt_tool_hub/bots/chat_bot/base.py index c6331c7..0e2f4a7 100644 --- a/chatgpt_tool_hub/bots/chat_bot/base.py +++ b/chatgpt_tool_hub/bots/chat_bot/base.py @@ -7,16 +7,17 @@ from rich.console import Console from rich.panel import Panel -from chatgpt_tool_hub.bots.chat_bot.prompt import FORMAT_INSTRUCTIONS, PREFIX, SUFFIX -from chatgpt_tool_hub.chains import LLMChain -from chatgpt_tool_hub.common import json_utils -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.schema import BotAction, BotFinish -from chatgpt_tool_hub.engine import Bot -from chatgpt_tool_hub.models.base import BaseLLM -from chatgpt_tool_hub.prompts import PromptTemplate -from chatgpt_tool_hub.tools.base_tool import BaseTool + +from .prompt import FORMAT_INSTRUCTIONS, PREFIX, SUFFIX +from ...chains import LLMChain +from ...common import json_utils +from ...common.callbacks import BaseCallbackManager +from ...common.log import LOG +from ...common.schema import BotAction, BotFinish +from ...engine import Bot +from ...models.base import BaseLLM +from ...prompts import PromptTemplate +from ...tools.base_tool import BaseTool default_ai_prefix = "LLM-OS" default_human_prefix = "user" diff --git a/chatgpt_tool_hub/bots/qa_bot/base.py b/chatgpt_tool_hub/bots/qa_bot/base.py index cd60664..3fc2ef2 100644 --- a/chatgpt_tool_hub/bots/qa_bot/base.py +++ b/chatgpt_tool_hub/bots/qa_bot/base.py @@ -5,14 +5,14 @@ from rich.console import Console -from chatgpt_tool_hub.bots.qa_bot.prompt import FORMAT_INSTRUCTIONS, PREFIX, SUFFIX -from chatgpt_tool_hub.chains import LLMChain -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.engine import Bot -from chatgpt_tool_hub.models.base import BaseLLM -from chatgpt_tool_hub.prompts import PromptTemplate -from chatgpt_tool_hub.tools.base_tool import BaseTool +from .prompt import FORMAT_INSTRUCTIONS, PREFIX, SUFFIX +from ...chains import LLMChain +from ...common.callbacks import BaseCallbackManager +from ...common.log import LOG +from ...engine import Bot +from ...models.base import BaseLLM +from ...prompts import PromptTemplate +from ...tools.base_tool import BaseTool FINAL_ANSWER_ACTION = "Final Answer:" diff --git a/chatgpt_tool_hub/chains/__init__.py b/chatgpt_tool_hub/chains/__init__.py index 9633641..34a00f6 100644 --- a/chatgpt_tool_hub/chains/__init__.py +++ b/chatgpt_tool_hub/chains/__init__.py @@ -1,7 +1,9 @@ """Chains are easily reusable components which can be linked together.""" -from chatgpt_tool_hub.chains.llm import LLMChain +from .llm import LLMChain +from .base import Chain __all__ = [ - "LLMChain", + "Chain", + "LLMChain" ] diff --git a/chatgpt_tool_hub/chains/api/__init__.py b/chatgpt_tool_hub/chains/api/__init__.py index 1bfaa6b..167e814 100644 --- a/chatgpt_tool_hub/chains/api/__init__.py +++ b/chatgpt_tool_hub/chains/api/__init__.py @@ -1,2 +1,6 @@ """Chain that makes API calls and summarizes the responses to answer a question.""" -from chatgpt_tool_hub.chains.api.base import APIChain +from .base import APIChain + +__all__ = [ + "APIChain" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/chains/api/base.py b/chatgpt_tool_hub/chains/api/base.py index 6ac4a3b..7afe10b 100644 --- a/chatgpt_tool_hub/chains/api/base.py +++ b/chatgpt_tool_hub/chains/api/base.py @@ -7,13 +7,13 @@ from rich.console import Console from rich.panel import Panel -from chatgpt_tool_hub.chains.api.prompt import API_RESPONSE_PROMPT, API_URL_PROMPT -from chatgpt_tool_hub.chains.base import Chain -from chatgpt_tool_hub.chains.llm import LLMChain -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.schema import BaseLanguageModel -from chatgpt_tool_hub.prompts import BasePromptTemplate -from chatgpt_tool_hub.tools.web_requests import RequestsWrapper +from .prompt import API_RESPONSE_PROMPT, API_URL_PROMPT +from .. import Chain, LLMChain + +from ...common.log import LOG +from ...common.schema import BaseLanguageModel +from ...prompts import BasePromptTemplate +from ...tools.web_requests import RequestsWrapper class APIChain(Chain, BaseModel): diff --git a/chatgpt_tool_hub/chains/api/prompt.py b/chatgpt_tool_hub/chains/api/prompt.py index 321a015..feb11ba 100644 --- a/chatgpt_tool_hub/chains/api/prompt.py +++ b/chatgpt_tool_hub/chains/api/prompt.py @@ -1,5 +1,5 @@ -from chatgpt_tool_hub.prompts.prompt import PromptTemplate +from ...prompts.prompt import PromptTemplate API_URL_PROMPT_TEMPLATE = """你收到一个的调用API文档: {api_docs} 你的任务是使用这个文档,生成完整的API URL以回答用户的问题 diff --git a/chatgpt_tool_hub/chains/base.py b/chatgpt_tool_hub/chains/base.py index 0583f15..7822ac9 100644 --- a/chatgpt_tool_hub/chains/base.py +++ b/chatgpt_tool_hub/chains/base.py @@ -8,9 +8,9 @@ from pydantic import BaseModel, Field, validator from rich.console import Console -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.callbacks import get_callback_manager -from chatgpt_tool_hub.common.schema import BaseMemory +from ..common.callbacks import BaseCallbackManager +from ..common.callbacks import get_callback_manager +from ..common.schema import BaseMemory def _get_verbosity() -> bool: diff --git a/chatgpt_tool_hub/chains/llm.py b/chatgpt_tool_hub/chains/llm.py index b0d7f8b..17c833d 100644 --- a/chatgpt_tool_hub/chains/llm.py +++ b/chatgpt_tool_hub/chains/llm.py @@ -5,11 +5,11 @@ from pydantic import BaseModel, Extra -from chatgpt_tool_hub.chains.base import Chain -from chatgpt_tool_hub.common.input import get_colored_text -from chatgpt_tool_hub.common.schema import BaseLanguageModel, LLMResult, PromptValue -from chatgpt_tool_hub.prompts.base import BasePromptTemplate -from chatgpt_tool_hub.prompts.prompt import PromptTemplate +from ..common.input import get_colored_text +from ..common.schema import BaseLanguageModel, LLMResult, PromptValue +from ..prompts.base import BasePromptTemplate +from ..prompts.prompt import PromptTemplate +from .base import Chain class LLMChain(Chain, BaseModel): diff --git a/chatgpt_tool_hub/common/cache.py b/chatgpt_tool_hub/common/cache.py index 1734af0..c905f84 100644 --- a/chatgpt_tool_hub/common/cache.py +++ b/chatgpt_tool_hub/common/cache.py @@ -11,7 +11,7 @@ except ImportError: from sqlalchemy.ext.declarative import declarative_base -from chatgpt_tool_hub.common.schema import Generation +from .schema import Generation RETURN_VAL_TYPE = List[Generation] diff --git a/chatgpt_tool_hub/common/calculate_token.py b/chatgpt_tool_hub/common/calculate_token.py index 132b9dd..4c04c10 100644 --- a/chatgpt_tool_hub/common/calculate_token.py +++ b/chatgpt_tool_hub/common/calculate_token.py @@ -1,4 +1,4 @@ -from chatgpt_tool_hub.common.log import LOG +from .log import LOG # refer to https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb diff --git a/chatgpt_tool_hub/common/callbacks.py b/chatgpt_tool_hub/common/callbacks.py index cc898d6..64b6714 100644 --- a/chatgpt_tool_hub/common/callbacks.py +++ b/chatgpt_tool_hub/common/callbacks.py @@ -4,8 +4,8 @@ from abc import ABC, abstractmethod from typing import Any, Dict, List, Union -from chatgpt_tool_hub.common.schema import BotAction, BotFinish, LLMResult -from chatgpt_tool_hub.common.singleton import Singleton +from .schema import BotAction, BotFinish, LLMResult +from .singleton import Singleton class BaseCallbackHandler(ABC): diff --git a/chatgpt_tool_hub/common/json_utils.py b/chatgpt_tool_hub/common/json_utils.py index 4c98c4e..71fcb38 100644 --- a/chatgpt_tool_hub/common/json_utils.py +++ b/chatgpt_tool_hub/common/json_utils.py @@ -2,7 +2,7 @@ import re from typing import Any, Dict, Optional, Union -from chatgpt_tool_hub.common.log import LOG +from .log import LOG def fix_and_parse_json( diff --git a/chatgpt_tool_hub/common/log.py b/chatgpt_tool_hub/common/log.py index b456e14..fee96ca 100644 --- a/chatgpt_tool_hub/common/log.py +++ b/chatgpt_tool_hub/common/log.py @@ -1,7 +1,7 @@ import os import sys import logging -from chatgpt_tool_hub.common.constants import LOGGING_LEVEL, LOGGING_FMT, LOGGING_DATEFMT +from .constants import LOGGING_LEVEL, LOGGING_FMT, LOGGING_DATEFMT def _get_logger(level: int = LOGGING_LEVEL): diff --git a/chatgpt_tool_hub/common/text_splitter.py b/chatgpt_tool_hub/common/text_splitter.py index 95fb25f..b8b1b8a 100644 --- a/chatgpt_tool_hub/common/text_splitter.py +++ b/chatgpt_tool_hub/common/text_splitter.py @@ -15,8 +15,8 @@ Union, ) -from chatgpt_tool_hub.common.document import Document -from chatgpt_tool_hub.common.log import LOG +from .document import Document +from .log import LOG class TextSplitter(ABC): """Interface for splitting text into chunks.""" diff --git a/chatgpt_tool_hub/database/__init__.py b/chatgpt_tool_hub/database/__init__.py index 68261dd..0e4f74c 100644 --- a/chatgpt_tool_hub/database/__init__.py +++ b/chatgpt_tool_hub/database/__init__.py @@ -1,4 +1,4 @@ -from chatgpt_tool_hub.database.token_buffer import ConversationTokenBufferMemory +from .token_buffer import ConversationTokenBufferMemory __all__ = [ "ConversationTokenBufferMemory", diff --git a/chatgpt_tool_hub/database/chat_memory.py b/chatgpt_tool_hub/database/chat_memory.py index a3ece05..676eee9 100644 --- a/chatgpt_tool_hub/database/chat_memory.py +++ b/chatgpt_tool_hub/database/chat_memory.py @@ -1,10 +1,10 @@ from abc import ABC from typing import Any, Dict, List, Optional -from chatgpt_tool_hub.database.utils import get_prompt_input_key +from .utils import get_prompt_input_key from pydantic import BaseModel, Field -from chatgpt_tool_hub.common.schema import AIMessage, BaseMemory, BaseMessage, HumanMessage +from ..common.schema import AIMessage, BaseMemory, BaseMessage, HumanMessage class ChatMessageHistory(BaseModel): diff --git a/chatgpt_tool_hub/database/token_buffer.py b/chatgpt_tool_hub/database/token_buffer.py index 7e0e15a..697dff0 100644 --- a/chatgpt_tool_hub/database/token_buffer.py +++ b/chatgpt_tool_hub/database/token_buffer.py @@ -2,9 +2,9 @@ from pydantic import BaseModel -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.schema import BaseLanguageModel, BaseMessage, get_buffer_string -from chatgpt_tool_hub.database.chat_memory import BaseChatMemory +from ..common.log import LOG +from ..common.schema import BaseLanguageModel, BaseMessage, get_buffer_string +from .chat_memory import BaseChatMemory class ConversationTokenBufferMemory(BaseChatMemory, BaseModel): diff --git a/chatgpt_tool_hub/database/utils.py b/chatgpt_tool_hub/database/utils.py index 76466a7..f08a2d0 100644 --- a/chatgpt_tool_hub/database/utils.py +++ b/chatgpt_tool_hub/database/utils.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List -from chatgpt_tool_hub.common.schema import get_buffer_string # noqa: 401 +from ..common.schema import get_buffer_string # noqa: 401 def get_prompt_input_key(inputs: Dict[str, Any], memory_variables: List[str]) -> str: diff --git a/chatgpt_tool_hub/engine/__init__.py b/chatgpt_tool_hub/engine/__init__.py index 9353a7d..e13ea16 100644 --- a/chatgpt_tool_hub/engine/__init__.py +++ b/chatgpt_tool_hub/engine/__init__.py @@ -1,2 +1,8 @@ -from chatgpt_tool_hub.engine.bot import Bot -from chatgpt_tool_hub.engine.tool_engine import ToolEngine +from .bot import Bot +from .tool_engine import ToolEngine + + +__all__ = [ + "Bot", + "ToolEngine" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/engine/bot.py b/chatgpt_tool_hub/engine/bot.py index 84d60c6..b355118 100644 --- a/chatgpt_tool_hub/engine/bot.py +++ b/chatgpt_tool_hub/engine/bot.py @@ -12,17 +12,17 @@ from pydantic import BaseModel, root_validator, validator from rich.console import Console -from chatgpt_tool_hub.chains import LLMChain -from chatgpt_tool_hub.common.calculate_token import count_string_tokens -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.schema import BotAction, BotFinish, BaseMessage -from chatgpt_tool_hub.models import ALL_MAX_TOKENS_NUM, BOT_SCRATCHPAD_MAX_TOKENS_NUM -from chatgpt_tool_hub.models.base import BaseLLM -from chatgpt_tool_hub.prompts import BasePromptTemplate -from chatgpt_tool_hub.prompts import PromptTemplate -from chatgpt_tool_hub.tools import SummaryTool -from chatgpt_tool_hub.tools.base_tool import BaseTool +from ..chains import LLMChain +from ..common.calculate_token import count_string_tokens +from ..common.callbacks import BaseCallbackManager +from ..common.log import LOG +from ..common.schema import BotAction, BotFinish, BaseMessage +from ..models import ALL_MAX_TOKENS_NUM, BOT_SCRATCHPAD_MAX_TOKENS_NUM +from ..models.base import BaseLLM +from ..prompts import BasePromptTemplate +from ..prompts import PromptTemplate +from ..tools import SummaryTool +from ..tools.base_tool import BaseTool class Bot(BaseModel): diff --git a/chatgpt_tool_hub/engine/initialize.py b/chatgpt_tool_hub/engine/initialize.py index 22b0594..602edb8 100644 --- a/chatgpt_tool_hub/engine/initialize.py +++ b/chatgpt_tool_hub/engine/initialize.py @@ -3,12 +3,12 @@ from rich.console import Console -from chatgpt_tool_hub.bots.all_bot_list import BOT_TO_CLASS -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.callbacks import get_callback_manager -from chatgpt_tool_hub.engine import ToolEngine -from chatgpt_tool_hub.models.base import BaseLanguageModel -from chatgpt_tool_hub.tools.base_tool import BaseTool +from . import ToolEngine +from ..bots.all_bot_list import BOT_TO_CLASS +from ..common.callbacks import BaseCallbackManager +from ..common.callbacks import get_callback_manager +from ..models.base import BaseLanguageModel +from ..tools.base_tool import BaseTool def init_tool_engine( diff --git a/chatgpt_tool_hub/engine/tool_engine.py b/chatgpt_tool_hub/engine/tool_engine.py index 764b5a6..22254a9 100644 --- a/chatgpt_tool_hub/engine/tool_engine.py +++ b/chatgpt_tool_hub/engine/tool_engine.py @@ -5,14 +5,14 @@ from rich.console import Console from rich.panel import Panel -from chatgpt_tool_hub.chains.base import Chain -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.input import get_color_mapping -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.schema import BotAction, BotFinish -from chatgpt_tool_hub.engine import Bot -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.tool import InvalidTool +from . import Bot +from ..chains.base import Chain +from ..common.callbacks import BaseCallbackManager +from ..common.input import get_color_mapping +from ..common.log import LOG +from ..common.schema import BotAction, BotFinish +from ..tools.base_tool import BaseTool +from ..tools.tool import InvalidTool class ToolEngine(Chain, BaseModel): diff --git a/chatgpt_tool_hub/models/__init__.py b/chatgpt_tool_hub/models/__init__.py index 56cf7af..454e648 100644 --- a/chatgpt_tool_hub/models/__init__.py +++ b/chatgpt_tool_hub/models/__init__.py @@ -1,9 +1,9 @@ import os from typing import Optional -from chatgpt_tool_hub.common.cache import BaseCache -from chatgpt_tool_hub.common.constants import openai_default_api_base -from chatgpt_tool_hub.common.utils import get_from_dict_or_env +from ..common.cache import BaseCache +from ..common.constants import openai_default_api_base +from ..common.utils import get_from_dict_or_env verbose: bool = False llm_cache: Optional[BaseCache] = None @@ -62,8 +62,8 @@ def build_model_params(kwargs: dict) -> dict: return model_params_dict -from chatgpt_tool_hub.models.base import BaseLLM, LLM -from chatgpt_tool_hub.models.chatgpt.chatgpt import ChatOpenAI +from .base import BaseLLM, LLM +from .chatgpt.chatgpt import ChatOpenAI __all__ = [ diff --git a/chatgpt_tool_hub/models/base.py b/chatgpt_tool_hub/models/base.py index 5eee1b5..784ab9c 100644 --- a/chatgpt_tool_hub/models/base.py +++ b/chatgpt_tool_hub/models/base.py @@ -7,10 +7,10 @@ import yaml from pydantic import BaseModel, Extra, Field, validator -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.callbacks import get_callback_manager -from chatgpt_tool_hub.common.schema import BaseLanguageModel, Generation, LLMResult, PromptValue -from chatgpt_tool_hub.models import llm_cache +from ..common.callbacks import BaseCallbackManager +from ..common.callbacks import get_callback_manager +from ..common.schema import BaseLanguageModel, Generation, LLMResult, PromptValue +from . import llm_cache def _get_verbosity() -> bool: diff --git a/chatgpt_tool_hub/models/chatgpt/__init__.py b/chatgpt_tool_hub/models/chatgpt/__init__.py index 73f5056..4bb1cf8 100644 --- a/chatgpt_tool_hub/models/chatgpt/__init__.py +++ b/chatgpt_tool_hub/models/chatgpt/__init__.py @@ -1,3 +1,7 @@ -from chatgpt_tool_hub.models.chatgpt.chatgpt import ChatOpenAI +from .base import BaseChatModel +from .chatgpt import ChatOpenAI -__all__ = ["ChatOpenAI"] +__all__ = [ + "BaseChatModel", + "ChatOpenAI" +] diff --git a/chatgpt_tool_hub/models/chatgpt/base.py b/chatgpt_tool_hub/models/chatgpt/base.py index 274e338..b9a5343 100644 --- a/chatgpt_tool_hub/models/chatgpt/base.py +++ b/chatgpt_tool_hub/models/chatgpt/base.py @@ -3,9 +3,9 @@ from pydantic import BaseModel, Extra, Field, validator -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.callbacks import get_callback_manager -from chatgpt_tool_hub.common.schema import ( +from ...common.callbacks import BaseCallbackManager +from ...common.callbacks import get_callback_manager +from ...common.schema import ( AIMessage, BaseLanguageModel, BaseMessage, diff --git a/chatgpt_tool_hub/models/chatgpt/chatgpt.py b/chatgpt_tool_hub/models/chatgpt/chatgpt.py index 0f2ad86..275a60a 100644 --- a/chatgpt_tool_hub/models/chatgpt/chatgpt.py +++ b/chatgpt_tool_hub/models/chatgpt/chatgpt.py @@ -14,9 +14,10 @@ wait_exponential, ) -from chatgpt_tool_hub.common.constants import openai_default_api_base -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.schema import ( +from . import BaseChatModel +from ...common.constants import openai_default_api_base +from ...common.log import LOG +from ...common.schema import ( AIMessage, BaseMessage, ChatGeneration, @@ -25,8 +26,7 @@ HumanMessage, SystemMessage, ) -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models.chatgpt.base import BaseChatModel +from ...common.utils import get_from_dict_or_env def _create_retry_decorator(llm: ChatOpenAI) -> Callable[[Any], Any]: diff --git a/chatgpt_tool_hub/models/model_factory.py b/chatgpt_tool_hub/models/model_factory.py index 04069bc..d589cb7 100644 --- a/chatgpt_tool_hub/models/model_factory.py +++ b/chatgpt_tool_hub/models/model_factory.py @@ -1,5 +1,5 @@ -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models import ChatOpenAI +from ..common.utils import get_from_dict_or_env +from . import ChatOpenAI class ModelFactory: diff --git a/chatgpt_tool_hub/prompts/__init__.py b/chatgpt_tool_hub/prompts/__init__.py index 3610805..16d164d 100644 --- a/chatgpt_tool_hub/prompts/__init__.py +++ b/chatgpt_tool_hub/prompts/__init__.py @@ -1,9 +1,9 @@ """Prompt template classes.""" -from chatgpt_tool_hub.prompts.base import BasePromptTemplate, StringPromptTemplate -from chatgpt_tool_hub.prompts.chat import (ChatPromptTemplate, MessagesPlaceholder, HumanMessagePromptTemplate, +from .base import BasePromptTemplate, StringPromptTemplate +from .prompt import Prompt, PromptTemplate +from .chat import (ChatPromptTemplate, MessagesPlaceholder, HumanMessagePromptTemplate, AIMessagePromptTemplate, SystemMessagePromptTemplate, ChatMessagePromptTemplate) -from chatgpt_tool_hub.prompts.prompt import Prompt, PromptTemplate __all__ = [ "BasePromptTemplate", diff --git a/chatgpt_tool_hub/prompts/base.py b/chatgpt_tool_hub/prompts/base.py index 1b547a2..4ca0234 100644 --- a/chatgpt_tool_hub/prompts/base.py +++ b/chatgpt_tool_hub/prompts/base.py @@ -9,8 +9,8 @@ import yaml from pydantic import BaseModel, Extra, Field, root_validator -from chatgpt_tool_hub.common.formatting import formatter -from chatgpt_tool_hub.common.schema import BaseMessage, BaseOutputParser, HumanMessage, PromptValue +from ..common.formatting import formatter +from ..common.schema import BaseMessage, BaseOutputParser, HumanMessage, PromptValue def jinja2_formatter(template: str, **kwargs: Any) -> str: diff --git a/chatgpt_tool_hub/prompts/chat.py b/chatgpt_tool_hub/prompts/chat.py index 24ff97f..68dd0ef 100644 --- a/chatgpt_tool_hub/prompts/chat.py +++ b/chatgpt_tool_hub/prompts/chat.py @@ -7,7 +7,7 @@ from pydantic import BaseModel, Field -from chatgpt_tool_hub.common.schema import ( +from ..common.schema import ( AIMessage, BaseMessage, ChatMessage, @@ -15,9 +15,8 @@ PromptValue, SystemMessage, ) -from chatgpt_tool_hub.common.schema import get_buffer_string -from chatgpt_tool_hub.prompts.base import BasePromptTemplate, StringPromptTemplate -from chatgpt_tool_hub.prompts.prompt import PromptTemplate +from ..common.schema import get_buffer_string +from . import BasePromptTemplate, StringPromptTemplate, PromptTemplate class BaseMessagePromptTemplate(BaseModel, ABC): diff --git a/chatgpt_tool_hub/prompts/prompt.py b/chatgpt_tool_hub/prompts/prompt.py index e810c51..8c50bc6 100644 --- a/chatgpt_tool_hub/prompts/prompt.py +++ b/chatgpt_tool_hub/prompts/prompt.py @@ -7,7 +7,7 @@ from pydantic import BaseModel, Extra, root_validator -from chatgpt_tool_hub.prompts.base import ( +from .base import ( DEFAULT_FORMATTER_MAPPING, StringPromptTemplate, check_valid_template, diff --git a/chatgpt_tool_hub/tools/__init__.py b/chatgpt_tool_hub/tools/__init__.py index 5be9b1e..872df25 100644 --- a/chatgpt_tool_hub/tools/__init__.py +++ b/chatgpt_tool_hub/tools/__init__.py @@ -1,6 +1,6 @@ import os -from chatgpt_tool_hub.common.log import LOG +from ..common.log import LOG def get_packages(path): @@ -24,22 +24,26 @@ def dynamic_tool_loader(): for package_name in all_tool_package_list: try: import importlib - importlib.import_module(f"chatgpt_tool_hub.tools.{package_name}") + importlib.import_module(f"..tools.{package_name}") except Exception as e: LOG.info(f"[{package_name}] init failed, error_info: {repr(e)}") - -from chatgpt_tool_hub.tools.python import PythonREPLTool -from chatgpt_tool_hub.tools.summary import SummaryTool -from chatgpt_tool_hub.tools.terminal import TerminalTool -from chatgpt_tool_hub.tools.web_requests import BrowserTool - +from .base_tool import BaseTool +from .python import PythonREPLTool +from .summary import SummaryTool +from .terminal import TerminalTool +from .web_requests import BrowserTool +from .tool_register import ToolRegister __all__ = [ + "BaseTool", "SummaryTool", "PythonREPLTool", "TerminalTool", "BrowserTool", + + "ToolRegister", + "get_packages", - "dynamic_tool_loader" + "dynamic_tool_loader", ] diff --git a/chatgpt_tool_hub/tools/all_tool_list.py b/chatgpt_tool_hub/tools/all_tool_list.py index 83e1620..7d172a4 100644 --- a/chatgpt_tool_hub/tools/all_tool_list.py +++ b/chatgpt_tool_hub/tools/all_tool_list.py @@ -1,6 +1,6 @@ from typing import List -from chatgpt_tool_hub.tools.tool_register import ToolRegister +from .tool_register import ToolRegister main_tool_register = ToolRegister() diff --git a/chatgpt_tool_hub/tools/arxiv_search/__init__.py b/chatgpt_tool_hub/tools/arxiv_search/__init__.py index e043382..ac52315 100644 --- a/chatgpt_tool_hub/tools/arxiv_search/__init__.py +++ b/chatgpt_tool_hub/tools/arxiv_search/__init__.py @@ -1 +1,6 @@ -from chatgpt_tool_hub.tools.arxiv_search.tool import ArxivTool +from .tool import ArxivTool + + +__all__ = [ + "ArxivTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/arxiv_search/tool.py b/chatgpt_tool_hub/tools/arxiv_search/tool.py index 935b33f..522db8b 100644 --- a/chatgpt_tool_hub/tools/arxiv_search/tool.py +++ b/chatgpt_tool_hub/tools/arxiv_search/tool.py @@ -4,17 +4,17 @@ from rich.console import Console -from chatgpt_tool_hub.chains import LLMChain -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.prompts import PromptTemplate -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.arxiv_search.api_prompt import ARXIV_PROMPT -from chatgpt_tool_hub.tools.arxiv_search.wrapper import ArxivAPIWrapper -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.summary import SummaryTool +from ...chains import LLMChain +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from ...models import build_model_params +from ...models.model_factory import ModelFactory +from ...prompts import PromptTemplate +from ..all_tool_list import main_tool_register +from .api_prompt import ARXIV_PROMPT +from .wrapper import ArxivAPIWrapper +from .. import BaseTool +from ..summary import SummaryTool default_tool_name = "arxiv" diff --git a/chatgpt_tool_hub/tools/base_tool.py b/chatgpt_tool_hub/tools/base_tool.py index 2d1874e..8c84db6 100644 --- a/chatgpt_tool_hub/tools/base_tool.py +++ b/chatgpt_tool_hub/tools/base_tool.py @@ -5,8 +5,8 @@ from pydantic import BaseModel, Extra, Field, validator from rich.console import Console -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.callbacks import get_callback_manager +from ..common.callbacks import BaseCallbackManager +from ..common.callbacks import get_callback_manager class BaseTool(BaseModel): diff --git a/chatgpt_tool_hub/tools/bing_search/__init__.py b/chatgpt_tool_hub/tools/bing_search/__init__.py index 205d0ac..3b5946b 100644 --- a/chatgpt_tool_hub/tools/bing_search/__init__.py +++ b/chatgpt_tool_hub/tools/bing_search/__init__.py @@ -1,3 +1,7 @@ -from chatgpt_tool_hub.tools.bing_search.wrapper import BingSearchAPIWrapper -from chatgpt_tool_hub.tools.bing_search.tool import BingSearch +from .wrapper import BingSearchAPIWrapper +from .tool import BingSearch +__all__ = [ + "BingSearchAPIWrapper", + "BingSearch" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/bing_search/tool.py b/chatgpt_tool_hub/tools/bing_search/tool.py index 1a38572..888a783 100644 --- a/chatgpt_tool_hub/tools/bing_search/tool.py +++ b/chatgpt_tool_hub/tools/bing_search/tool.py @@ -3,9 +3,9 @@ from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.bing_search import BingSearchAPIWrapper +from ..all_tool_list import main_tool_register +from .. import BaseTool +from . import BingSearchAPIWrapper default_tool_name = "bing-search" diff --git a/chatgpt_tool_hub/tools/bing_search/wrapper.py b/chatgpt_tool_hub/tools/bing_search/wrapper.py index 2b84514..125a8f3 100644 --- a/chatgpt_tool_hub/tools/bing_search/wrapper.py +++ b/chatgpt_tool_hub/tools/bing_search/wrapper.py @@ -4,10 +4,10 @@ from pydantic import BaseModel, Extra, validator, root_validator -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.tools.web_requests import filter_text -from chatgpt_tool_hub.tools.web_requests.wrapper import RequestsWrapper +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from ..web_requests import filter_text +from ..web_requests.wrapper import RequestsWrapper class BingSearchAPIWrapper(BaseModel): diff --git a/chatgpt_tool_hub/tools/google_search/__init__.py b/chatgpt_tool_hub/tools/google_search/__init__.py index b714eef..957b8d5 100644 --- a/chatgpt_tool_hub/tools/google_search/__init__.py +++ b/chatgpt_tool_hub/tools/google_search/__init__.py @@ -1,2 +1,9 @@ -from chatgpt_tool_hub.tools.google_search.tool import GoogleSearch, GoogleSearchJson -from chatgpt_tool_hub.tools.google_search.wrapper import GoogleSearchAPIWrapper +from .tool import GoogleSearch, GoogleSearchJson +from .wrapper import GoogleSearchAPIWrapper + + +__all__ = [ + "GoogleSearch", + "GoogleSearchJson", + "GoogleSearchAPIWrapper" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/google_search/tool.py b/chatgpt_tool_hub/tools/google_search/tool.py index d41e2c7..6a6c360 100644 --- a/chatgpt_tool_hub/tools/google_search/tool.py +++ b/chatgpt_tool_hub/tools/google_search/tool.py @@ -3,9 +3,9 @@ from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.google_search.wrapper import GoogleSearchAPIWrapper +from .. import BaseTool +from ..all_tool_list import main_tool_register +from . import GoogleSearchAPIWrapper default_tool_name = "google-search" diff --git a/chatgpt_tool_hub/tools/google_search/wrapper.py b/chatgpt_tool_hub/tools/google_search/wrapper.py index 96bc586..43f181e 100644 --- a/chatgpt_tool_hub/tools/google_search/wrapper.py +++ b/chatgpt_tool_hub/tools/google_search/wrapper.py @@ -3,9 +3,9 @@ from pydantic import BaseModel, Extra, root_validator -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.tools.web_requests import filter_text +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from ..web_requests import filter_text class GoogleSearchAPIWrapper(BaseModel): diff --git a/chatgpt_tool_hub/tools/hello_tool/__init__.py b/chatgpt_tool_hub/tools/hello_tool/__init__.py index 9592a0a..e0f1446 100644 --- a/chatgpt_tool_hub/tools/hello_tool/__init__.py +++ b/chatgpt_tool_hub/tools/hello_tool/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.hello_tool.tool import HelloTool \ No newline at end of file +from .tool import HelloTool + +__all__ = [ + "HelloTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/hello_tool/tool.py b/chatgpt_tool_hub/tools/hello_tool/tool.py index 9a0493c..11cccc8 100644 --- a/chatgpt_tool_hub/tools/hello_tool/tool.py +++ b/chatgpt_tool_hub/tools/hello_tool/tool.py @@ -2,7 +2,7 @@ from rich.console import Console -from chatgpt_tool_hub.tools.base_tool import BaseTool +from .. import BaseTool default_tool_name = "hello-tool" @@ -30,7 +30,7 @@ async def _arun(self, query: str) -> str: raise NotImplementedError("HelloTool does not support async") -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register +from ..all_tool_list import main_tool_register main_tool_register.register_tool(default_tool_name, lambda console, kwargs: HelloTool(console, **kwargs), tool_input_keys=[]) diff --git a/chatgpt_tool_hub/tools/load_tools.py b/chatgpt_tool_hub/tools/load_tools.py index 5a221d6..3a970f4 100644 --- a/chatgpt_tool_hub/tools/load_tools.py +++ b/chatgpt_tool_hub/tools/load_tools.py @@ -2,10 +2,9 @@ from typing import Any, List from typing import Optional -from chatgpt_tool_hub.common.callbacks import BaseCallbackManager -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.tool_register import ToolRegister +from ..common.callbacks import BaseCallbackManager +from ..common.log import LOG +from . import BaseTool, ToolRegister from rich.console import Console diff --git a/chatgpt_tool_hub/tools/meteo/__init__.py b/chatgpt_tool_hub/tools/meteo/__init__.py index f597c85..4a63079 100644 --- a/chatgpt_tool_hub/tools/meteo/__init__.py +++ b/chatgpt_tool_hub/tools/meteo/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.meteo.tool import MeteoWeatherTool \ No newline at end of file +from .tool import MeteoWeatherTool + +__all__ = [ + "MeteoWeatherTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/meteo/tool.py b/chatgpt_tool_hub/tools/meteo/tool.py index 943c891..947f877 100644 --- a/chatgpt_tool_hub/tools/meteo/tool.py +++ b/chatgpt_tool_hub/tools/meteo/tool.py @@ -2,12 +2,12 @@ from rich.console import Console -from chatgpt_tool_hub.chains.api import APIChain -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.meteo.docs_prompt import OPEN_METEO_DOCS +from ...chains.api import APIChain +from ...models import build_model_params +from ...models.model_factory import ModelFactory +from ..all_tool_list import main_tool_register +from .. import BaseTool +from .docs_prompt import OPEN_METEO_DOCS default_tool_name = "meteo-weather" diff --git a/chatgpt_tool_hub/tools/news/__init__.py b/chatgpt_tool_hub/tools/news/__init__.py index 4baa8ff..890c3a3 100644 --- a/chatgpt_tool_hub/tools/news/__init__.py +++ b/chatgpt_tool_hub/tools/news/__init__.py @@ -1,9 +1,9 @@ import importlib import os -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools import get_packages -from chatgpt_tool_hub.tools.tool_register import ToolRegister +from ...common.log import LOG +from .. import get_packages +from .. import ToolRegister news_tool_register = ToolRegister() @@ -21,7 +21,7 @@ LOG.info(f"[news.{package_name}] init failed, error_info: {repr(e)}") -from chatgpt_tool_hub.tools.news.tool import NewsTool +from .tool import NewsTool __all__ = [ "NewsTool", diff --git a/chatgpt_tool_hub/tools/news/finance_news/__init__.py b/chatgpt_tool_hub/tools/news/finance_news/__init__.py index d04180d..5812c73 100644 --- a/chatgpt_tool_hub/tools/news/finance_news/__init__.py +++ b/chatgpt_tool_hub/tools/news/finance_news/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.news.finance_news.tool import FinanceNewsTool +from .tool import FinanceNewsTool + +__all__ = [ + "FinanceNewsTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/news/finance_news/tool.py b/chatgpt_tool_hub/tools/news/finance_news/tool.py index 461a6c9..aef53be 100644 --- a/chatgpt_tool_hub/tools/news/finance_news/tool.py +++ b/chatgpt_tool_hub/tools/news/finance_news/tool.py @@ -5,10 +5,10 @@ from rich.console import Console -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.news import news_tool_register -from chatgpt_tool_hub.tools.web_requests.wrapper import RequestsWrapper +from ....common.log import LOG +from ... import BaseTool +from ...web_requests.wrapper import RequestsWrapper +from .. import news_tool_register default_tool_name = "finance-news" diff --git a/chatgpt_tool_hub/tools/news/morning_news/__init__.py b/chatgpt_tool_hub/tools/news/morning_news/__init__.py index 4311319..2ad9a24 100644 --- a/chatgpt_tool_hub/tools/news/morning_news/__init__.py +++ b/chatgpt_tool_hub/tools/news/morning_news/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.news.morning_news.tool import MorningNewsTool +from .tool import MorningNewsTool + +__all__ = [ + "MorningNewsTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/news/morning_news/tool.py b/chatgpt_tool_hub/tools/news/morning_news/tool.py index 548da8d..0a65de4 100644 --- a/chatgpt_tool_hub/tools/news/morning_news/tool.py +++ b/chatgpt_tool_hub/tools/news/morning_news/tool.py @@ -3,15 +3,16 @@ from rich.console import Console -from chatgpt_tool_hub.chains import LLMChain -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.prompts import PromptTemplate -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.news import news_tool_register -from chatgpt_tool_hub.tools.news.morning_news.prompt import SUMMARY_DOCS -from chatgpt_tool_hub.tools.web_requests.get import RequestsWrapper +from ....chains import LLMChain +from ....common.utils import get_from_dict_or_env +from ....models import build_model_params +from ....models.model_factory import ModelFactory +from ....prompts import PromptTemplate + +from ... import BaseTool +from .. import news_tool_register +from ...web_requests.get import RequestsWrapper +from .prompt import SUMMARY_DOCS default_tool_name = "morning-news" diff --git a/chatgpt_tool_hub/tools/news/news_api/__init__.py b/chatgpt_tool_hub/tools/news/news_api/__init__.py index f78ccb8..20994aa 100644 --- a/chatgpt_tool_hub/tools/news/news_api/__init__.py +++ b/chatgpt_tool_hub/tools/news/news_api/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.news.news_api.tool import NewsApiTool +from .tool import NewsApiTool + +__all__ = [ + "NewsApiTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/news/news_api/tool.py b/chatgpt_tool_hub/tools/news/news_api/tool.py index 4cba1ed..10ebd1e 100644 --- a/chatgpt_tool_hub/tools/news/news_api/tool.py +++ b/chatgpt_tool_hub/tools/news/news_api/tool.py @@ -2,13 +2,13 @@ from rich.console import Console -from chatgpt_tool_hub.chains.api import APIChain -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.news import news_tool_register -from chatgpt_tool_hub.tools.news.news_api.docs_prompt import NEWS_DOCS +from ....chains.api import APIChain +from ....common.utils import get_from_dict_or_env +from ....models import build_model_params +from ....models.model_factory import ModelFactory +from ... import BaseTool +from .. import news_tool_register +from .docs_prompt import NEWS_DOCS default_tool_name = "news-api" diff --git a/chatgpt_tool_hub/tools/news/tool.py b/chatgpt_tool_hub/tools/news/tool.py index 4466887..5e1f82b 100644 --- a/chatgpt_tool_hub/tools/news/tool.py +++ b/chatgpt_tool_hub/tools/news/tool.py @@ -2,14 +2,14 @@ from rich.console import Console -from chatgpt_tool_hub.engine import ToolEngine -from chatgpt_tool_hub.engine.initialize import init_tool_engine -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.load_tools import load_tools -from chatgpt_tool_hub.tools.news import news_tool_register +from ...engine import ToolEngine +from ...engine.initialize import init_tool_engine +from ...models import build_model_params +from ...models.model_factory import ModelFactory +from ..all_tool_list import main_tool_register +from .. import BaseTool +from ..load_tools import load_tools +from . import news_tool_register default_tool_name = "news" diff --git a/chatgpt_tool_hub/tools/python/__init__.py b/chatgpt_tool_hub/tools/python/__init__.py index b686523..e4e5840 100644 --- a/chatgpt_tool_hub/tools/python/__init__.py +++ b/chatgpt_tool_hub/tools/python/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.python.tool import PythonREPLTool \ No newline at end of file +from .tool import PythonREPLTool + +__all__ = [ + "PythonREPLTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/python/tool.py b/chatgpt_tool_hub/tools/python/tool.py index 4f983c1..dfe9790 100644 --- a/chatgpt_tool_hub/tools/python/tool.py +++ b/chatgpt_tool_hub/tools/python/tool.py @@ -8,9 +8,9 @@ from pydantic import Field, BaseModel from rich.console import Console -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool +from ...common.log import LOG +from .. import BaseTool +from ..all_tool_list import main_tool_register default_tool_name = "python" diff --git a/chatgpt_tool_hub/tools/searxng_search/__init__.py b/chatgpt_tool_hub/tools/searxng_search/__init__.py index 994cc0e..4335595 100644 --- a/chatgpt_tool_hub/tools/searxng_search/__init__.py +++ b/chatgpt_tool_hub/tools/searxng_search/__init__.py @@ -1,2 +1,9 @@ -from chatgpt_tool_hub.tools.searxng_search.tool import SearxSearchJsonTool, SearxSearchTool -from chatgpt_tool_hub.tools.searxng_search.wrapper import SearxSearchWrapper +from .tool import SearxSearchJsonTool, SearxSearchTool +from .wrapper import SearxSearchWrapper + + +__all__ = [ + "SearxSearchJsonTool", + "SearxSearchTool", + "SearxSearchWrapper" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/searxng_search/tool.py b/chatgpt_tool_hub/tools/searxng_search/tool.py index bacbabf..9a42e99 100644 --- a/chatgpt_tool_hub/tools/searxng_search/tool.py +++ b/chatgpt_tool_hub/tools/searxng_search/tool.py @@ -4,9 +4,9 @@ from pydantic import Extra from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.searxng_search.wrapper import SearxSearchWrapper +from .. import BaseTool +from ..all_tool_list import main_tool_register +from .wrapper import SearxSearchWrapper default_tool_name = "searxng-search" diff --git a/chatgpt_tool_hub/tools/searxng_search/wrapper.py b/chatgpt_tool_hub/tools/searxng_search/wrapper.py index ed13369..679422e 100644 --- a/chatgpt_tool_hub/tools/searxng_search/wrapper.py +++ b/chatgpt_tool_hub/tools/searxng_search/wrapper.py @@ -97,8 +97,8 @@ import aiohttp from pydantic import BaseModel, Extra, Field, PrivateAttr, root_validator, validator -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.tools.web_requests import RequestsWrapper +from ...common.utils import get_from_dict_or_env +from ..web_requests import RequestsWrapper def _get_default_params() -> dict: diff --git a/chatgpt_tool_hub/tools/summary/__init__.py b/chatgpt_tool_hub/tools/summary/__init__.py index 56696bd..9142df0 100644 --- a/chatgpt_tool_hub/tools/summary/__init__.py +++ b/chatgpt_tool_hub/tools/summary/__init__.py @@ -1,3 +1,9 @@ -from chatgpt_tool_hub.tools.summary.map_prompt import MAP_PROMPT -from chatgpt_tool_hub.tools.summary.reduce_prompt import REDUCE_PROMPT -from chatgpt_tool_hub.tools.summary.tool import SummaryTool +from .map_prompt import MAP_PROMPT +from .reduce_prompt import REDUCE_PROMPT +from .tool import SummaryTool + +__all__ = [ + "MAP_PROMPT", + "REDUCE_PROMPT", + "SummaryTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/summary/map_prompt.py b/chatgpt_tool_hub/tools/summary/map_prompt.py index ccba7e9..4cfce1d 100644 --- a/chatgpt_tool_hub/tools/summary/map_prompt.py +++ b/chatgpt_tool_hub/tools/summary/map_prompt.py @@ -1,4 +1,4 @@ -from chatgpt_tool_hub.prompts import PromptTemplate +from ...prompts import PromptTemplate PROMPT = """ 你是一位专业的研究分析师。我会给你提供某个长文档的一部分,你需要使用你的编辑和写作技能为它生成一个总结。 diff --git a/chatgpt_tool_hub/tools/summary/reduce_prompt.py b/chatgpt_tool_hub/tools/summary/reduce_prompt.py index 9b26866..f8adab7 100644 --- a/chatgpt_tool_hub/tools/summary/reduce_prompt.py +++ b/chatgpt_tool_hub/tools/summary/reduce_prompt.py @@ -1,4 +1,4 @@ -from chatgpt_tool_hub.prompts import PromptTemplate +from ...prompts import PromptTemplate PROMPT = """ 你是文案编辑,你的工作是组合下列的文本,同时做一些转述 diff --git a/chatgpt_tool_hub/tools/summary/tool.py b/chatgpt_tool_hub/tools/summary/tool.py index bb4d72a..4916106 100644 --- a/chatgpt_tool_hub/tools/summary/tool.py +++ b/chatgpt_tool_hub/tools/summary/tool.py @@ -5,15 +5,15 @@ from rich.console import Console from rich.panel import Panel -from chatgpt_tool_hub.chains.llm import LLMChain -from chatgpt_tool_hub.common.calculate_token import count_string_tokens as get_token_num -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.models import build_model_params -from chatgpt_tool_hub.models.model_factory import ModelFactory -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.summary import MAP_PROMPT, REDUCE_PROMPT +from ...chains.llm import LLMChain +from ...common.calculate_token import count_string_tokens as get_token_num +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from ...models import build_model_params +from ...models.model_factory import ModelFactory +from ..all_tool_list import main_tool_register +from .. import BaseTool +from . import MAP_PROMPT, REDUCE_PROMPT class TextClipper: diff --git a/chatgpt_tool_hub/tools/system/__init__.py b/chatgpt_tool_hub/tools/system/__init__.py index f78b64b..d43e0cb 100644 --- a/chatgpt_tool_hub/tools/system/__init__.py +++ b/chatgpt_tool_hub/tools/system/__init__.py @@ -1,2 +1,7 @@ -from chatgpt_tool_hub.tools.system.debug import DebugTool -from chatgpt_tool_hub.tools.system.answer_user import AnswerUserTool +from .debug import DebugTool +from .answer_user import AnswerUserTool + +__all__ = [ + "DebugTool", + "AnswerUserTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/system/answer_user.py b/chatgpt_tool_hub/tools/system/answer_user.py index a9f61e9..7071738 100644 --- a/chatgpt_tool_hub/tools/system/answer_user.py +++ b/chatgpt_tool_hub/tools/system/answer_user.py @@ -2,8 +2,8 @@ from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool +from .. import BaseTool +from ..all_tool_list import main_tool_register default_tool_name = "answer-user" diff --git a/chatgpt_tool_hub/tools/system/debug.py b/chatgpt_tool_hub/tools/system/debug.py index 9c25410..9fcf456 100644 --- a/chatgpt_tool_hub/tools/system/debug.py +++ b/chatgpt_tool_hub/tools/system/debug.py @@ -4,8 +4,8 @@ from pydantic import Field from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool +from .. import BaseTool +from ..all_tool_list import main_tool_register default_tool_name = "debug" diff --git a/chatgpt_tool_hub/tools/terminal/__init__.py b/chatgpt_tool_hub/tools/terminal/__init__.py index e0318b3..64ea19c 100644 --- a/chatgpt_tool_hub/tools/terminal/__init__.py +++ b/chatgpt_tool_hub/tools/terminal/__init__.py @@ -1 +1,5 @@ -from chatgpt_tool_hub.tools.terminal.base import TerminalTool \ No newline at end of file +from .base import TerminalTool + +__all__ = [ + "TerminalTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/terminal/base.py b/chatgpt_tool_hub/tools/terminal/base.py index fd07842..8e9e193 100644 --- a/chatgpt_tool_hub/tools/terminal/base.py +++ b/chatgpt_tool_hub/tools/terminal/base.py @@ -7,9 +7,9 @@ from pydantic import Field from rich.console import Console -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool +from ...common.log import LOG +from .. import BaseTool +from ..all_tool_list import main_tool_register default_tool_name = "terminal" diff --git a/chatgpt_tool_hub/tools/tool.py b/chatgpt_tool_hub/tools/tool.py index cd700f5..fa01eb2 100644 --- a/chatgpt_tool_hub/tools/tool.py +++ b/chatgpt_tool_hub/tools/tool.py @@ -3,7 +3,7 @@ from typing import Any, Callable, Optional from typing import Awaitable, Union -from chatgpt_tool_hub.tools.base_tool import BaseTool +from . import BaseTool class Tool(BaseTool): diff --git a/chatgpt_tool_hub/tools/tool_register.py b/chatgpt_tool_hub/tools/tool_register.py index 4020945..13a760b 100644 --- a/chatgpt_tool_hub/tools/tool_register.py +++ b/chatgpt_tool_hub/tools/tool_register.py @@ -1,7 +1,7 @@ from typing import List -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.singleton import Singleton +from ..common.log import LOG +from ..common.singleton import Singleton class ToolRegister(Singleton): diff --git a/chatgpt_tool_hub/tools/visual_dl/__init__.py b/chatgpt_tool_hub/tools/visual_dl/__init__.py index 33eeb8e..e48d42b 100644 --- a/chatgpt_tool_hub/tools/visual_dl/__init__.py +++ b/chatgpt_tool_hub/tools/visual_dl/__init__.py @@ -1 +1,6 @@ -from chatgpt_tool_hub.tools.visual_dl.text2image import ImageCaptionTool +from .text2image import ImageCaptionTool + + +__all__ = [ + "ImageCaptionTool" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/visual_dl/text2image.py b/chatgpt_tool_hub/tools/visual_dl/text2image.py index 6fdfc4a..a8b8a11 100644 --- a/chatgpt_tool_hub/tools/visual_dl/text2image.py +++ b/chatgpt_tool_hub/tools/visual_dl/text2image.py @@ -5,10 +5,10 @@ from rich.console import Console from transformers import BlipProcessor, BlipForConditionalGeneration -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from .. import BaseTool +from ..all_tool_list import main_tool_register default_tool_name = "image2text" diff --git a/chatgpt_tool_hub/tools/web_requests/__init__.py b/chatgpt_tool_hub/tools/web_requests/__init__.py index c004499..70742e7 100644 --- a/chatgpt_tool_hub/tools/web_requests/__init__.py +++ b/chatgpt_tool_hub/tools/web_requests/__init__.py @@ -7,8 +7,8 @@ from bs4 import BeautifulSoup from pydantic import BaseModel -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools import SummaryTool +from ...common.log import LOG +from .. import SummaryTool def filter_text(html: str) -> str: @@ -54,7 +54,7 @@ def _parse_input(text: str) -> Dict[str, Any]: "Accept-Encoding": "*" } -from chatgpt_tool_hub.tools.web_requests.wrapper import RequestsWrapper +from .wrapper import RequestsWrapper class BaseRequestsTool(BaseModel): @@ -63,12 +63,12 @@ class BaseRequestsTool(BaseModel): requests_wrapper: RequestsWrapper -from chatgpt_tool_hub.tools.web_requests.browser import BrowserTool -from chatgpt_tool_hub.tools.web_requests.delete import RequestsDeleteTool -from chatgpt_tool_hub.tools.web_requests.get import RequestsGetTool -from chatgpt_tool_hub.tools.web_requests.patch import RequestsPatchTool -from chatgpt_tool_hub.tools.web_requests.post import RequestsPostTool -from chatgpt_tool_hub.tools.web_requests.put import RequestsPutTool +from .browser import BrowserTool +from .delete import RequestsDeleteTool +from .get import RequestsGetTool +from .patch import RequestsPatchTool +from .post import RequestsPostTool +from .put import RequestsPutTool __all__ = ( diff --git a/chatgpt_tool_hub/tools/web_requests/browser.py b/chatgpt_tool_hub/tools/web_requests/browser.py index c9a01c3..2388048 100644 --- a/chatgpt_tool_hub/tools/web_requests/browser.py +++ b/chatgpt_tool_hub/tools/web_requests/browser.py @@ -5,11 +5,11 @@ from pydantic import BaseModel, Extra, root_validator from rich.console import Console -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.web_requests import filter_text +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from ..all_tool_list import main_tool_register +from .. import BaseTool +from . import filter_text default_tool_name = "browser" diff --git a/chatgpt_tool_hub/tools/web_requests/delete.py b/chatgpt_tool_hub/tools/web_requests/delete.py index 20b8b44..cc4a34b 100644 --- a/chatgpt_tool_hub/tools/web_requests/delete.py +++ b/chatgpt_tool_hub/tools/web_requests/delete.py @@ -1,5 +1,5 @@ -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.web_requests import BaseRequestsTool +from ..import BaseTool +from . import BaseRequestsTool class RequestsDeleteTool(BaseRequestsTool, BaseTool): diff --git a/chatgpt_tool_hub/tools/web_requests/get.py b/chatgpt_tool_hub/tools/web_requests/get.py index 48c1728..4ec829b 100644 --- a/chatgpt_tool_hub/tools/web_requests/get.py +++ b/chatgpt_tool_hub/tools/web_requests/get.py @@ -3,10 +3,10 @@ from rich.console import Console -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.web_requests import BaseRequestsTool, filter_text, RequestsWrapper +from ...common.log import LOG +from ..all_tool_list import main_tool_register +from .. import BaseTool +from . import BaseRequestsTool, filter_text, RequestsWrapper default_tool_name = "url-get" diff --git a/chatgpt_tool_hub/tools/web_requests/patch.py b/chatgpt_tool_hub/tools/web_requests/patch.py index 8f7f593..4b7eee2 100644 --- a/chatgpt_tool_hub/tools/web_requests/patch.py +++ b/chatgpt_tool_hub/tools/web_requests/patch.py @@ -1,5 +1,5 @@ -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.web_requests import BaseRequestsTool, _parse_input +from .. import BaseTool +from . import BaseRequestsTool, _parse_input class RequestsPatchTool(BaseRequestsTool, BaseTool): diff --git a/chatgpt_tool_hub/tools/web_requests/post.py b/chatgpt_tool_hub/tools/web_requests/post.py index 4b85a21..1d87bb3 100644 --- a/chatgpt_tool_hub/tools/web_requests/post.py +++ b/chatgpt_tool_hub/tools/web_requests/post.py @@ -1,9 +1,9 @@ import json import logging -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.web_requests import BaseRequestsTool, _parse_input, RequestsWrapper -from chatgpt_tool_hub.common.log import LOG +from ...common.log import LOG +from .. import BaseTool +from . import BaseRequestsTool, _parse_input, RequestsWrapper class RequestsPostTool(BaseRequestsTool, BaseTool): diff --git a/chatgpt_tool_hub/tools/web_requests/put.py b/chatgpt_tool_hub/tools/web_requests/put.py index 372a54f..bada11a 100644 --- a/chatgpt_tool_hub/tools/web_requests/put.py +++ b/chatgpt_tool_hub/tools/web_requests/put.py @@ -1,5 +1,5 @@ -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.web_requests import BaseRequestsTool, _parse_input +from .. import BaseTool +from . import BaseRequestsTool, _parse_input class RequestsPutTool(BaseRequestsTool, BaseTool): diff --git a/chatgpt_tool_hub/tools/web_requests/wrapper.py b/chatgpt_tool_hub/tools/web_requests/wrapper.py index 1175804..743cc19 100644 --- a/chatgpt_tool_hub/tools/web_requests/wrapper.py +++ b/chatgpt_tool_hub/tools/web_requests/wrapper.py @@ -5,9 +5,9 @@ import requests from pydantic import BaseModel, Extra, root_validator -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env -from chatgpt_tool_hub.tools.web_requests import DEFAULT_HEADER +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env +from . import DEFAULT_HEADER browser: Any = None # ChromeWebDriver or None diff --git a/chatgpt_tool_hub/tools/wikipedia/__init__.py b/chatgpt_tool_hub/tools/wikipedia/__init__.py index 03f8d19..da3a02e 100644 --- a/chatgpt_tool_hub/tools/wikipedia/__init__.py +++ b/chatgpt_tool_hub/tools/wikipedia/__init__.py @@ -1,2 +1,8 @@ -from chatgpt_tool_hub.tools.wikipedia.wikipedia import WikipediaTool -from chatgpt_tool_hub.tools.wikipedia.wrapper import WikipediaAPIWrapper +from .wikipedia import WikipediaTool +from .wrapper import WikipediaAPIWrapper + + +__all__ = [ + "WikipediaTool", + "WikipediaAPIWrapper" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/wikipedia/wikipedia.py b/chatgpt_tool_hub/tools/wikipedia/wikipedia.py index 6842c95..e49394d 100644 --- a/chatgpt_tool_hub/tools/wikipedia/wikipedia.py +++ b/chatgpt_tool_hub/tools/wikipedia/wikipedia.py @@ -3,9 +3,9 @@ from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.wikipedia.wrapper import WikipediaAPIWrapper +from .. import BaseTool +from ..all_tool_list import main_tool_register +from .wrapper import WikipediaAPIWrapper default_tool_name = "wikipedia" diff --git a/chatgpt_tool_hub/tools/wikipedia/wrapper.py b/chatgpt_tool_hub/tools/wikipedia/wrapper.py index 52e341f..ebbf3af 100644 --- a/chatgpt_tool_hub/tools/wikipedia/wrapper.py +++ b/chatgpt_tool_hub/tools/wikipedia/wrapper.py @@ -4,8 +4,8 @@ from pydantic import BaseModel, Extra, root_validator -from chatgpt_tool_hub.common.log import LOG -from chatgpt_tool_hub.common.utils import get_from_dict_or_env +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env class WikipediaAPIWrapper(BaseModel): diff --git a/chatgpt_tool_hub/tools/wolfram_alpha/__init__.py b/chatgpt_tool_hub/tools/wolfram_alpha/__init__.py index 713da70..4ec28ff 100644 --- a/chatgpt_tool_hub/tools/wolfram_alpha/__init__.py +++ b/chatgpt_tool_hub/tools/wolfram_alpha/__init__.py @@ -1,2 +1,7 @@ -from chatgpt_tool_hub.tools.wolfram_alpha.wolfram_alpha import WolframAlphaTool -from chatgpt_tool_hub.tools.wolfram_alpha.wolfram_alpha import WolframAlphaAPIWrapper +from .wolfram_alpha import WolframAlphaTool +from .wolfram_alpha import WolframAlphaAPIWrapper + +__all__ = [ + "WolframAlphaTool", + "WolframAlphaAPIWrapper" +] \ No newline at end of file diff --git a/chatgpt_tool_hub/tools/wolfram_alpha/wolfram_alpha.py b/chatgpt_tool_hub/tools/wolfram_alpha/wolfram_alpha.py index 590498a..620de73 100644 --- a/chatgpt_tool_hub/tools/wolfram_alpha/wolfram_alpha.py +++ b/chatgpt_tool_hub/tools/wolfram_alpha/wolfram_alpha.py @@ -4,9 +4,9 @@ from rich.console import Console -from chatgpt_tool_hub.tools.all_tool_list import main_tool_register -from chatgpt_tool_hub.tools.base_tool import BaseTool -from chatgpt_tool_hub.tools.wolfram_alpha.wrapper import WolframAlphaAPIWrapper +from ..all_tool_list import main_tool_register +from .. import BaseTool +from .wrapper import WolframAlphaAPIWrapper default_tool_name = "wolfram-alpha" diff --git a/chatgpt_tool_hub/tools/wolfram_alpha/wrapper.py b/chatgpt_tool_hub/tools/wolfram_alpha/wrapper.py index 7478604..3575d44 100644 --- a/chatgpt_tool_hub/tools/wolfram_alpha/wrapper.py +++ b/chatgpt_tool_hub/tools/wolfram_alpha/wrapper.py @@ -1,9 +1,10 @@ """Util that calls WolframAlpha.""" from typing import Any, Dict, Optional -from chatgpt_tool_hub.common.log import LOG + from pydantic import BaseModel, Extra, root_validator -from chatgpt_tool_hub.common.utils import get_from_dict_or_env +from ...common.log import LOG +from ...common.utils import get_from_dict_or_env class WolframAlphaAPIWrapper(BaseModel):