-
Notifications
You must be signed in to change notification settings - Fork 3
/
settings.py
45 lines (38 loc) · 1.58 KB
/
settings.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
import os
import pathlib
import yaml
DEFAULT_SETTINGS = {
"cyberdolphin": {
"openai": {
"organisation": "NO ORG",
"api_key": "NO API KEY",
"model": "gpt-3.5-turbo"
},
"openai_compatible": {
"organisation": "NO ORG",
"api_key": "your_key",
"api_base": 'http://ip:3200'
},
"prompts": {
"example_user_prompt": "{Camel|goldfish|glowing orb},{moss|tree|fern|balloon},{space station|garden shed|glowing laser sword|bowl of petunias|orange taxi|neon sign}",
"default_prompt": {
"system": "You are deeply artistic, understanding of concepts like composition, pallete and color theory, and image psychology.",
"prefix": "Do use objective language. Do not add narrative. Do describe objects visually and in context. \
Do not describe the purpose of the objects, or any other explanations \"",
"suffix": '"'
}
}
}
}
def load_settings():
path = os.path.join(os.path.dirname(__file__), "settings.yaml")
file_path = pathlib.Path(path)
if not file_path.exists():
return DEFAULT_SETTINGS['cyberdolphin']
with open(path) as settings:
the_yaml = yaml.safe_load(settings)
# print(f'LOADED: {the_yaml["cyberdolphin"]}')
return the_yaml['cyberdolphin']
def api_settings(section: str = "openai"):
openai_settings = load_settings()['openai_compatible'][section]
return openai_settings['api_base'], openai_settings['api_key'], openai_settings['organisation']