diff --git a/README.md b/README.md index 566bcd53..8843d205 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex 项目支持国内外主流厂商的模型接口,可选模型及配置说明参考:[模型说明](#模型说明)。 -> 注:Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、glm-5.1、kimi-k2.6、qwen3.5-plus、claude-sonnet-4-6、gemini-3.1-pro-preview、gpt-5.4、gpt-5.4-mini、ernie-5.0 +> 注:Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、glm-5.1、kimi-k2.6、qwen3.5-plus、claude-sonnet-4-6、gemini-3.1-pro-preview、gpt-5.4、gpt-5.4-mini、ernie-5.1 同时支持使用 **LinkAI 平台** 接口,支持上述全部模型,并支持知识库、工作流、插件等 Agent 技能,参考 [接口文档](https://docs.link-ai.tech/platform/api)。 @@ -605,13 +605,13 @@ API Key 创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "qianfan_api_key": "", "qianfan_api_base": "https://qianfan.baidubce.com/v2" } ``` - - `model`: 默认推荐填写 `ernie-5.0`(多模态,可直接识图),也可填写 `ernie-x1.1`、`ernie-4.5-turbo-128k`、`ernie-4.5-turbo-32k`;当主模型为纯文本 ERNIE 时,Vision 工具会自动 fallback 到 `ernie-4.5-turbo-vl` + - `model`: 默认推荐填写 `ernie-5.1`(多模态,可直接识图),也可填写 `ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-128k`、`ernie-4.5-turbo-32k`;当主模型为纯文本 ERNIE 时,Vision 工具会自动 fallback 到 `ernie-4.5-turbo-vl` - `qianfan_api_key`: 百度千帆 API Key,通常以 `bce-v3/` 开头,可在百度智能云控制台创建 - `qianfan_api_base`: 可选,默认为 `https://qianfan.baidubce.com/v2` @@ -619,7 +619,7 @@ API Key 创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn ```json { "bot_type": "openai", - "model": "ernie-5.0", + "model": "ernie-5.1", "open_ai_api_base": "https://qianfan.baidubce.com/v2", "open_ai_api_key": "" } diff --git a/channel/web/web_channel.py b/channel/web/web_channel.py index 6823c02d..02b2a862 100644 --- a/channel/web/web_channel.py +++ b/channel/web/web_channel.py @@ -780,7 +780,7 @@ class ConfigHandler: const.QWEN36_PLUS, const.QWEN35_PLUS, const.QWEN3_MAX, const.DOUBAO_SEED_2_PRO, const.DOUBAO_SEED_2_CODE, const.KIMI_K2_6, const.KIMI_K2_5, const.KIMI_K2, - const.ERNIE_5, const.ERNIE_X1_1, const.ERNIE_45_TURBO_128K, const.ERNIE_45_TURBO_32K, + const.ERNIE_5_1, const.ERNIE_5, const.ERNIE_X1_1, const.ERNIE_45_TURBO_128K, const.ERNIE_45_TURBO_32K, ] # Generic placeholder hints surfaced in the web console. We deliberately @@ -873,7 +873,7 @@ class ConfigHandler: "api_base_key": "qianfan_api_base", "api_base_default": "https://qianfan.baidubce.com/v2", "api_base_placeholder": _PLACEHOLDER_QIANFAN, - "models": [const.ERNIE_5, const.ERNIE_X1_1, const.ERNIE_45_TURBO_128K, const.ERNIE_45_TURBO_32K], + "models": [const.ERNIE_5_1, const.ERNIE_5, const.ERNIE_X1_1, const.ERNIE_45_TURBO_128K, const.ERNIE_45_TURBO_32K], }), ("modelscope", { "label": "ModelScope", diff --git a/common/const.py b/common/const.py index 0fab180e..abe3c2c1 100644 --- a/common/const.py +++ b/common/const.py @@ -87,7 +87,8 @@ DEEPSEEK_V4_FLASH = "deepseek-v4-flash" # DeepSeek V4 Flash - 默认推荐 (思 DEEPSEEK_V4_PRO = "deepseek-v4-pro" # DeepSeek V4 Pro - 复杂任务更强 (思考模式 + 工具调用) # Baidu Qianfan / ERNIE -ERNIE_5 = "ernie-5.0" # ERNIE 5.0 - default recommendation +ERNIE_5_1 = "ernie-5.1" # ERNIE 5.1 - default recommendation, latest flagship +ERNIE_5 = "ernie-5.0" # ERNIE 5.0 ERNIE_X1_1 = "ernie-x1.1" # ERNIE X1.1 - reasoning-focused, multimodal ERNIE_45_TURBO_128K = "ernie-4.5-turbo-128k" ERNIE_45_TURBO_32K = "ernie-4.5-turbo-32k" @@ -170,7 +171,7 @@ MODEL_LIST = [ DEEPSEEK_V4_FLASH, DEEPSEEK_V4_PRO, DEEPSEEK_CHAT, DEEPSEEK_REASONER, # Baidu Qianfan / ERNIE - QIANFAN, ERNIE_5, ERNIE_X1_1, ERNIE_45_TURBO_128K, ERNIE_45_TURBO_32K, ERNIE_4_TURBO_8K, + QIANFAN, ERNIE_5_1, ERNIE_5, ERNIE_X1_1, ERNIE_45_TURBO_128K, ERNIE_45_TURBO_32K, ERNIE_4_TURBO_8K, ERNIE_45_TURBO_VL, ERNIE_45_TURBO_VL_32K, # MiniMax diff --git a/docs/en/models/index.mdx b/docs/en/models/index.mdx index ca7cf344..5fae1f7d 100644 --- a/docs/en/models/index.mdx +++ b/docs/en/models/index.mdx @@ -6,7 +6,7 @@ description: Supported models and recommended choices for CowAgent CowAgent supports mainstream LLMs from domestic and international providers. Model interfaces are implemented in the project's `models/` directory. - For Agent mode, the following models are recommended based on quality and cost: deepseek-v4-flash, MiniMax-M2.7, claude-sonnet-4-6, gemini-3.1-pro-preview, glm-5.1, qwen3.6-plus, kimi-k2.6, ernie-5.0 + For Agent mode, the following models are recommended based on quality and cost: deepseek-v4-flash, MiniMax-M2.7, claude-sonnet-4-6, gemini-3.1-pro-preview, glm-5.1, qwen3.6-plus, kimi-k2.6, ernie-5.1 ## Configuration @@ -22,7 +22,7 @@ You can also use the [LinkAI](https://link-ai.tech) platform interface to flexib deepseek-v4-flash, deepseek-v4-pro, and more - ernie-5.0, ernie-4.5-turbo-128k, and more + ernie-5.1, ernie-5.0, ernie-4.5-turbo-128k, and more MiniMax-M2.7 and other series models diff --git a/docs/en/models/qianfan.mdx b/docs/en/models/qianfan.mdx index 117760f1..aa88d040 100644 --- a/docs/en/models/qianfan.mdx +++ b/docs/en/models/qianfan.mdx @@ -7,7 +7,7 @@ Option 1: Native integration (recommended): ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "qianfan_api_key": "", "qianfan_api_base": "https://qianfan.baidubce.com/v2" } @@ -15,7 +15,7 @@ Option 1: Native integration (recommended): | Parameter | Description | | --- | --- | -| `model` | Default recommendation: `ernie-5.0`; also supports `ernie-x1.1`, `ernie-4.5-turbo-128k`, `ernie-4.5-turbo-32k` | +| `model` | Default recommendation: `ernie-5.1`; also supports `ernie-5.0`, `ernie-x1.1`, `ernie-4.5-turbo-128k`, `ernie-4.5-turbo-32k` | | `qianfan_api_key` | Qianfan API key, usually starting with `bce-v3/` | | `qianfan_api_base` | Optional, defaults to `https://qianfan.baidubce.com/v2` | @@ -23,7 +23,8 @@ Option 1: Native integration (recommended): | Model | Use Case | | --- | --- | -| `ernie-5.0` | Default recommendation; latest ERNIE flagship with the strongest overall capability | +| `ernie-5.1` | Default recommendation; latest ERNIE flagship with the strongest overall capability | +| `ernie-5.0` | Previous-generation flagship with excellent overall capability | | `ernie-x1.1` | Deep-thinking reasoning model with lower hallucination and stronger instruction following / tool calling | | `ernie-4.5-turbo-128k` | Long-context and general chat | | `ernie-4.5-turbo-32k` | General chat with a balanced context window and cost | @@ -32,7 +33,7 @@ Option 1: Native integration (recommended): Once `qianfan_api_key` is configured, Agent mode can auto-discover Qianfan for the Vision tool: -- When the main model itself is multimodal (e.g. `ernie-5.0`, `ernie-x1.1`, `ernie-4.5-turbo-vl`), images are handled directly by the main model with no extra setup. +- When the main model itself is multimodal (e.g. `ernie-5.1`, `ernie-5.0`, `ernie-x1.1`, `ernie-4.5-turbo-vl`), images are handled directly by the main model with no extra setup. - When the main model is text-only (e.g. `ernie-4.5-turbo-128k`), the Vision tool automatically falls back to `ernie-4.5-turbo-vl`. To force a specific Vision model, set it explicitly in `config.json`: @@ -51,7 +52,7 @@ Option 2: OpenAI-compatible configuration: ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "bot_type": "openai", "open_ai_api_key": "", "open_ai_api_base": "https://qianfan.baidubce.com/v2" diff --git a/docs/en/tools/vision.mdx b/docs/en/tools/vision.mdx index 2a8545fc..9e9da7f5 100644 --- a/docs/en/tools/vision.mdx +++ b/docs/en/tools/vision.mdx @@ -23,7 +23,7 @@ If the current provider fails, the tool automatically tries the next one until i | Vendor | Vision Model | Notes | | --- | --- | --- | | OpenAI / Compatible | Main model | All OpenAI-compatible multimodal models | -| Baidu Qianfan | Main model | Multimodal main models (e.g. `ernie-5.0`) handle images directly; falls back to `ernie-4.5-turbo-vl` for text-only main models | +| Baidu Qianfan | Main model | Multimodal main models (e.g. `ernie-5.1`) handle images directly; falls back to `ernie-4.5-turbo-vl` for text-only main models | | Qwen (DashScope) | Main model | Via MultiModalConversation API | | Claude | Main model | Anthropic native image format | | Gemini | Main model | inlineData format | diff --git a/docs/ja/models/index.mdx b/docs/ja/models/index.mdx index b1047fb7..d86ada77 100644 --- a/docs/ja/models/index.mdx +++ b/docs/ja/models/index.mdx @@ -6,7 +6,7 @@ description: CowAgentがサポートするモデルとおすすめの選択肢 CowAgentは国内外の主要なLLMをサポートしています。モデルインターフェースはプロジェクトの`models/`ディレクトリに実装されています。 - Agent モードでは、品質とコストのバランスから以下のモデルをおすすめします: deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-5.0 + Agent モードでは、品質とコストのバランスから以下のモデルをおすすめします: deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-5.1 ## 設定 @@ -22,7 +22,7 @@ CowAgentは国内外の主要なLLMをサポートしています。モデルイ deepseek-v4-flash、deepseek-v4-pro など - ernie-5.0、ernie-4.5-turbo-128k など + ernie-5.1、ernie-5.0、ernie-4.5-turbo-128k など MiniMax-M2.7およびその他のシリーズモデル diff --git a/docs/ja/models/qianfan.mdx b/docs/ja/models/qianfan.mdx index 42195812..6e5fde15 100644 --- a/docs/ja/models/qianfan.mdx +++ b/docs/ja/models/qianfan.mdx @@ -7,7 +7,7 @@ description: Baidu Qianfan ERNIE モデル設定 ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "qianfan_api_key": "", "qianfan_api_base": "https://qianfan.baidubce.com/v2" } @@ -15,7 +15,7 @@ description: Baidu Qianfan ERNIE モデル設定 | パラメータ | 説明 | | --- | --- | -| `model` | デフォルトの推奨は `ernie-5.0`。`ernie-x1.1`、`ernie-4.5-turbo-128k`、`ernie-4.5-turbo-32k` も利用できます | +| `model` | デフォルトの推奨は `ernie-5.1`。`ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-128k`、`ernie-4.5-turbo-32k` も利用できます | | `qianfan_api_key` | Qianfan API Key。通常は `bce-v3/` で始まります | | `qianfan_api_base` | 任意。デフォルトは `https://qianfan.baidubce.com/v2` | @@ -23,7 +23,8 @@ description: Baidu Qianfan ERNIE モデル設定 | モデル | 用途 | | --- | --- | -| `ernie-5.0` | デフォルト推奨。文心の最新フラッグシップモデルで、総合性能が最も強い | +| `ernie-5.1` | デフォルト推奨。文心の最新フラッグシップモデルで、総合性能が最も強い | +| `ernie-5.0` | 前世代フラッグシップ。総合性能に優れる | | `ernie-x1.1` | 深層推論モデル。ハルシネーションが少なく、指示追従とツール呼び出しが強化 | | `ernie-4.5-turbo-128k` | 長いコンテキストと一般的なチャット向け | | `ernie-4.5-turbo-32k` | コンテキスト長とコストのバランスが良い一般チャット向け | @@ -32,7 +33,7 @@ description: Baidu Qianfan ERNIE モデル設定 `qianfan_api_key` を設定すると、Agent モードの Vision ツールは Qianfan を自動検出します: -- 主モデルが多モーダル(`ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-vl` など)の場合は、追加設定なしで主モデルがそのまま画像を処理します。 +- 主モデルが多モーダル(`ernie-5.1`、`ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-vl` など)の場合は、追加設定なしで主モデルがそのまま画像を処理します。 - 主モデルがテキスト専用(`ernie-4.5-turbo-128k` など)の場合は、Vision ツールが自動的に `ernie-4.5-turbo-vl` にフォールバックします。 特定の Vision モデルを強制したい場合は、`config.json` で明示的に指定できます: @@ -51,7 +52,7 @@ description: Baidu Qianfan ERNIE モデル設定 ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "bot_type": "openai", "open_ai_api_key": "", "open_ai_api_base": "https://qianfan.baidubce.com/v2" diff --git a/docs/ja/tools/vision.mdx b/docs/ja/tools/vision.mdx index 0ddf0444..0c3c9d9a 100644 --- a/docs/ja/tools/vision.mdx +++ b/docs/ja/tools/vision.mdx @@ -23,7 +23,7 @@ Vision ツールは多段階の自動選択+自動フォールバック戦略 | ベンダー | ビジョンモデル | 説明 | | --- | --- | --- | | OpenAI / 互換プロトコル | メインモデル | すべての OpenAI 互換マルチモーダルモデルに対応 | -| Baidu Qianfan | メインモデル | 多モーダルの主モデル(`ernie-5.0` など)は直接画像を処理。テキスト専用主モデルの場合は `ernie-4.5-turbo-vl` に自動フォールバック | +| Baidu Qianfan | メインモデル | 多モーダルの主モデル(`ernie-5.1` など)は直接画像を処理。テキスト専用主モデルの場合は `ernie-4.5-turbo-vl` に自動フォールバック | | 通義千問 (DashScope) | メインモデル | MultiModalConversation API 経由 | | Claude | メインモデル | Anthropic ネイティブ画像形式 | | Gemini | メインモデル | inlineData 形式 | diff --git a/docs/models/index.mdx b/docs/models/index.mdx index e2808b71..afe9798e 100644 --- a/docs/models/index.mdx +++ b/docs/models/index.mdx @@ -6,7 +6,7 @@ description: CowAgent 支持的模型及推荐选择 CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在项目的 `models/` 目录下。 - Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-5.0 + Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-5.1 同时支持使用 [LinkAI](https://link-ai.tech) 平台接口,可灵活切换多种模型,并支持知识库、工作流、插件等 Agent 能力。 @@ -27,7 +27,7 @@ CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在 deepseek-v4-flash、deepseek-v4-pro 等 - ernie-5.0、ernie-4.5-turbo-128k 等 + ernie-5.1、ernie-5.0、ernie-4.5-turbo-128k 等 MiniMax-M2.7 等系列模型 diff --git a/docs/models/qianfan.mdx b/docs/models/qianfan.mdx index e99550f1..819713e0 100644 --- a/docs/models/qianfan.mdx +++ b/docs/models/qianfan.mdx @@ -7,7 +7,7 @@ description: 百度千帆 ERNIE 模型配置 ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "qianfan_api_key": "", "qianfan_api_base": "https://qianfan.baidubce.com/v2" } @@ -15,7 +15,7 @@ description: 百度千帆 ERNIE 模型配置 | 参数 | 说明 | | --- | --- | -| `model` | 默认推荐使用 `ernie-5.0`;也可使用 `ernie-x1.1`、`ernie-4.5-turbo-128k`、`ernie-4.5-turbo-32k` | +| `model` | 默认推荐使用 `ernie-5.1`;也可使用 `ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-128k`、`ernie-4.5-turbo-32k` | | `qianfan_api_key` | 千帆 API Key,格式通常以 `bce-v3/` 开头 | | `qianfan_api_base` | 可选,默认为 `https://qianfan.baidubce.com/v2` | @@ -23,7 +23,8 @@ description: 百度千帆 ERNIE 模型配置 | 模型 | 适用场景 | | --- | --- | -| `ernie-5.0` | 默认推荐,文心新一代旗舰模型,综合能力最强 | +| `ernie-5.1` | 默认推荐,文心新一代旗舰模型,综合能力最强 | +| `ernie-5.0` | 上一代旗舰模型,综合能力优异 | | `ernie-x1.1` | 深度思考推理模型,幻觉更低、指令遵循与工具调用更强 | | `ernie-4.5-turbo-128k` | 长上下文和通用对话 | | `ernie-4.5-turbo-32k` | 通用对话,成本和上下文更均衡 | @@ -32,7 +33,7 @@ description: 百度千帆 ERNIE 模型配置 配置 `qianfan_api_key` 后,Agent 的 Vision 工具可以自动使用千帆视觉模型: -- 当主模型本身是多模态时(如 `ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-vl`),直接由主模型识别图像,无需额外配置 +- 当主模型本身是多模态时(如 `ernie-5.1`、`ernie-5.0`、`ernie-x1.1`、`ernie-4.5-turbo-vl`),直接由主模型识别图像,无需额外配置 - 当主模型是纯文本时(如 `ernie-4.5-turbo-128k`),Vision 工具会自动 fallback 到 `ernie-4.5-turbo-vl` 如需手动指定 Vision 模型,可在 `config.json` 中显式配置: @@ -51,7 +52,7 @@ description: 百度千帆 ERNIE 模型配置 ```json { - "model": "ernie-5.0", + "model": "ernie-5.1", "bot_type": "openai", "open_ai_api_key": "", "open_ai_api_base": "https://qianfan.baidubce.com/v2" diff --git a/docs/tools/vision.mdx b/docs/tools/vision.mdx index 4fccc800..66cfdebf 100644 --- a/docs/tools/vision.mdx +++ b/docs/tools/vision.mdx @@ -24,7 +24,7 @@ Vision 工具采用多级自动选择 + 自动兜底策略,无需手动配置 | Gemini | 使用主模型 | inlineData 格式 | | 豆包 (Doubao) | 使用主模型 | doubao-seed-2-0 系列原生支持 | | Kimi (Moonshot) | 使用主模型 | kimi-k2.6、kimi-k2.5 原生支持 | -| 百度千帆 (Qianfan) | 使用主模型 | 默认使用多模态主模型 (如 ernie-5.0),主模型不支持时兜底使用 ernie-4.5-turbo-vl | +| 百度千帆 (Qianfan) | 使用主模型 | 默认使用多模态主模型 (如 ernie-5.1),主模型不支持时兜底使用 ernie-4.5-turbo-vl | | 智谱 AI | glm-5v-turbo | 固定使用视觉专用模型 | | MiniMax | MiniMax-Text-01 | 固定使用视觉专用模型 | diff --git a/models/qianfan/qianfan_bot.py b/models/qianfan/qianfan_bot.py index 5643722b..5bfe6577 100644 --- a/models/qianfan/qianfan_bot.py +++ b/models/qianfan/qianfan_bot.py @@ -14,12 +14,13 @@ from models.session_manager import SessionManager from .qianfan_session import QianfanSession DEFAULT_API_BASE = "https://qianfan.baidubce.com/v2" -DEFAULT_MODEL = const.ERNIE_5 +DEFAULT_MODEL = const.ERNIE_5_1 DEFAULT_VISION_MODEL = const.ERNIE_45_TURBO_VL # Qianfan models that natively understand images. Other ERNIE variants # are text-only and must not receive image payloads. _VISION_CAPABLE_MODELS = { + const.ERNIE_5_1, const.ERNIE_5, const.ERNIE_X1_1, const.ERNIE_45_TURBO_VL, diff --git a/models/qianfan/qianfan_session.py b/models/qianfan/qianfan_session.py index aebd0594..5bf5d036 100644 --- a/models/qianfan/qianfan_session.py +++ b/models/qianfan/qianfan_session.py @@ -3,7 +3,7 @@ from common.log import logger class QianfanSession(Session): - def __init__(self, session_id, system_prompt=None, model="ernie-5.0"): + def __init__(self, session_id, system_prompt=None, model="ernie-5.1"): super().__init__(session_id, system_prompt) self.model = model self.reset() diff --git a/tests/test_qianfan_provider.py b/tests/test_qianfan_provider.py index 053e6a6e..4c7900e5 100644 --- a/tests/test_qianfan_provider.py +++ b/tests/test_qianfan_provider.py @@ -16,6 +16,8 @@ class TestQianfanConstantsAndRouting(unittest.TestCase): def test_ernie_constants_are_in_model_list(self): from common import const + self.assertEqual(const.ERNIE_5_1, "ernie-5.1") + self.assertEqual(const.ERNIE_5, "ernie-5.0") self.assertEqual(const.ERNIE_45_TURBO_128K, "ernie-4.5-turbo-128k") self.assertEqual(const.ERNIE_45_TURBO_32K, "ernie-4.5-turbo-32k") self.assertEqual(const.ERNIE_X1_1, "ernie-x1.1") @@ -28,11 +30,18 @@ class TestQianfanConstantsAndRouting(unittest.TestCase): "ernie-4.5-turbo-vl-32k", ) self.assertIn(const.QIANFAN, const.MODEL_LIST) + self.assertIn(const.ERNIE_5_1, const.MODEL_LIST) + self.assertIn(const.ERNIE_5, const.MODEL_LIST) self.assertIn(const.ERNIE_45_TURBO_128K, const.MODEL_LIST) self.assertIn(const.ERNIE_45_TURBO_32K, const.MODEL_LIST) self.assertIn(const.ERNIE_X1_1, const.MODEL_LIST) self.assertIn(const.ERNIE_45_TURBO_VL, const.MODEL_LIST) self.assertIn(const.ERNIE_45_TURBO_VL_32K, const.MODEL_LIST) + # ERNIE 5.1 must be ranked before 5.0 so it is presented as the default. + self.assertLess( + const.MODEL_LIST.index(const.ERNIE_5_1), + const.MODEL_LIST.index(const.ERNIE_5), + ) def test_qianfan_config_keys_are_available(self): import config @@ -112,7 +121,7 @@ class TestQianfanConstantsAndRouting(unittest.TestCase): class TestQianfanBot(unittest.TestCase): def _fake_conf(self, values=None): data = { - "model": "ernie-5.0", + "model": "ernie-5.1", "qianfan_api_key": "test-qianfan-key", "qianfan_api_base": "https://qianfan.baidubce.com/v2", "temperature": 0.7, @@ -150,7 +159,7 @@ class TestQianfanBot(unittest.TestCase): bot = QianfanBot() - self.assertEqual(bot.args["model"], "ernie-5.0") + self.assertEqual(bot.args["model"], "ernie-5.1") def test_reply_text_posts_openai_compatible_payload(self): fake_conf = self._fake_conf() @@ -179,7 +188,7 @@ class TestQianfanBot(unittest.TestCase): kwargs = post.call_args.kwargs self.assertEqual(url, "https://qianfan.baidubce.com/v2/chat/completions") self.assertEqual(kwargs["headers"]["Authorization"], "Bearer test-qianfan-key") - self.assertEqual(kwargs["json"]["model"], "ernie-5.0") + self.assertEqual(kwargs["json"]["model"], "ernie-5.1") self.assertEqual(kwargs["json"]["messages"], [{"role": "user", "content": "你好"}]) def test_reply_text_returns_auth_error_for_401(self): @@ -224,7 +233,7 @@ class TestQianfanBot(unittest.TestCase): post.assert_called_once() def test_qianfan_bot_supports_vision_for_multimodal_models(self): - for model in ("ernie-5.0", "ernie-x1.1", "ernie-4.5-turbo-vl", "ernie-4.5-turbo-vl-32k"): + for model in ("ernie-5.1", "ernie-5.0", "ernie-x1.1", "ernie-4.5-turbo-vl", "ernie-4.5-turbo-vl-32k"): fake_conf = self._fake_conf({"model": model}) with patch("models.qianfan.qianfan_bot.conf", return_value=fake_conf): with patch("models.qianfan.qianfan_bot.SessionManager"): @@ -581,7 +590,7 @@ class TestQianfanDocs(unittest.TestCase): def test_readme_documents_native_qianfan_provider(self): text = self._read("README.md") - self.assertIn('"model": "ernie-5.0"', text) + self.assertIn('"model": "ernie-5.1"', text) self.assertIn('"qianfan_api_key": ""', text) self.assertIn('"qianfan_api_base": "https://qianfan.baidubce.com/v2"', text)