-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from csunny/dev
add config
- Loading branch information
Showing
17 changed files
with
720 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding:utf-8 -*- | ||
|
||
import gradio as gr | ||
|
||
def change_tab(): | ||
return gr.Tabs.update(selected=1) | ||
|
||
with gr.Blocks() as demo: | ||
with gr.Tabs() as tabs: | ||
with gr.TabItem("Train", id=0): | ||
t = gr.Textbox() | ||
with gr.TabItem("Inference", id=1): | ||
i = gr.Image() | ||
|
||
btn = gr.Button() | ||
btn.click(change_tab, None, tabs) | ||
|
||
demo.launch() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import functools | ||
import importlib | ||
import inspect | ||
from typing import Any, Callable, Optional | ||
|
||
class Command: | ||
"""A class representing a command. | ||
Attributes: | ||
name (str): The name of the command. | ||
description (str): A brief description of what the command does. | ||
signature (str): The signature of the function that the command executes. Default to None. | ||
""" | ||
|
||
def __init__(self, | ||
name: str, | ||
description: str, | ||
method: Callable[..., Any], | ||
signature: str = "", | ||
enabled: bool = True, | ||
disabled_reason: Optional[str] = None, | ||
) -> None: | ||
self.name = name | ||
self.description = description | ||
self.method = method | ||
self.signature = signature if signature else str(inspect.signature(self.method)) | ||
self.enabled = enabled | ||
self.disabled_reason = disabled_reason | ||
|
||
def __call__(self, *args: Any, **kwds: Any) -> Any: | ||
if not self.enabled: | ||
return f"Command '{self.name}' is disabled: {self.disabled_reason}" | ||
return self.method(*args, **kwds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,62 @@ | ||
#!/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 | ||
|
||
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 | ||
|
||
# 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)) | ||
|
||
|
||
# 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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.