Skip to content

Commit

Permalink
explicitly declare default value
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Oct 15, 2024
1 parent b8e8457 commit 074b3c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion request_llms/bridge_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,13 @@ def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[],
if (time.time()-observe_window[1]) > watch_dog_patience:
raise RuntimeError("用户取消了程序。")
else: raise RuntimeError("意外Json结构:"+delta)
finish_reason = json_data.get('finish_reason') if json_data else None

finish_reason = json_data.get('finish_reason', None) if json_data else None
if finish_reason == 'content_filter':
raise RuntimeError("由于提问含不合规内容被过滤。")
if finish_reason == 'length':
raise ConnectionAbortedError("正常结束,但显示Token不足,导致输出不完整,请削减单次输入的文本量。")

return result


Expand Down

0 comments on commit 074b3c9

Please sign in to comment.