add readme

This commit is contained in:
Thomas van der Meer 2024-11-22 14:40:39 +01:00
parent 0a9571de3d
commit b4e332b525
2 changed files with 19 additions and 6 deletions

View File

@ -0,0 +1,9 @@
for cloning: `git config --global http.sslverify false`
for installing the environment, install uv -> `pip install uv`
after that, create an environment `uv venv`
install the packages by running `uv sync`
create an .env file by running `touch .env`
add the following line: `TOGETHER_API_KEY=<together API key>`
if you don't have it, please ask me :)

View File

@ -1,21 +1,25 @@
# Add your utilities or helper functions to this file.
import os
import json
from dotenv import load_dotenv, find_dotenv
# these expect to find a .env file at the directory above the lesson. # the format for that file is (without the comment) # API_KEYNAME=AStringThatIsTheLongAPIKeyFromSomeService
def load_env():
_ = load_dotenv(find_dotenv())
def save_world(world, filename):
with open(filename, 'w') as f:
with open(filename, "w") as f:
json.dump(world, f)
def load_world(filename):
with open(filename, 'r') as f:
with open(filename, "r") as f:
return json.load(f)
def get_together_api_key():
load_env()
together_api_key = os.getenv("TOGETHER_API_KEY")
return together_api_key
load_env()
together_api_key = os.getenv("TOGETHER_API_KEY")
return together_api_key