diff --git a/.env.template b/.env.template index 64d3b2f67..77c94ad66 100644 --- a/.env.template +++ b/.env.template @@ -143,3 +143,9 @@ SUMMARY_CONFIG=FAST # CUDA_VISIBLE_DEVICES=0 ## You can configure the maximum memory used by each GPU. # MAX_GPU_MEMORY=16Gib + +#*******************************************************************# +#** LOG **# +#*******************************************************************# +# FATAL, ERROR, WARNING, WARNING, INFO, DEBUG, NOTSET +DBGPT_LOG_LEVEL=INFO \ No newline at end of file diff --git a/pilot/__init__.py b/pilot/__init__.py index d207a5bc3..d72238c1d 100644 --- a/pilot/__init__.py +++ b/pilot/__init__.py @@ -1,4 +1,12 @@ -from pilot.embedding_engine import SourceEmbedding, register -from pilot.embedding_engine import EmbeddingEngine, KnowledgeType +# Old packages +# __all__ = ["SourceEmbedding", "register", "EmbeddingEngine", "KnowledgeType"] -__all__ = ["SourceEmbedding", "register", "EmbeddingEngine", "KnowledgeType"] +__all__ = ["embedding_engine"] + + +def __getattr__(name: str): + import importlib + + if name in ["embedding_engine"]: + return importlib.import_module("." + name, __name__) + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/pilot/agent/json_fix_llm.py b/pilot/agent/json_fix_llm.py index 800c2858a..aa7c4cec8 100644 --- a/pilot/agent/json_fix_llm.py +++ b/pilot/agent/json_fix_llm.py @@ -12,7 +12,7 @@ from pilot.json_utils.json_fix_general import ( fix_invalid_escape, ) from pilot.logs import logger -from pilot.speech import say_text + CFG = Config() @@ -87,6 +87,8 @@ def correct_json(json_to_load: str) -> str: def attempt_to_fix_json_by_finding_outermost_brackets(json_string: str): + from pilot.speech.say import say_text + if CFG.speak_mode and CFG.debug_mode: say_text( "I have received an invalid JSON response from the OpenAI API. " diff --git a/pilot/commands/command.py b/pilot/commands/command.py index 8838efff1..add82d292 100644 --- a/pilot/commands/command.py +++ b/pilot/commands/command.py @@ -7,7 +7,6 @@ from typing import Dict from pilot.commands.exception_not_commands import NotCommands from pilot.configs.config import Config from pilot.prompts.generator import PluginPromptGenerator -from pilot.speech import say_text def _resolve_pathlike_command_args(command_args): @@ -37,6 +36,8 @@ def execute_ai_response_json( Returns: """ + from pilot.speech.say import say_text + cfg = Config() command_name, arguments = get_command(ai_response) diff --git a/pilot/common/markdown_text.py b/pilot/common/markdown_text.py index 1244160fd..8c2130cab 100644 --- a/pilot/common/markdown_text.py +++ b/pilot/common/markdown_text.py @@ -1,8 +1,9 @@ import markdown2 -import pandas as pd def datas_to_table_html(data): + import pandas as pd + df = pd.DataFrame(data[1:], columns=data[0]) table_style = """