diff --git a/.env.template b/.env.template new file mode 100644 index 000000000..5bf746eaa --- /dev/null +++ b/.env.template @@ -0,0 +1,72 @@ +#*******************************************************************# +#** DB-GPT - GENERAL SETTINGS **# +#*******************************************************************# +## DISABLED_COMMAND_CATEGORIES - The list of categories of commands that are disabled. Each of the below are an option: +## pilot.commands.query_execute + +## For example, to disable coding related features, uncomment the next line +# DISABLED_COMMAND_CATEGORIES= + + +#*******************************************************************# +#*** LLM PROVIDER ***# +#*******************************************************************# + +# TEMPERATURE=0 + +#*******************************************************************# +#** LLM MODELS **# +#*******************************************************************# + +## SMART_LLM_MODEL - Smart language model (Default: vicuna-13b) +## FAST_LLM_MODEL - Fast language model (Default: chatglm-6b) +# SMART_LLM_MODEL=vicuna-13b +# FAST_LLM_MODEL=chatglm-6b + + +### EMBEDDINGS +## EMBEDDING_MODEL - Model to use for creating embeddings +## EMBEDDING_TOKENIZER - Tokenizer to use for chunking large inputs +## EMBEDDING_TOKEN_LIMIT - Chunk size limit for large inputs +# EMBEDDING_MODEL=all-MiniLM-L6-v2 +# EMBEDDING_TOKENIZER=all-MiniLM-L6-v2 +# EMBEDDING_TOKEN_LIMIT=8191 + + +#*******************************************************************# +#** DATABASE SETTINGS **# +#*******************************************************************# +DB_SETTINGS_MYSQL_USER=root +DB_SETTINGS_MYSQL_PASSWORD=password +DB_SETTINGS_MYSQL_HOST=localhost +DB_SETTINGS_MYSQL_PORT=3306 + + +### MILVUS +## MILVUS_ADDR - Milvus remote address (e.g. localhost:19530) +## MILVUS_USERNAME - username for your Milvus database +## MILVUS_PASSWORD - password for your Milvus database +## MILVUS_SECURE - True to enable TLS. (Default: False) +## Setting MILVUS_ADDR to a `https://` URL will override this setting. +## MILVUS_COLLECTION - Milvus collection, change it if you want to start a new memory and retain the old memory. +# MILVUS_ADDR=localhost:19530 +# MILVUS_USERNAME= +# MILVUS_PASSWORD= +# MILVUS_SECURE= +# MILVUS_COLLECTION=dbgpt + +#*******************************************************************# +#** ALLOWLISTED PLUGINS **# +#*******************************************************************# + +#ALLOWLISTED_PLUGINS - Sets the listed plugins that are allowed (Example: plugin1,plugin2,plugin3) +#DENYLISTED_PLUGINS - Sets the listed plugins that are not allowed (Example: plugin1,plugin2,plugin3) +ALLOWLISTED_PLUGINS= +DENYLISTED_PLUGINS= + + +#*******************************************************************# +#** CHAT PLUGIN SETTINGS **# +#*******************************************************************# +# CHAT_MESSAGES_ENABLED - Enable chat messages (Default: False) +# CHAT_MESSAGES_ENABLED=False diff --git a/.gitignore b/.gitignore index 07be74f26..0b232d95a 100644 --- a/.gitignore +++ b/.gitignore @@ -131,5 +131,5 @@ dmypy.json .pyre/ .DS_Store logs - +nltk_data .vectordb \ No newline at end of file diff --git a/README.md b/README.md index 49b1bffef..edf0e71cf 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ The Generated SQL is runable. +基于默认内置知识库QA + + + # Dependencies 1. First you need to install python requirements. ``` @@ -79,6 +83,7 @@ python webserver.py 总的来说,它是一个用于数据库的复杂且创新的AI工具。如果您对如何在工作中使用或实施DB-GPT有任何具体问题,请联系我, 我会尽力提供帮助, 同时也欢迎大家参与到项目建设中, 做一些有趣的事情。 - +# Contribute +[Contribute](https://github.com/csunny/DB-GPT/blob/main/CONTRIBUTING) # Licence [MIT](https://github.com/csunny/DB-GPT/blob/main/LICENSE) \ No newline at end of file diff --git a/asserts/VectorDBQA.png b/asserts/VectorDBQA.png new file mode 100644 index 000000000..05279002e Binary files /dev/null and b/asserts/VectorDBQA.png differ diff --git a/environment.yml b/environment.yml index ea7415df0..ce2c7339f 100644 --- a/environment.yml +++ b/environment.yml @@ -57,11 +57,11 @@ dependencies: - sentence-transformers - umap-learn - notebook - - gradio==3.24.1 + - gradio==3.23 - gradio-client==0.0.8 - wandb - - fschat=0.1.10 - - llama-index=0.5.27 + - fschat==0.1.10 + - llama-index==0.5.27 - pymysql - unstructured==0.6.3 - pytesseract==0.3.10 diff --git a/pilot/configs/config.py b/pilot/configs/config.py index a66402c17..799bcd59b 100644 --- a/pilot/configs/config.py +++ b/pilot/configs/config.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import os +from typing import List from auto_gpt_plugin_template import AutoGPTPluginTemplate from pilot.singleton import Singleton @@ -8,7 +10,53 @@ class Config(metaclass=Singleton): """Configuration class to store the state of bools for different scripts access""" def __init__(self) -> None: """Initialize the Config class""" - pass + + # TODO change model_config there + + self.debug_mode = False + self.skip_reprompt = False + + self.plugins_dir = os.getenv("PLUGINS_DIR", "plugins") + self.plugins = List[AutoGPTPluginTemplate] = [] + self.temperature = float(os.getenv("TEMPERATURE", 0.7)) - # TODO change model_config there \ No newline at end of file + # User agent header to use when making HTTP requests + # Some websites might just completely deny request with an error code if + # no user agent was found. + self.user_agent = os.getenv( + "USER_AGENT", + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36" + " (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36", + ) + + # milvus or zilliz cloud configuration + self.milvus_addr = os.getenv("MILVUS_ADDR", "localhost:19530") + self.milvus_username = os.getenv("MILVUS_USERNAME") + self.milvus_password = os.getenv("MILVUS_PASSWORD") + self.milvus_collection = os.getenv("MILVUS_COLLECTION", "dbgpt") + self.milvus_secure = os.getenv("MILVUS_SECURE") == "True" + + plugins_allowlist = os.getenv("ALLOWLISTED_PLUGINS") + if plugins_allowlist: + self.plugins_allowlist = plugins_allowlist.split(",") + else: + self.plugins_allowlist = [] + + plugins_denylist = os.getenv("DENYLISTED_PLUGINS") + if plugins_denylist: + self.plugins_denylist = [] + + def set_debug_mode(self, value: bool) -> None: + """Set the debug mode value""" + self.debug_mode = value + + def set_plugins(self, value: list) -> None: + """Set the plugins value. """ + self.plugins = value + + def set_templature(self, value: int) -> None: + """Set the temperature value.""" + self.temperature = value + + \ No newline at end of file diff --git a/pilot/configs/model_config.py b/pilot/configs/model_config.py index a5c27d9d2..7b4269fb6 100644 --- a/pilot/configs/model_config.py +++ b/pilot/configs/model_config.py @@ -37,7 +37,7 @@ ISDEBUG = False DB_SETTINGS = { "user": "root", - "password": "aa123456", + "password": "aa12345678", "host": "localhost", "port": 3306 } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0582f5a41..b22b2d2ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -47,11 +47,11 @@ pycocoevalcap sentence-transformers umap-learn notebook -gradio==3.24.1 +gradio==3.23 gradio-client==0.0.8 wandb -fschat=0.1.10 -llama-index=0.5.27 +fschat==0.1.10 +llama-index==0.5.27 pymysql unstructured==0.6.3 pytesseract==0.3.10 \ No newline at end of file