-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (29 loc) · 1.12 KB
/
main.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
import os
from openai import OpenAI
from lib.ChatManager import ChatManager
from lib.ArchImplementations.LLAMA_Sentence import LLAMA_Sentence
def main():
models = os.getenv(r"LOCALAPPDATA")
models = list(os.listdir(models + r"\nomic.ai\GPT4All"))
models = [item for item in models if item.endswith(".gguf")]
localURL = "http://localhost:9090/v1"
creds = OpenAI(api_key="None", base_url=localURL)
summarizeText = None
path = os.getcwd() + r"\SavingPrivateRyan.txt"
with open(path) as file:
summarizeText = file.read()
# one = LLAMA_Sentence.start()
# one.setPromptContent(content=summarizeText + "\n---\n" + "Summarize that text")
# one.end()
# print(chatMan.run(one))
chatMan = ChatManager(creds, models[0], historyTokenLimit=1200)
newMsg = LLAMA_Sentence.start()
newMsg.setPromptContent(input("Init: "))
newMsg.end()
print(chatMan.run(newMsg, appendHistory=True))
while True:
newMsg = LLAMA_Sentence.start()
newMsg.setPromptContent(input("Response: "))
newMsg.end()
print(chatMan.run(newMsg, appendHistory=True))
main()