forked from ferreret/Event-Driven-Agentic-Workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.py
More file actions
31 lines (23 loc) · 902 Bytes
/
helper.py
File metadata and controls
31 lines (23 loc) · 902 Bytes
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
29
30
31
import os
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 get_openai_api_key():
load_env()
openai_api_key = os.getenv("OPENAI_API_KEY")
return openai_api_key
def get_llama_cloud_api_key():
load_env()
llama_cloud_api_key = os.getenv("LLAMA_CLOUD_API_KEY")
return llama_cloud_api_key
def extract_html_content(filename):
try:
with open(filename, "r") as file:
html_content = file.read()
html_content = f""" <div style="width: 100%; height: 800px; overflow: hidden;"> {html_content} </div>"""
return html_content
except Exception as e:
raise Exception(f"Error reading file: {str(e)}")