Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: Add Optional API Key, Proxy Server, and Bypass Cache Parameters to Jina Tools (#5197)
Jaxon Ley337bad852518
diff --git a/api/core/tools/provider/builtin/jina/jina.py b/api/core/tools/provider/builtin/jina/jina.pyindex b1a8d621380..12e5058cdc9 100644--- a/api/core/tools/provider/builtin/jina/jina.py+++ b/api/core/tools/provider/builtin/jina/jina.py@@ -1,14 +1,32 @@+import jsonfrom typing import Anyfrom core.tools.entities.values import ToolLabelEnumfrom core.tools.errors import ToolProviderCredentialValidationError+from core.tools.provider.builtin.jina.tools.jina_reader import JinaReaderToolfrom core.tools.provider.builtin_tool_provider import BuiltinToolProviderControllerclass GoogleProvider(BuiltinToolProviderController):def _validate_credentials(self, credentials: dict[str, Any]) -> None:try:- pass+ if credentials['api_key'] is None:+ credentials['api_key'] = ''+ else:+ result = JinaReaderTool().fork_tool_runtime(+ runtime={+ "credentials": credentials,+ }+ ).invoke(+ user_id='',+ tool_parameters={+ "url": "https://example.com",+ },+ )[0]++ message = json.loads(result.message)+ if message['code'] != 200:+ raise ToolProviderCredentialValidationError(message['message'])except Exception as e:raise ToolProviderCredentialValidationError(str(e))diff --git a/api/core/tools/provider/builtin/jina/jina.yaml b/api/core/tools/provider/builtin/jina/jina.yamlindex 67ad32a47a1..06f23382d92 100644--- a/api/core/tools/provider/builtin/jina/jina.yaml+++ b/api/core/tools/provider/builtin/jina/jina.yaml@@ -14,3 +14,19 @@ identity:- search- productivitycredentials_for_provider:+ api_key:+ type: secret-input+ required: false+ label:+ en_US: API Key (leave empty if you don't have one)+ zh_Hans: API 密钥(可留空)+ pt_BR: Chave API (deixe vazio se você não tiver uma)+ placeholder:+ en_US: Please enter your Jina API key+ zh_Hans: 请输入你的 Jina API 密钥+ pt_BR: Por favor, insira sua chave de API do Jina+ help:+ en_US: Get your Jina API key from Jina (optional, but you can get a higher rate)+ zh_Hans: 从 Jina 获取您的 Jina API 密钥(非必须,能得到更高的速率)+ pt_BR: Obtenha sua chave de API do Jina na Jina (opcional, mas você pode obter uma taxa mais alta)+ url: https://jina.aidiff --git a/api/core/tools/provider/builtin/jina/tools/jina_reader.py b/api/core/tools/provider/builtin/jina/tools/jina_reader.pyindex beb05717ea1..b0bd4788466 100644--- a/api/core/tools/provider/builtin/jina/tools/jina_reader.py+++ b/api/core/tools/provider/builtin/jina/tools/jina_reader.py@@ -23,14 +23,24 @@ class JinaReaderTool(BuiltinTool):'Accept': 'application/json'}+ if 'api_key' in self.runtime.credentials and self.runtime.credentials.get('api_key'):+ headers['Authorization'] = "Bearer " + self.runtime.credentials.get('api_key')+target_selector = tool_parameters.get('target_selector', None)- if target_selector is not None:+ if target_selector is not None and target_selector != '':headers['X-Target-Selector'] = target_selectorwait_for_selector = tool_parameters.get('wait_for_selector', None)- if wait_for_selector is not None:+ if wait_for_selector is not None and wait_for_selector != '':headers['X-Wait-For-Selector'] = wait_for_selector+ proxy_server = tool_parameters.get('proxy_server', None)+ if proxy_server is not None and proxy_server != '':+ headers['X-Proxy-Url'] = proxy_server++ if tool_parameters.get('no_cache', False):+ headers['X-No-Cache'] = 'true'+response = ssrf_proxy.get(str(URL(self._jina_reader_endpoint + url)),headers=headers,diff --git a/api/core/tools/provider/builtin/jina/tools/jina_reader.yaml b/api/core/tools/provider/builtin/jina/tools/jina_reader.yamlindex 73cacb7fde1..703fa3d389a 100644--- a/api/core/tools/provider/builtin/jina/tools/jina_reader.yaml+++ b/api/core/tools/provider/builtin/jina/tools/jina_reader.yaml@@ -51,6 +51,33 @@ parameters:pt_BR: css selector for waiting for specific elementsllm_description: css selector of the target element to wait forform: form+ - name: proxy_server+ type: string+ required: false+ label:+ en_US: Proxy server+ zh_Hans: 代理服务器+ pt_BR: Servidor de proxy+ human_description:+ en_US: Use proxy to access URLs+ zh_Hans: 利用代理访问 URL+ pt_BR: Use proxy to access URLs+ llm_description: Use proxy to access URLs+ form: form+ - name: no_cache+ type: boolean+ required: false+ default: false+ label:+ en_US: Bypass the Cache+ zh_Hans: 绕过缓存+ pt_BR: Ignorar o cache+ human_description:+ en_US: Bypass the Cache+ zh_Hans: 是否绕过缓存+ pt_BR: Ignorar o cache+ llm_description: bypass the cache+ form: form- name: summarytype: booleanrequired: falsediff --git a/api/core/tools/provider/builtin/jina/tools/jina_search.py b/api/core/tools/provider/builtin/jina/tools/jina_search.pyindex cfe36e6a3ce..c13f58d0cd1 100644--- a/api/core/tools/provider/builtin/jina/tools/jina_search.py+++ b/api/core/tools/provider/builtin/jina/tools/jina_search.py@@ -21,6 +21,16 @@ class JinaSearchTool(BuiltinTool):'Accept': 'application/json'}+ if 'api_key' in self.runtime.credentials and self.runtime.credentials.get('api_key'):+ headers['Authorization'] = "Bearer " + self.runtime.credentials.get('api_key')++ proxy_server = tool_parameters.get('proxy_server', None)+ if proxy_server is not None and proxy_server != '':+ headers['X-Proxy-Url'] = proxy_server++ if tool_parameters.get('no_cache', False):+ headers['X-No-Cache'] = 'true'+response = ssrf_proxy.get(str(URL(self._jina_search_endpoint + query)),headers=headers,diff --git a/api/core/tools/provider/builtin/jina/tools/jina_search.yaml b/api/core/tools/provider/builtin/jina/tools/jina_search.yamlindex 5ad70c03f3b..f3b6c0737a9 100644--- a/api/core/tools/provider/builtin/jina/tools/jina_search.yaml+++ b/api/core/tools/provider/builtin/jina/tools/jina_search.yaml@@ -8,6 +8,7 @@ identity:description:human:en_US: Search on the web and get the top 5 results. Useful for grounding using information from the web.+ zh_Hans: 在网络上搜索返回前 5 个结果。llm: A tool for searching results on the web for grounding. Input should be a simple question.parameters:- name: query@@ -15,7 +16,36 @@ parameters:required: truelabel:en_US: Question (Query)+ zh_Hans: 信息查询human_description:en_US: used to find information on the web+ zh_Hans: 在网络上搜索信息llm_description: simple question to ask on the webform: llm+ - name: proxy_server+ type: string+ required: false+ label:+ en_US: Proxy server+ zh_Hans: 代理服务器+ pt_BR: Servidor de proxy+ human_description:+ en_US: Use proxy to access URLs+ zh_Hans: 利用代理访问 URL+ pt_BR: Use proxy to access URLs+ llm_description: Use proxy to access URLs+ form: form+ - name: no_cache+ type: boolean+ required: false+ default: false+ label:+ en_US: Bypass the Cache+ zh_Hans: 绕过缓存+ pt_BR: Ignorar o cache+ human_description:+ en_US: Bypass the Cache+ zh_Hans: 是否绕过缓存+ pt_BR: Ignorar o cache+ llm_description: bypass the cache+ form: form