This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| import time | |
| import requests | |
| import openai | |
| import tiktoken | |
| from termcolor import colored | |
| openai.api_key = os.getenv('OPENAI_API_KEY') | |
| USE_GPT_4_32K = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import requests | |
| from bs4 import BeautifulSoup | |
| import PyPDF2 | |
| # Convert PDF to text | |
| def pdf2text(pdf_path): | |
| with open(pdf_path, "rb") as f: | |
| pdf_reader = PyPDF2.PdfReader(f) | |
| text = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| import requests | |
| import feedparser | |
| from bs4 import BeautifulSoup | |
| from urllib.parse import urlparse | |
| def save_text_file(content, filename): | |
| with open(filename, 'w') as file: | |
| file.write(content) |