-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
48 lines (37 loc) · 1.01 KB
/
app.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
import os
import platform
import openai
import chains
import indices
import config
from functions import GoogleSearch
from functions import Interpreter
from utils import TerminalLogger
def main():
openai.api_key = os.environ.get('OPENAI_API_KEY')
tmd = TerminalLogger()
tmd.set_color('THOUGHT', 'purple')
tmd.set_color('RELEVANT', 'cyan')
tmd.set_color('FUNCTION', 'green')
tmd.set_color('INPUT', 'green')
tmd.set_color('RESPONSE', 'green')
tmd.set_color('CONCLUSION', 'yellow')
tmd.set_color('COMMAND', 'blue')
tmd.set_color('HALLUCINATION', 'red')
index = indices.IntentIndex(tmd)
index.put(GoogleSearch())
index.put(Interpreter())
chain = chains.Hyperion(index, tmd)
if platform.system() == 'Windows':
os.system('cls')
else:
os.system('clear')
while True:
query = input('> ')
if query.lower() == 'exit':
break
else:
print()
chain.run(query)
if __name__ == '__main__':
main()