Add: config

This commit is contained in:
csunny 2023-05-09 11:18:06 +08:00
parent 25fd7450cc
commit 60d5a2ffc6
8 changed files with 136 additions and 11 deletions

72
.env.template Normal file
View File

@ -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

2
.gitignore vendored
View File

@ -131,5 +131,5 @@ dmypy.json
.pyre/
.DS_Store
logs
nltk_data
.vectordb

View File

@ -36,6 +36,10 @@ The Generated SQL is runable.
<img src="https://github.com/csunny/DB-GPT/blob/main/asserts/DB_QA.png" margin-left="auto" margin-right="auto" width="600">
基于默认内置知识库QA
<img src="https://github.com/csunny/DB-GPT/blob/main/asserts/VectorDBQA.png" width="600" margin-left="auto" margin-right="auto" >
# 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)

BIN
asserts/VectorDBQA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

View File

@ -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

View File

@ -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
# 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

View File

@ -37,7 +37,7 @@ ISDEBUG = False
DB_SETTINGS = {
"user": "root",
"password": "aa123456",
"password": "aa12345678",
"host": "localhost",
"port": 3306
}

View File

@ -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