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, json, re | |
| from collections import OrderedDict | |
| def extract_names_and_texts(directory): | |
| names = [] | |
| texts = [] | |
| seen_names = set() # ε»ι | |
| seen_texts = set() | |
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 openai, time | |
| openai.api_base = "https://api.openai.com/v1" | |
| openai.api_key = "your_key" | |
| model_engine = "gpt-3.5-turbo-1106" | |
| def chat_with_gpt_streaming(prompt): | |
| try: | |
| response = openai.ChatCompletion.create( | |
| model=model_engine, |