from dotenv import load_dotenv load_dotenv('./.env') from settings import EVENTS from player import Player from llm import * from utils import PROMPT, INPUT_PROMPT, extract_after_final_answer loc = 0 cur = EVENTS[loc] player = Player('player-1') model = setup_model(HUGGINGFACE) while loc != -1 and loc < 10: print(f'Title: {cur.get_title()}') print(f'{cur.get_description()}') response = input("Human Response: ") response = model.invoke(PROMPT + INPUT_PROMPT.format(response)) response = extract_after_final_answer(response.content) loc = cur._next(response, player) attribute = player.get_attribute() print(response, loc) if attribute['hp'] <= 0 or attribute['mp'] <= 0: loc = -1 cur = EVENTS[loc] print('*'*20) print(f'Title: {cur.get_title()}') print(f'{cur.get_description()}') print(player.get_attribute())