Spaces:
Sleeping
Sleeping
Fix: print openai key
Browse files
utils.py
CHANGED
@@ -6,15 +6,15 @@ from contextlib import contextmanager
|
|
6 |
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
7 |
|
8 |
|
9 |
-
## 处理代理:
|
10 |
-
http_proxy = ""
|
11 |
-
https_proxy = ""
|
12 |
-
http_proxy = os.environ.get("HTTP_PROXY", http_proxy)
|
13 |
-
https_proxy = os.environ.get("HTTPS_PROXY", https_proxy)
|
14 |
|
15 |
-
# 重置系统变量,在不需要设置的时候不设置环境变量,以免引起全局代理报错
|
16 |
-
os.environ["HTTP_PROXY"] = ""
|
17 |
-
os.environ["HTTPS_PROXY"] = ""
|
18 |
|
19 |
# GPT_MODEL = "gpt-3.5-turbo-0613"
|
20 |
GPT_MODEL = "gpt-4"
|
@@ -83,6 +83,7 @@ def chat_completion_request(
|
|
83 |
"Content-Type": "application/json",
|
84 |
"Authorization": "Bearer " + openai.api_key,
|
85 |
}
|
|
|
86 |
json_data = {"model": model, "messages": messages}
|
87 |
if functions is not None:
|
88 |
json_data.update({"functions": functions})
|
|
|
6 |
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
7 |
|
8 |
|
9 |
+
# ## 处理代理:
|
10 |
+
# http_proxy = ""
|
11 |
+
# https_proxy = ""
|
12 |
+
# http_proxy = os.environ.get("HTTP_PROXY", http_proxy)
|
13 |
+
# https_proxy = os.environ.get("HTTPS_PROXY", https_proxy)
|
14 |
|
15 |
+
# # 重置系统变量,在不需要设置的时候不设置环境变量,以免引起全局代理报错
|
16 |
+
# os.environ["HTTP_PROXY"] = ""
|
17 |
+
# os.environ["HTTPS_PROXY"] = ""
|
18 |
|
19 |
# GPT_MODEL = "gpt-3.5-turbo-0613"
|
20 |
GPT_MODEL = "gpt-4"
|
|
|
83 |
"Content-Type": "application/json",
|
84 |
"Authorization": "Bearer " + openai.api_key,
|
85 |
}
|
86 |
+
print(headers)
|
87 |
json_data = {"model": model, "messages": messages}
|
88 |
if functions is not None:
|
89 |
json_data.update({"functions": functions})
|