-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathconfig.py
84 lines (65 loc) · 2.13 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
from typing import Dict, Optional
from dotenv import load_dotenv
from simple_utils import get_root
load_dotenv()
api_keys: Dict[str, Optional[str]] = {}
default_params = {
"model": os.getenv("DEFAULT_MODEL", "gpt-4o"),
"temperature": 0.1,
"max_tokens": 1000,
}
fakedata = [
{
"type": "function",
"function": {
"name": "none",
"description": "you have no available functions, but you can use the <execute_code>code</execute_code> tags to run python code, only if explicitly asked for by the user. Be sure to add print statements to see the output.",
"parameters": {
"type": "object",
"properties": {},
},
},
}
]
fakedata_nothing = [
{
"type": "function",
"function": {
"name": "none",
"description": "you have no available functions",
"parameters": {
"type": "object",
"properties": {},
},
},
}
]
# Get API keys from environment variables
def update_api_keys() -> Dict[str, Optional[str]]:
api_keys.update(
{
"openai": os.getenv("OPENAI_API_KEY"),
"anthropic": os.getenv("ANTHROPIC_API_KEY"),
}
)
return api_keys
update_api_keys()
STATIC = "static"
CONFIGURATION_URL = "/configuration/"
LOGIN_REQUIRED = "login_required"
ADMIN_REQUIRED = "admin_required"
SINGLE_USER_USERNAME = os.environ.get("SINGLE_USER_USERNAME", "admin")
SINGLE_USER_DISPLAY_NAME = os.environ.get("SINGLE_USER_DISPLAY_NAME", "admin")
SINGLE_USER_PASSWORD = os.environ.get("SINGLE_USER_PASSWORD", "admin")
DEFAULT_CLANG_SYSTEM_CONFIGURATION_FILE = get_root("users/user.env")
PRODUCTION = os.getenv("PRODUCTION", "false").lower() in ["true", "1", "yes"]
USERS_DIR = "users"
# not used for now, embedding model used in the ChromaDB files
OPENAI_EMBEDDING_MODEL = os.environ.get("OPENAI_EMBEDDING_MODEL", "text-davinci-003")
def origins():
return os.environ["ORIGINS"]
def database_url():
return os.environ["DATABASE_URL"]
def new_database_url():
return os.environ["NEW_DATABASE_URL"]