File size: 815 Bytes
e20cc51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json
import os
from datasets import load_dataset

class get_files:

    def load_markdown_file(file_path):
        try:
            with open(file_path, 'r') as f:
                return f.read()
        except FileNotFoundError:
            return "File not found. Please check the file path."
        except Exception as e:
            return f"Error loading file: {str(e)}"

    def json_cfg():
        """Retrieve configuration file"""
        config_path = os.getenv('CONFIG_PATH')
        with open(config_path, 'r') as file:
            config = json.load(file)
        return config

    def get_keys():
        "Get keys required to set up loading"
        return {
            "huggingface": os.environ["HUGGINGFACE_TOKEN"], 
            "openai": "", # leaving this alone for future use.
        }