diff --git a/api/configs/remote_settings_sources/apollo/client.py b/api/configs/remote_settings_sources/apollo/client.py index 03c64ea00f..88b30d3987 100644 --- a/api/configs/remote_settings_sources/apollo/client.py +++ b/api/configs/remote_settings_sources/apollo/client.py @@ -270,7 +270,7 @@ class ApolloClient: while not self._stopping: for namespace in self._notification_map: self._do_heart_beat(namespace) - time.sleep(60 * 10) # 10分钟 + time.sleep(60 * 10) # 10 minutes def _do_heart_beat(self, namespace): url = "{}/configs/{}/{}/{}?ip={}".format(self.config_url, self.app_id, self.cluster, namespace, self.ip) diff --git a/api/core/model_runtime/README_CN.md b/api/core/model_runtime/README_CN.md index 27286ac885..2fc2a60461 100644 --- a/api/core/model_runtime/README_CN.md +++ b/api/core/model_runtime/README_CN.md @@ -10,7 +10,7 @@ - 支持 5 种模型类型的能力调用 - `LLM` - LLM 文本补全、对话,预计算 tokens 能力 - - `Text Embedding Model` - 文本 Embedding ,预计算 tokens 能力 + - `Text Embedding Model` - 文本 Embedding,预计算 tokens 能力 - `Rerank Model` - 分段 Rerank 能力 - `Speech-to-text Model` - 语音转文本能力 - `Text-to-speech Model` - 文本转语音能力 @@ -57,11 +57,11 @@ Model Runtime 分三层: 提供获取当前供应商模型列表、获取模型实例、供应商凭据鉴权、供应商配置规则信息,**可横向扩展**以支持不同的供应商。 对于供应商/模型凭据,有两种情况 - - 如OpenAI这类中心化供应商,需要定义如**api_key**这类的鉴权凭据 + - 如 OpenAI 这类中心化供应商,需要定义如**api_key**这类的鉴权凭据 - 如[**Xinference**](https://github.com/xorbitsai/inference)这类本地部署的供应商,需要定义如**server_url**这类的地址凭据,有时候还需要定义**model_uid**之类的模型类型凭据,就像下面这样,当在供应商层定义了这些凭据后,就可以在前端页面上直接展示,无需修改前端逻辑。 ![Alt text](docs/zh_Hans/images/index/image.png) - 当配置好凭据后,就可以通过DifyRuntime的外部接口直接获取到对应供应商所需要的**Schema**(凭据表单规则),从而在可以在不修改前端逻辑的情况下,提供新的供应商/模型的支持。 + 当配置好凭据后,就可以通过 DifyRuntime 的外部接口直接获取到对应供应商所需要的**Schema**(凭据表单规则),从而在可以在不修改前端逻辑的情况下,提供新的供应商/模型的支持。 - 最底层为模型层 @@ -69,9 +69,9 @@ Model Runtime 分三层: 在这里我们需要先区分模型参数与模型凭据。 - - 模型参数(**在本层定义**):这是一类经常需要变动,随时调整的参数,如 LLM 的 **max_tokens**、**temperature** 等,这些参数是由用户在前端页面上进行调整的,因此需要在后端定义参数的规则,以便前端页面进行展示和调整。在DifyRuntime中,他们的参数名一般为**model_parameters: dict[str, any]**。 + - 模型参数 (**在本层定义**):这是一类经常需要变动,随时调整的参数,如 LLM 的 **max_tokens**、**temperature** 等,这些参数是由用户在前端页面上进行调整的,因此需要在后端定义参数的规则,以便前端页面进行展示和调整。在 DifyRuntime 中,他们的参数名一般为**model_parameters: dict[str, any]**。 - - 模型凭据(**在供应商层定义**):这是一类不经常变动,一般在配置好后就不会再变动的参数,如 **api_key**、**server_url** 等。在DifyRuntime中,他们的参数名一般为**credentials: dict[str, any]**,Provider层的credentials会直接被传递到这一层,不需要再单独定义。 + - 模型凭据 (**在供应商层定义**):这是一类不经常变动,一般在配置好后就不会再变动的参数,如 **api_key**、**server_url** 等。在 DifyRuntime 中,他们的参数名一般为**credentials: dict[str, any]**,Provider 层的 credentials 会直接被传递到这一层,不需要再单独定义。 ## 下一步 @@ -81,7 +81,7 @@ Model Runtime 分三层: ![Alt text](docs/zh_Hans/images/index/image-1.png) ### [为已存在的供应商新增模型 👈🏻](./docs/zh_Hans/provider_scale_out.md#增加模型) -当添加后,对应供应商的模型列表中将会出现一个新的预定义模型供用户选择,如GPT-3.5 GPT-4 ChatGLM3-6b等,而对于支持自定义模型的供应商,则不需要新增模型。 +当添加后,对应供应商的模型列表中将会出现一个新的预定义模型供用户选择,如 GPT-3.5 GPT-4 ChatGLM3-6b 等,而对于支持自定义模型的供应商,则不需要新增模型。 ![Alt text](docs/zh_Hans/images/index/image-2.png) diff --git a/api/core/model_runtime/docs/en_US/customizable_model_scale_out.md b/api/core/model_runtime/docs/en_US/customizable_model_scale_out.md index b5a714a172..2d71e99fce 100644 --- a/api/core/model_runtime/docs/en_US/customizable_model_scale_out.md +++ b/api/core/model_runtime/docs/en_US/customizable_model_scale_out.md @@ -102,12 +102,12 @@ provider_credential_schema: ```yaml - variable: server_url label: - zh_Hans: 服务器URL + zh_Hans: 服务器 URL en_US: Server url type: text-input required: true placeholder: - zh_Hans: 在此输入Xinference的服务器地址,如 https://example.com/xxx + zh_Hans: 在此输入 Xinference 的服务器地址,如 https://example.com/xxx en_US: Enter the url of your Xinference, for example https://example.com/xxx ``` @@ -116,12 +116,12 @@ provider_credential_schema: ```yaml - variable: model_uid label: - zh_Hans: 模型UID + zh_Hans: 模型 UID en_US: Model uid type: text-input required: true placeholder: - zh_Hans: 在此输入您的Model UID + zh_Hans: 在此输入您的 Model UID en_US: Enter the model uid ``` diff --git a/api/core/model_runtime/docs/en_US/interfaces.md b/api/core/model_runtime/docs/en_US/interfaces.md index 3410109cf1..158d4b306b 100644 --- a/api/core/model_runtime/docs/en_US/interfaces.md +++ b/api/core/model_runtime/docs/en_US/interfaces.md @@ -367,7 +367,7 @@ Inherit the `__base.text2speech_model.Text2SpeechModel` base class and implement - Returns: - Text converted speech stream。 + Text converted speech stream. ### Moderation diff --git a/api/core/model_runtime/docs/zh_Hans/customizable_model_scale_out.md b/api/core/model_runtime/docs/zh_Hans/customizable_model_scale_out.md index c36575b9af..88ec6861fe 100644 --- a/api/core/model_runtime/docs/zh_Hans/customizable_model_scale_out.md +++ b/api/core/model_runtime/docs/zh_Hans/customizable_model_scale_out.md @@ -6,14 +6,14 @@ 需要注意的是,对于自定义模型,每一个模型的接入都需要填写一个完整的供应商凭据。 -而不同于预定义模型,自定义供应商接入时永远会拥有如下两个参数,不需要在供应商yaml中定义。 +而不同于预定义模型,自定义供应商接入时永远会拥有如下两个参数,不需要在供应商 yaml 中定义。 ![Alt text](images/index/image-3.png) -在前文中,我们已经知道了供应商无需实现`validate_provider_credential`,Runtime会自行根据用户在此选择的模型类型和模型名称调用对应的模型层的`validate_credentials`来进行验证。 +在前文中,我们已经知道了供应商无需实现`validate_provider_credential`,Runtime 会自行根据用户在此选择的模型类型和模型名称调用对应的模型层的`validate_credentials`来进行验证。 -### 编写供应商yaml +### 编写供应商 yaml 我们首先要确定,接入的这个供应商支持哪些类型的模型。 @@ -26,7 +26,7 @@ - `tts` 文字转语音 - `moderation` 审查 -`Xinference`支持`LLM`和`Text Embedding`和Rerank,那么我们开始编写`xinference.yaml`。 +`Xinference`支持`LLM`和`Text Embedding`和 Rerank,那么我们开始编写`xinference.yaml`。 ```yaml provider: xinference #确定供应商标识 @@ -42,17 +42,17 @@ help: # 帮助 zh_Hans: 如何部署 Xinference url: en_US: https://github.com/xorbitsai/inference -supported_model_types: # 支持的模型类型,Xinference同时支持LLM/Text Embedding/Rerank +supported_model_types: # 支持的模型类型,Xinference 同时支持 LLM/Text Embedding/Rerank - llm - text-embedding - rerank -configurate_methods: # 因为Xinference为本地部署的供应商,并且没有预定义模型,需要用什么模型需要根据Xinference的文档自己部署,所以这里只支持自定义模型 +configurate_methods: # 因为 Xinference 为本地部署的供应商,并且没有预定义模型,需要用什么模型需要根据 Xinference 的文档自己部署,所以这里只支持自定义模型 - customizable-model provider_credential_schema: credential_form_schemas: ``` -随后,我们需要思考在Xinference中定义一个模型需要哪些凭据 +随后,我们需要思考在 Xinference 中定义一个模型需要哪些凭据 - 它支持三种不同的模型,因此,我们需要有`model_type`来指定这个模型的类型,它有三种类型,所以我们这么编写 ```yaml @@ -88,28 +88,28 @@ provider_credential_schema: zh_Hans: 填写模型名称 en_US: Input model name ``` -- 填写Xinference本地部署的地址 +- 填写 Xinference 本地部署的地址 ```yaml - variable: server_url label: - zh_Hans: 服务器URL + zh_Hans: 服务器 URL en_US: Server url type: text-input required: true placeholder: - zh_Hans: 在此输入Xinference的服务器地址,如 https://example.com/xxx + zh_Hans: 在此输入 Xinference 的服务器地址,如 https://example.com/xxx en_US: Enter the url of your Xinference, for example https://example.com/xxx ``` -- 每个模型都有唯一的model_uid,因此需要在这里定义 +- 每个模型都有唯一的 model_uid,因此需要在这里定义 ```yaml - variable: model_uid label: - zh_Hans: 模型UID + zh_Hans: 模型 UID en_US: Model uid type: text-input required: true placeholder: - zh_Hans: 在此输入您的Model UID + zh_Hans: 在此输入您的 Model UID en_US: Enter the model uid ``` 现在,我们就完成了供应商的基础定义。 @@ -145,7 +145,7 @@ provider_credential_schema: """ ``` - 在实现时,需要注意使用两个函数来返回数据,分别用于处理同步返回和流式返回,因为Python会将函数中包含 `yield` 关键字的函数识别为生成器函数,返回的数据类型固定为 `Generator`,因此同步和流式返回需要分别实现,就像下面这样(注意下面例子使用了简化参数,实际实现时需要按照上面的参数列表进行实现): + 在实现时,需要注意使用两个函数来返回数据,分别用于处理同步返回和流式返回,因为 Python 会将函数中包含 `yield` 关键字的函数识别为生成器函数,返回的数据类型固定为 `Generator`,因此同步和流式返回需要分别实现,就像下面这样(注意下面例子使用了简化参数,实际实现时需要按照上面的参数列表进行实现): ```python def _invoke(self, stream: bool, **kwargs) \ @@ -179,7 +179,7 @@ provider_credential_schema: """ ``` - 有时候,也许你不需要直接返回0,所以你可以使用`self._get_num_tokens_by_gpt2(text: str)`来获取预计算的tokens,并确保环境变量`PLUGIN_BASED_TOKEN_COUNTING_ENABLED`设置为`true`,这个方法位于`AIModel`基类中,它会使用GPT2的Tokenizer进行计算,但是只能作为替代方法,并不完全准确。 + 有时候,也许你不需要直接返回 0,所以你可以使用`self._get_num_tokens_by_gpt2(text: str)`来获取预计算的 tokens,并确保环境变量`PLUGIN_BASED_TOKEN_COUNTING_ENABLED`设置为`true`,这个方法位于`AIModel`基类中,它会使用 GPT2 的 Tokenizer 进行计算,但是只能作为替代方法,并不完全准确。 - 模型凭据校验 @@ -196,13 +196,13 @@ provider_credential_schema: """ ``` -- 模型参数Schema +- 模型参数 Schema - 与自定义类型不同,由于没有在yaml文件中定义一个模型支持哪些参数,因此,我们需要动态时间模型参数的Schema。 + 与自定义类型不同,由于没有在 yaml 文件中定义一个模型支持哪些参数,因此,我们需要动态时间模型参数的 Schema。 - 如Xinference支持`max_tokens` `temperature` `top_p` 这三个模型参数。 + 如 Xinference 支持`max_tokens` `temperature` `top_p` 这三个模型参数。 - 但是有的供应商根据不同的模型支持不同的参数,如供应商`OpenLLM`支持`top_k`,但是并不是这个供应商提供的所有模型都支持`top_k`,我们这里举例A模型支持`top_k`,B模型不支持`top_k`,那么我们需要在这里动态生成模型参数的Schema,如下所示: + 但是有的供应商根据不同的模型支持不同的参数,如供应商`OpenLLM`支持`top_k`,但是并不是这个供应商提供的所有模型都支持`top_k`,我们这里举例 A 模型支持`top_k`,B 模型不支持`top_k`,那么我们需要在这里动态生成模型参数的 Schema,如下所示: ```python def get_customizable_model_schema(self, model: str, credentials: dict) -> Optional[AIModelEntity]: diff --git a/api/core/model_runtime/docs/zh_Hans/interfaces.md b/api/core/model_runtime/docs/zh_Hans/interfaces.md index f86068ac99..93a48cafb8 100644 --- a/api/core/model_runtime/docs/zh_Hans/interfaces.md +++ b/api/core/model_runtime/docs/zh_Hans/interfaces.md @@ -687,7 +687,7 @@ class LLMUsage(ModelUsage): total_tokens: int # 总使用 token 数 total_price: Decimal # 总费用 currency: str # 货币单位 - latency: float # 请求耗时(s) + latency: float # 请求耗时 (s) ``` --- @@ -717,7 +717,7 @@ class EmbeddingUsage(ModelUsage): price_unit: Decimal # 价格单位,即单价基于多少 tokens total_price: Decimal # 总费用 currency: str # 货币单位 - latency: float # 请求耗时(s) + latency: float # 请求耗时 (s) ``` --- diff --git a/api/core/model_runtime/docs/zh_Hans/predefined_model_scale_out.md b/api/core/model_runtime/docs/zh_Hans/predefined_model_scale_out.md index 17fc088a63..b33dc7c94b 100644 --- a/api/core/model_runtime/docs/zh_Hans/predefined_model_scale_out.md +++ b/api/core/model_runtime/docs/zh_Hans/predefined_model_scale_out.md @@ -95,7 +95,7 @@ pricing: # 价格信息 """ ``` - 在实现时,需要注意使用两个函数来返回数据,分别用于处理同步返回和流式返回,因为Python会将函数中包含 `yield` 关键字的函数识别为生成器函数,返回的数据类型固定为 `Generator`,因此同步和流式返回需要分别实现,就像下面这样(注意下面例子使用了简化参数,实际实现时需要按照上面的参数列表进行实现): + 在实现时,需要注意使用两个函数来返回数据,分别用于处理同步返回和流式返回,因为 Python 会将函数中包含 `yield` 关键字的函数识别为生成器函数,返回的数据类型固定为 `Generator`,因此同步和流式返回需要分别实现,就像下面这样(注意下面例子使用了简化参数,实际实现时需要按照上面的参数列表进行实现): ```python def _invoke(self, stream: bool, **kwargs) \ diff --git a/api/core/model_runtime/docs/zh_Hans/provider_scale_out.md b/api/core/model_runtime/docs/zh_Hans/provider_scale_out.md index 78aad8876f..2048b506ac 100644 --- a/api/core/model_runtime/docs/zh_Hans/provider_scale_out.md +++ b/api/core/model_runtime/docs/zh_Hans/provider_scale_out.md @@ -8,13 +8,13 @@ - `customizable-model` 自定义模型 - 用户需要新增每个模型的凭据配置,如Xinference,它同时支持 LLM 和 Text Embedding,但是每个模型都有唯一的**model_uid**,如果想要将两者同时接入,就需要为每个模型配置一个**model_uid**。 + 用户需要新增每个模型的凭据配置,如 Xinference,它同时支持 LLM 和 Text Embedding,但是每个模型都有唯一的**model_uid**,如果想要将两者同时接入,就需要为每个模型配置一个**model_uid**。 - `fetch-from-remote` 从远程获取 与 `predefined-model` 配置方式一致,只需要配置统一的供应商凭据即可,模型通过凭据信息从供应商获取。 - 如OpenAI,我们可以基于gpt-turbo-3.5来Fine Tune多个模型,而他们都位于同一个**api_key**下,当配置为 `fetch-from-remote` 时,开发者只需要配置统一的**api_key**即可让DifyRuntime获取到开发者所有的微调模型并接入Dify。 + 如 OpenAI,我们可以基于 gpt-turbo-3.5 来 Fine Tune 多个模型,而他们都位于同一个**api_key**下,当配置为 `fetch-from-remote` 时,开发者只需要配置统一的**api_key**即可让 DifyRuntime 获取到开发者所有的微调模型并接入 Dify。 这三种配置方式**支持共存**,即存在供应商支持 `predefined-model` + `customizable-model` 或 `predefined-model` + `fetch-from-remote` 等,也就是配置了供应商统一凭据可以使用预定义模型和从远程获取的模型,若新增了模型,则可以在此基础上额外使用自定义的模型。 @@ -23,16 +23,16 @@ ### 介绍 #### 名词解释 - - `module`: 一个`module`即为一个Python Package,或者通俗一点,称为一个文件夹,里面包含了一个`__init__.py`文件,以及其他的`.py`文件。 + - `module`: 一个`module`即为一个 Python Package,或者通俗一点,称为一个文件夹,里面包含了一个`__init__.py`文件,以及其他的`.py`文件。 #### 步骤 新增一个供应商主要分为几步,这里简单列出,帮助大家有一个大概的认识,具体的步骤会在下面详细介绍。 -- 创建供应商yaml文件,根据[ProviderSchema](./schema.md#provider)编写 +- 创建供应商 yaml 文件,根据[ProviderSchema](./schema.md#provider)编写 - 创建供应商代码,实现一个`class`。 - 根据模型类型,在供应商`module`下创建对应的模型类型 `module`,如`llm`或`text_embedding`。 - 根据模型类型,在对应的模型`module`下创建同名的代码文件,如`llm.py`,并实现一个`class`。 -- 如果有预定义模型,根据模型名称创建同名的yaml文件在模型`module`下,如`claude-2.1.yaml`,根据[AIModelEntity](./schema.md#aimodelentity)编写。 +- 如果有预定义模型,根据模型名称创建同名的 yaml 文件在模型`module`下,如`claude-2.1.yaml`,根据[AIModelEntity](./schema.md#aimodelentity)编写。 - 编写测试代码,确保功能可用。 ### 开始吧 @@ -121,11 +121,11 @@ model_credential_schema: #### 实现供应商代码 -我们需要在`model_providers`下创建一个同名的python文件,如`anthropic.py`,并实现一个`class`,继承`__base.provider.Provider`基类,如`AnthropicProvider`。 +我们需要在`model_providers`下创建一个同名的 python 文件,如`anthropic.py`,并实现一个`class`,继承`__base.provider.Provider`基类,如`AnthropicProvider`。 ##### 自定义模型供应商 -当供应商为Xinference等自定义模型供应商时,可跳过该步骤,仅创建一个空的`XinferenceProvider`类即可,并实现一个空的`validate_provider_credentials`方法,该方法并不会被实际使用,仅用作避免抽象类无法实例化。 +当供应商为 Xinference 等自定义模型供应商时,可跳过该步骤,仅创建一个空的`XinferenceProvider`类即可,并实现一个空的`validate_provider_credentials`方法,该方法并不会被实际使用,仅用作避免抽象类无法实例化。 ```python class XinferenceProvider(Provider): @@ -155,7 +155,7 @@ def validate_provider_credentials(self, credentials: dict) -> None: #### 增加模型 #### [增加预定义模型 👈🏻](./predefined_model_scale_out.md) -对于预定义模型,我们可以通过简单定义一个yaml,并通过实现调用代码来接入。 +对于预定义模型,我们可以通过简单定义一个 yaml,并通过实现调用代码来接入。 #### [增加自定义模型 👈🏻](./customizable_model_scale_out.md) 对于自定义模型,我们只需要实现调用代码即可接入,但是它需要处理的参数可能会更加复杂。 diff --git a/api/core/model_runtime/entities/defaults.py b/api/core/model_runtime/entities/defaults.py index 4d0c9aa08f..76969fea70 100644 --- a/api/core/model_runtime/entities/defaults.py +++ b/api/core/model_runtime/entities/defaults.py @@ -29,7 +29,7 @@ PARAMETER_RULE_TEMPLATE: dict[DefaultParameterName, dict] = { "help": { "en_US": "Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options" " are considered.", - "zh_Hans": "通过核心采样控制多样性:0.5表示考虑了一半的所有可能性加权选项。", + "zh_Hans": "通过核心采样控制多样性:0.5 表示考虑了一半的所有可能性加权选项。", }, "required": False, "default": 1.0, @@ -111,7 +111,7 @@ PARAMETER_RULE_TEMPLATE: dict[DefaultParameterName, dict] = { "help": { "en_US": "Set a response format, ensure the output from llm is a valid code block as possible," " such as JSON, XML, etc.", - "zh_Hans": "设置一个返回格式,确保llm的输出尽可能是有效的代码块,如JSON、XML等", + "zh_Hans": "设置一个返回格式,确保 llm 的输出尽可能是有效的代码块,如 JSON、XML 等", }, "required": False, "options": ["JSON", "XML"], @@ -123,7 +123,7 @@ PARAMETER_RULE_TEMPLATE: dict[DefaultParameterName, dict] = { "type": "text", "help": { "en_US": "Set a response json schema will ensure LLM to adhere it.", - "zh_Hans": "设置返回的json schema,llm将按照它返回", + "zh_Hans": "设置返回的 json schema,llm 将按照它返回", }, "required": False, }, diff --git a/api/core/prompt/prompt_templates/advanced_prompt_templates.py b/api/core/prompt/prompt_templates/advanced_prompt_templates.py index e55966eeee..cfe38bfc6b 100644 --- a/api/core/prompt/prompt_templates/advanced_prompt_templates.py +++ b/api/core/prompt/prompt_templates/advanced_prompt_templates.py @@ -28,7 +28,7 @@ BAICHUAN_CHAT_APP_COMPLETION_PROMPT_CONFIG = { }, "conversation_histories_role": {"user_prefix": "用户", "assistant_prefix": "助手"}, }, - "stop": ["用户:"], + "stop": ["用户:"], } BAICHUAN_CHAT_APP_CHAT_PROMPT_CONFIG = { @@ -41,5 +41,5 @@ BAICHUAN_COMPLETION_APP_CHAT_PROMPT_CONFIG = { BAICHUAN_COMPLETION_APP_COMPLETION_PROMPT_CONFIG = { "completion_prompt_config": {"prompt": {"text": "{{#pre_prompt#}}"}}, - "stop": ["用户:"], + "stop": ["用户:"], } diff --git a/api/core/rag/datasource/vdb/oracle/oraclevector.py b/api/core/rag/datasource/vdb/oracle/oraclevector.py index 143dfb3258..9e0360069f 100644 --- a/api/core/rag/datasource/vdb/oracle/oraclevector.py +++ b/api/core/rag/datasource/vdb/oracle/oraclevector.py @@ -239,7 +239,7 @@ class OracleVector(BaseVector): words = pseg.cut(query) current_entity = "" for word, pos in words: - if pos in {"nr", "Ng", "eng", "nz", "n", "ORG", "v"}: # nr: 人名, ns: 地名, nt: 机构名 + if pos in {"nr", "Ng", "eng", "nz", "n", "ORG", "v"}: # nr: 人名,ns: 地名,nt: 机构名 current_entity += word else: if current_entity: diff --git a/api/core/tools/builtin_tool/providers/code/tools/simple_code.yaml b/api/core/tools/builtin_tool/providers/code/tools/simple_code.yaml index 0f51674987..7d2bf9301c 100644 --- a/api/core/tools/builtin_tool/providers/code/tools/simple_code.yaml +++ b/api/core/tools/builtin_tool/providers/code/tools/simple_code.yaml @@ -8,7 +8,7 @@ identity: description: human: en_US: Run code and get the result back. When you're using a lower quality model, please make sure there are some tips help LLM to understand how to write the code. - zh_Hans: 运行一段代码并返回结果。当您使用较低质量的模型时,请确保有一些提示帮助LLM理解如何编写代码。 + zh_Hans: 运行一段代码并返回结果。当您使用较低质量的模型时,请确保有一些提示帮助 LLM 理解如何编写代码。 pt_BR: Execute um trecho de código e obtenha o resultado de volta. quando você estiver usando um modelo de qualidade inferior, certifique-se de que existam algumas dicas para ajudar o LLM a entender como escrever o código. llm: A tool for running code and getting the result back. Only native packages are allowed, network/IO operations are disabled. and you must use print() or console.log() to output the result or result will be empty. parameters: diff --git a/api/core/tools/builtin_tool/providers/time/tools/localtime_to_timestamp.yaml b/api/core/tools/builtin_tool/providers/time/tools/localtime_to_timestamp.yaml index 6a3b90595f..e7fed846c8 100644 --- a/api/core/tools/builtin_tool/providers/time/tools/localtime_to_timestamp.yaml +++ b/api/core/tools/builtin_tool/providers/time/tools/localtime_to_timestamp.yaml @@ -19,7 +19,7 @@ parameters: zh_Hans: 本地时间 human_description: en_US: localtime, such as 2024-1-1 0:0:0 - zh_Hans: 本地时间, 比如2024-1-1 0:0:0 + zh_Hans: 本地时间,比如 2024-1-1 0:0:0 - name: timezone type: string required: false @@ -29,5 +29,5 @@ parameters: zh_Hans: 时区 human_description: en_US: Timezone, such as Asia/Shanghai - zh_Hans: 时区, 比如Asia/Shanghai + zh_Hans: 时区,比如 Asia/Shanghai default: Asia/Shanghai diff --git a/api/core/tools/builtin_tool/providers/time/tools/timestamp_to_localtime.yaml b/api/core/tools/builtin_tool/providers/time/tools/timestamp_to_localtime.yaml index 3794e717b4..c13a4556cc 100644 --- a/api/core/tools/builtin_tool/providers/time/tools/timestamp_to_localtime.yaml +++ b/api/core/tools/builtin_tool/providers/time/tools/timestamp_to_localtime.yaml @@ -29,5 +29,5 @@ parameters: zh_Hans: 时区 human_description: en_US: Timezone, such as Asia/Shanghai - zh_Hans: 时区, 比如Asia/Shanghai + zh_Hans: 时区,比如 Asia/Shanghai default: Asia/Shanghai diff --git a/api/core/tools/builtin_tool/providers/time/tools/timezone_conversion.yaml b/api/core/tools/builtin_tool/providers/time/tools/timezone_conversion.yaml index 4c221c2e51..bc383cd74a 100644 --- a/api/core/tools/builtin_tool/providers/time/tools/timezone_conversion.yaml +++ b/api/core/tools/builtin_tool/providers/time/tools/timezone_conversion.yaml @@ -19,7 +19,7 @@ parameters: zh_Hans: 当前时间 human_description: en_US: current time, such as 2024-1-1 0:0:0 - zh_Hans: 当前时间, 比如2024-1-1 0:0:0 + zh_Hans: 当前时间,比如 2024-1-1 0:0:0 - name: current_timezone type: string required: true @@ -29,7 +29,7 @@ parameters: zh_Hans: 当前时区 human_description: en_US: Current Timezone, such as Asia/Shanghai - zh_Hans: 当前时区, 比如Asia/Shanghai + zh_Hans: 当前时区,比如 Asia/Shanghai default: Asia/Shanghai - name: target_timezone type: string @@ -40,5 +40,5 @@ parameters: zh_Hans: 目标时区 human_description: en_US: Target Timezone, such as Asia/Tokyo - zh_Hans: 目标时区, 比如Asia/Tokyo + zh_Hans: 目标时区,比如 Asia/Tokyo default: Asia/Tokyo diff --git a/api/core/tools/custom_tool/provider.py b/api/core/tools/custom_tool/provider.py index bfceb6679b..3137d32013 100644 --- a/api/core/tools/custom_tool/provider.py +++ b/api/core/tools/custom_tool/provider.py @@ -59,7 +59,7 @@ class ApiToolProviderController(ToolProviderController): name="api_key_value", required=True, type=ProviderConfig.Type.SECRET_INPUT, - help=I18nObject(en_US="The api key", zh_Hans="api key的值"), + help=I18nObject(en_US="The api key", zh_Hans="api key 的值"), ), ProviderConfig( name="api_key_header_prefix", diff --git a/api/tests/integration_tests/vdb/tidb_vector/check_tiflash_ready.py b/api/tests/integration_tests/vdb/tidb_vector/check_tiflash_ready.py index 294a168310..f76700aa0e 100644 --- a/api/tests/integration_tests/vdb/tidb_vector/check_tiflash_ready.py +++ b/api/tests/integration_tests/vdb/tidb_vector/check_tiflash_ready.py @@ -45,7 +45,7 @@ def main(): if is_tiflash_ready: break else: - print(f"Attempt {attempt + 1} failed,retry in {retry_interval_seconds} seconds...") + print(f"Attempt {attempt + 1} failed, retry in {retry_interval_seconds} seconds...") time.sleep(retry_interval_seconds) if is_tiflash_ready: