feat: support max_retries in jina requests (#6585)

This commit is contained in:
xielong
2024-07-25 13:10:39 +08:00
committed by GitHub
parent 55c2b61921
commit ebcc07e3e9
8 changed files with 129 additions and 20 deletions

View File

@@ -60,11 +60,13 @@ class JinaReaderTool(BuiltinTool):
if tool_parameters.get('no_cache', False):
headers['X-No-Cache'] = 'true'
max_retries = tool_parameters.get('max_retries', 3)
response = ssrf_proxy.get(
str(URL(self._jina_reader_endpoint + url)),
headers=headers,
params=request_params,
timeout=(10, 60),
max_retries=max_retries
)
if tool_parameters.get('summary', False):

View File

@@ -150,3 +150,17 @@ parameters:
pt_BR: Habilitar resumo para a saída
llm_description: enable summary
form: form
- name: max_retries
type: number
required: false
default: 3
label:
en_US: Retry
zh_Hans: 重试
pt_BR: Repetir
human_description:
en_US: Number of times to retry the request if it fails
zh_Hans: 请求失败时重试的次数
pt_BR: Número de vezes para repetir a solicitação se falhar
llm_description: Number of times to retry the request if it fails
form: form

View File

@@ -40,10 +40,12 @@ class JinaSearchTool(BuiltinTool):
if tool_parameters.get('no_cache', False):
headers['X-No-Cache'] = 'true'
max_retries = tool_parameters.get('max_retries', 3)
response = ssrf_proxy.get(
str(URL(self._jina_search_endpoint + query)),
headers=headers,
timeout=(10, 60)
timeout=(10, 60),
max_retries=max_retries
)
return self.create_text_message(response.text)

View File

@@ -91,3 +91,17 @@ parameters:
pt_BR: Ignorar o cache
llm_description: bypass the cache
form: form
- name: max_retries
type: number
required: false
default: 3
label:
en_US: Retry
zh_Hans: 重试
pt_BR: Repetir
human_description:
en_US: Number of times to retry the request if it fails
zh_Hans: 请求失败时重试的次数
pt_BR: Número de vezes para repetir a solicitação se falhar
llm_description: Number of times to retry the request if it fails
form: form