File size: 462 Bytes
f967329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60bf579
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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