优化代码
This commit is contained in:
@@ -240,11 +240,15 @@ class OpenAiLLM:
|
||||
|
||||
self._kwargs = kwargs
|
||||
|
||||
def invoke(self, user_prompt="你是谁?", need_retry=True):
|
||||
def invoke(self, user_prompt="你是谁?", need_retry=True,**extra_kwargs):
|
||||
# 初始化 OpenAI 客户端
|
||||
|
||||
max_retries = 3
|
||||
retry_count = 0
|
||||
# 合并额外的kwargs与self._kwargs
|
||||
kwargs = {**self._kwargs}
|
||||
if extra_kwargs:
|
||||
kwargs.update(extra_kwargs)
|
||||
if "timeout" not in self._kwargs:
|
||||
timeout = httpx.Timeout(300.0)
|
||||
self._kwargs["timeout"] = timeout
|
||||
|
||||
Reference in New Issue
Block a user