import re from dotenv import load_dotenv import re import os from globalvars import tasks def load_env_variables(): # Load the .env file load_dotenv() # Retrieve the environment variables hf_token = os.getenv('HF_TOKEN') yi_token = os.getenv('YI_TOKEN') return hf_token, yi_token def parse_and_route(example_output: str): # Regex pattern to match the true task pattern = r'"(\w+)":\s?true' # Find the true task match = re.search(pattern, example_output) if match: true_task = match.group(1) if true_task in tasks: return {true_task: tasks[true_task]} else: return {true_task: "Task description not found"} else: return "No true task found in the example output"