lower openai version in requirements.txt (#1747)

### What problem does this PR solve?

lower openai version in requirements.txt

### Type of change

- [x] Refactoring

Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
This commit is contained in:
黄腾 2024-07-30 16:55:59 +08:00 committed by GitHub
parent ceb0419fe5
commit 5cff780ec4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -180,13 +180,18 @@ class BaiChuanChat(Base):
stream=True,
**self._format_params(gen_conf))
for resp in response:
if resp.choices[0].finish_reason == "stop":
if not resp.choices:continue
if not resp.choices[0].delta.content:
continue
total_tokens = resp.usage.total_tokens
if not resp.choices[0].delta.content:
continue
resp.choices[0].delta.content = ""
ans += resp.choices[0].delta.content
total_tokens = (
(
total_tokens
+ num_tokens_from_string(resp.choices[0].delta.content)
)
if not hasattr(resp, "usage")
else resp.usage["total_tokens"]
)
if resp.choices[0].finish_reason == "length":
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(
[ans]) else "······\n由于长度的原因,回答被截断了,要继续吗?"

View File

@ -39,7 +39,7 @@ numpy==1.26.4
ollama==0.2.1
onnxruntime==1.17.3
onnxruntime_gpu==1.17.1
openai==1.35.14
openai==1.12.0
opencv_python==4.9.0.80
opencv_python_headless==4.9.0.80
openpyxl==3.1.2