def get_key():
    """Gets api key from secret file

    Returns: (str) api key
    """
    key = []
    secret = ""
    # gets path of this script - OS independent
    path = dirname(abspath(getfile(currentframe()))) + "/.secret.txt"
    try:
        # get appropriate api key
        with open(path) as f:
            key = [line.strip() for line in f]
        for k in key:
            if k.startswith("OPENAI_KEY"):
                secret = k.split('"')[1::2]
    except FileNotFoundError:
        print("Could not find api key. Please make sure you've run the CLI "
              "tool and set up your model")
        quit("Exiting...")

    return secret[0]
Gets api key from secret file

    Returns: (str) api key
    
chatgdb/utils.py