| import os | |
| from dotenv import load_dotenv, find_dotenv | |
| import json | |
| from mistralai import Mistral | |
| def load_env(): | |
| _ = load_dotenv(find_dotenv()) | |
| def load_world(filename): | |
| with open(filename, 'r') as f: | |
| return json.load(f) | |
| def save_world(world): | |
| with open(f'{world["name"]}.json', 'w') as f: | |
| json.dump(world, f) | |
| def get_mistral_api_key(): | |
| load_env() | |
| mistral_api_key = os.getenv("MISTRAL_API_KEY") | |
| return mistral_api_key |