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 model for 01.ai, yi-chat-34b series (#2865)
Su Yangf770232b63cf
diff --git a/api/core/model_runtime/model_providers/_position.yaml b/api/core/model_runtime/model_providers/_position.yamlindex 2dcdc1bf2eb..97116978cdc 100644--- a/api/core/model_runtime/model_providers/_position.yaml+++ b/api/core/model_runtime/model_providers/_position.yaml@@ -20,6 +20,7 @@- jina- chatglm- xinference+- yi- openllm- localai- openai_api_compatiblediff --git a/api/core/model_runtime/model_providers/yi/__init__.py b/api/core/model_runtime/model_providers/yi/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/api/core/model_runtime/model_providers/yi/_assets/icon_l_en.svg b/api/core/model_runtime/model_providers/yi/_assets/icon_l_en.svgnew file mode 100644index 00000000000..0efce4e85b3--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/_assets/icon_l_en.svg@@ -0,0 +1,20 @@+<svg width="80" height="22" viewBox="0 0 450 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <circle cx="300" cy="300" r="300" style="fill:rgb(0,52,37);"/>+ </g>+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <path d="M452.119,361.224C452.119,349.527 442.623,340.031 430.926,340.031C419.229,340.031 409.733,349.527 409.733,361.224L409.733,470.486C409.733,482.183 419.229,491.679 430.926,491.679C442.623,491.679 452.119,482.183 452.119,470.486L452.119,361.224Z" style="fill:white;"/>+ </g>+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <path d="M422.005,133.354C413.089,125.771 399.714,126.851 392.131,135.767L273.699,275.021C270.643,278.614 268.994,282.932 268.698,287.302C268.532,288.371 268.446,289.466 268.446,290.581L268.446,468.603C268.446,480.308 277.934,489.796 289.639,489.796C301.344,489.796 310.832,480.308 310.832,468.603L310.832,296.784L424.419,163.228C432.002,154.312 430.921,140.937 422.005,133.354Z" style="fill:white;"/>+ </g>+ <g transform="matrix(0.13359,-0.109514,0.109514,0.13359,-0.630793,25.9151)">+ <path d="M156.358,155.443C156.358,143.746 146.862,134.25 135.165,134.25C123.468,134.25 113.972,143.746 113.972,155.443L113.972,287.802C113.972,299.499 123.468,308.995 135.165,308.995C146.862,308.995 156.358,299.499 156.358,287.802L156.358,155.443Z" style="fill:white;"/>+ </g>+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <circle cx="460.126" cy="279.278" r="25.903" style="fill:rgb(0,255,37);"/>+ </g>+ <g transform="matrix(1,0,0,1,-77.4848,13.0849)">+ <text x="210.275px" y="74.595px" style="font-family:'AlibabaPuHuiTi_3_55_Regular', 'Alibaba PuHuiTi 3.0', serif;font-size:80px;">01<tspan x="294.355px " y="74.595px ">.</tspan>AI</text>+ </g>+</svg>diff --git a/api/core/model_runtime/model_providers/yi/_assets/icon_l_zh.svg b/api/core/model_runtime/model_providers/yi/_assets/icon_l_zh.svgnew file mode 100644index 00000000000..951842da554--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/_assets/icon_l_zh.svg@@ -0,0 +1,20 @@+<svg width="80" height="22" viewBox="0 0 450 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <circle cx="300" cy="300" r="300" style="fill:rgb(0,52,37);"/>+ </g>+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <path d="M452.119,361.224C452.119,349.527 442.623,340.031 430.926,340.031C419.229,340.031 409.733,349.527 409.733,361.224L409.733,470.486C409.733,482.183 419.229,491.679 430.926,491.679C442.623,491.679 452.119,482.183 452.119,470.486L452.119,361.224Z" style="fill:white;"/>+ </g>+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <path d="M422.005,133.354C413.089,125.771 399.714,126.851 392.131,135.767L273.699,275.021C270.643,278.614 268.994,282.932 268.698,287.302C268.532,288.371 268.446,289.466 268.446,290.581L268.446,468.603C268.446,480.308 277.934,489.796 289.639,489.796C301.344,489.796 310.832,480.308 310.832,468.603L310.832,296.784L424.419,163.228C432.002,154.312 430.921,140.937 422.005,133.354Z" style="fill:white;"/>+ </g>+ <g transform="matrix(0.13359,-0.109514,0.109514,0.13359,-0.630793,25.9151)">+ <path d="M156.358,155.443C156.358,143.746 146.862,134.25 135.165,134.25C123.468,134.25 113.972,143.746 113.972,155.443L113.972,287.802C113.972,299.499 123.468,308.995 135.165,308.995C146.862,308.995 156.358,299.499 156.358,287.802L156.358,155.443Z" style="fill:white;"/>+ </g>+ <g transform="matrix(0.172742,0,0,0.172742,9.60932,8.17741)">+ <circle cx="460.126" cy="279.278" r="25.903" style="fill:rgb(0,255,37);"/>+ </g>+ <g transform="matrix(1,0,0,1,-77.4848,13.0849)">+ <text x="210.275px" y="74.595px" style="font-family:'AlibabaPuHuiTi_3_55_Regular', 'Alibaba PuHuiTi 3.0', serif;font-size:80px;">零一万物</text>+ </g>+</svg>diff --git a/api/core/model_runtime/model_providers/yi/_assets/icon_s_en.svg b/api/core/model_runtime/model_providers/yi/_assets/icon_s_en.svgnew file mode 100644index 00000000000..a813274466f--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/_assets/icon_s_en.svg@@ -0,0 +1,7 @@+<svg width="24" height="24" viewBox="0 0 600 600" fill="none" xmlns="http://www.w3.org/2000/svg">+ <circle cx="300" cy="300" r="300" fill="#003425"/>+ <rect x="409.733" y="340.031" width="42.3862" height="151.648" rx="21.1931" fill="white"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M422.005 133.354C413.089 125.771 399.714 126.851 392.131 135.767L273.699 275.021C270.643 278.614 268.994 282.932 268.698 287.302C268.532 288.371 268.446 289.466 268.446 290.581V468.603C268.446 480.308 277.934 489.796 289.639 489.796C301.344 489.796 310.832 480.308 310.832 468.603V296.784L424.419 163.228C432.002 154.312 430.921 140.937 422.005 133.354Z" fill="white"/>+ <rect x="113.972" y="134.25" width="42.3862" height="174.745" rx="21.1931" transform="rotate(-39.3441 113.972 134.25)" fill="white"/>+ <circle cx="460.126" cy="279.278" r="25.9027" fill="#00FF25"/>+</svg>\ No newline at end of filediff --git a/api/core/model_runtime/model_providers/yi/llm/__init__.py b/api/core/model_runtime/model_providers/yi/llm/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/api/core/model_runtime/model_providers/yi/llm/_position.yaml b/api/core/model_runtime/model_providers/yi/llm/_position.yamlnew file mode 100644index 00000000000..12838d670f8--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/llm/_position.yaml@@ -0,0 +1,3 @@+- yi-34b-chat-0205+- yi-34b-chat-200k+- yi-vl-plusdiff --git a/api/core/model_runtime/model_providers/yi/llm/llm.py b/api/core/model_runtime/model_providers/yi/llm/llm.pynew file mode 100644index 00000000000..8ad64625149--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/llm/llm.py@@ -0,0 +1,30 @@+from collections.abc import Generator+from typing import Optional, Union++from core.model_runtime.entities.llm_entities import LLMResult+from core.model_runtime.entities.message_entities import (+ PromptMessage,+ PromptMessageTool,+)+from core.model_runtime.model_providers.openai_api_compatible.llm.llm import OAIAPICompatLargeLanguageModel+++class YiLargeLanguageModel(OAIAPICompatLargeLanguageModel):+ def _invoke(self, model: str, credentials: dict,+ prompt_messages: list[PromptMessage], model_parameters: dict,+ tools: Optional[list[PromptMessageTool]] = None, stop: Optional[list[str]] = None,+ stream: bool = True, user: Optional[str] = None) \+ -> Union[LLMResult, Generator]:+ self._add_custom_parameters(credentials)+ return super()._invoke(model, credentials, prompt_messages, model_parameters, tools, stop, stream)++ def validate_credentials(self, model: str, credentials: dict) -> None:+ self._add_custom_parameters(credentials)+ super().validate_credentials(model, credentials)++ @staticmethod+ def _add_custom_parameters(credentials: dict) -> None:+ credentials['mode'] = 'chat'++ if 'endpoint_url' not in credentials or credentials['endpoint_url'] == "":+ credentials['endpoint_url'] = 'https://api.lingyiwanwu.com/v1'diff --git a/api/core/model_runtime/model_providers/yi/llm/yi-34b-chat-0205.yaml b/api/core/model_runtime/model_providers/yi/llm/yi-34b-chat-0205.yamlnew file mode 100644index 00000000000..4d4148aa910--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/llm/yi-34b-chat-0205.yaml@@ -0,0 +1,28 @@+model: yi-34b-chat-0205+label:+ zh_Hans: yi-34b-chat-0205+ en_US: yi-34b-chat-0205+model_type: llm+features:+ - agent-thought+model_properties:+ mode: chat+ context_size: 4096+parameter_rules:+ - name: max_tokens+ use_template: max_tokens+ type: int+ default: 512+ min: 1+ max: 4096+ - name: temperature+ use_template: temperature+ type: float+ default: 0.7+ min: 0+ max: 2+pricing:+ input: '0.0025'+ output: '0.0025'+ unit: '0.00001'+ currency: RMBdiff --git a/api/core/model_runtime/model_providers/yi/llm/yi-34b-chat-200k.yaml b/api/core/model_runtime/model_providers/yi/llm/yi-34b-chat-200k.yamlnew file mode 100644index 00000000000..4fbe84e9b7f--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/llm/yi-34b-chat-200k.yaml@@ -0,0 +1,28 @@+model: yi-34b-chat-200k+label:+ zh_Hans: yi-34b-chat-200k+ en_US: yi-34b-chat-200k+model_type: llm+features:+ - agent-thought+model_properties:+ mode: chat+ context_size: 200000+parameter_rules:+ - name: max_tokens+ use_template: max_tokens+ type: int+ default: 1024+ min: 1+ max: 200000+ - name: temperature+ use_template: temperature+ type: float+ default: 0.7+ min: 0+ max: 2+pricing:+ input: '0.012'+ output: '0.012'+ unit: '0.00001'+ currency: RMBdiff --git a/api/core/model_runtime/model_providers/yi/llm/yi-vl-plus.yaml b/api/core/model_runtime/model_providers/yi/llm/yi-vl-plus.yamlnew file mode 100644index 00000000000..6195051f167--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/llm/yi-vl-plus.yaml@@ -0,0 +1,28 @@+model: yi-vl-plus+label:+ zh_Hans: yi-vl-plus+ en_US: yi-vl-plus+model_type: llm+features:+ - vision+model_properties:+ mode: chat+ context_size: 4096+parameter_rules:+ - name: max_tokens+ use_template: max_tokens+ type: int+ default: 512+ min: 1+ max: 4096+ - name: temperature+ use_template: temperature+ type: float+ default: 0.7+ min: 0+ max: 2+pricing:+ input: '0.01'+ output: '0.03'+ unit: '0.001'+ currency: USDdiff --git a/api/core/model_runtime/model_providers/yi/yi.py b/api/core/model_runtime/model_providers/yi/yi.pynew file mode 100644index 00000000000..691c7aa3711--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/yi.py@@ -0,0 +1,32 @@+import logging++from core.model_runtime.entities.model_entities import ModelType+from core.model_runtime.errors.validate import CredentialsValidateFailedError+from core.model_runtime.model_providers.__base.model_provider import ModelProvider++logger = logging.getLogger(__name__)+++class YiProvider(ModelProvider):++ def validate_provider_credentials(self, credentials: dict) -> None:+ """+ Validate provider credentials+ if validate failed, raise exception++ :param credentials: provider credentials, credentials form defined in `provider_credential_schema`.+ """+ try:+ model_instance = self.get_model_instance(ModelType.LLM)++ # Use `yi-34b-chat-0205` model for validate,+ # no matter what model you pass in, text completion model or chat model+ model_instance.validate_credentials(+ model='yi-34b-chat-0205',+ credentials=credentials+ )+ except CredentialsValidateFailedError as ex:+ raise ex+ except Exception as ex:+ logger.exception(f'{self.get_provider_schema().provider} credentials validate failed')+ raise exdiff --git a/api/core/model_runtime/model_providers/yi/yi.yaml b/api/core/model_runtime/model_providers/yi/yi.yamlnew file mode 100644index 00000000000..368c715456b--- /dev/null+++ b/api/core/model_runtime/model_providers/yi/yi.yaml@@ -0,0 +1,41 @@+provider: yi+label:+ en_US: 01.AI+ zh_Hans: 零一万物+description:+ en_US: Models provided by 01.AI, such as yi-34b-chat and yi-vl-plus.+ zh_Hans: 零一万物提供的模型,例如 yi-34b-chat 和 yi-vl-plus。+icon_small:+ en_US: icon_s_en.svg+icon_large:+ en_US: icon_l_en.svg+background: "#EFFDFD"+help:+ title:+ en_US: Get your API Key from 01.ai+ zh_Hans: 从零一万物获取 API Key+ url:+ en_US: https://platform.lingyiwanwu.com/apikeys+supported_model_types:+ - llm+configurate_methods:+ - predefined-model+provider_credential_schema:+ credential_form_schemas:+ - variable: api_key+ label:+ en_US: API Key+ type: secret-input+ required: true+ placeholder:+ zh_Hans: 在此输入您的 API Key+ en_US: Enter your API Key+ - variable: endpoint_url+ label:+ zh_Hans: 自定义 API endpoint 地址+ en_US: CUstom API endpoint URL+ type: text-input+ required: false+ placeholder:+ zh_Hans: Base URL, e.g. https://api.lingyiwanwu.com/v1+ en_US: Base URL, e.g. https://api.lingyiwanwu.com/v1