2023-11-10 09:50:58 +08:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
load_dotenv()
|
|
|
|
import utils
|
2023-11-13 15:40:19 +08:00
|
|
|
# from functions import FUNCTIONS
|
|
|
|
from functions_zh import FUNCTIONS
|
2023-11-10 09:50:58 +08:00
|
|
|
from agent import Agent
|
|
|
|
|
|
|
|
|
2023-11-13 15:40:19 +08:00
|
|
|
import urllib3
|
|
|
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
|
|
|
2023-11-10 09:50:58 +08:00
|
|
|
def run_agent_loop(agent):
|
|
|
|
while True:
|
|
|
|
user_input = input("You: ")
|
|
|
|
if user_input == "/exit":
|
|
|
|
break
|
|
|
|
user_input = user_input.rstrip()
|
|
|
|
user_message = utils.package_user_message(user_input)
|
|
|
|
agent.step(user_message)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
persona = utils.get_persona_text()
|
|
|
|
human = utils.get_human_text()
|
|
|
|
system = utils.get_system_text()
|
2023-11-13 15:40:19 +08:00
|
|
|
|
|
|
|
print("system:",system)
|
|
|
|
print("persona:", persona)
|
|
|
|
print("human:", human)
|
|
|
|
|
2023-11-10 09:50:58 +08:00
|
|
|
agent = Agent(model="gpt-3.5-turbo-16k-0613", system=system, functions_description=FUNCTIONS, persona_notes=persona,
|
|
|
|
human_notes=human)
|
|
|
|
run_agent_loop(agent)
|