diff --git a/xpertai/models/moonshot/README.md b/xpertai/models/moonshot/README.md index 0f80514c..dab06e18 100644 --- a/xpertai/models/moonshot/README.md +++ b/xpertai/models/moonshot/README.md @@ -2,7 +2,7 @@ ## Overview -`@xpert-ai/plugin-moonshot` connects [Moonshot AI (Kimi)](https://platform.moonshot.cn/) models to the [XpertAI](https://github.com/xpert-ai/xpert) platform. The plugin integrates Moonshot's OpenAI-compatible API so XpertAI agents can leverage Kimi's powerful long-context language models with context windows up to 128K tokens, including the latest K2 series with advanced reasoning capabilities. +`@xpert-ai/plugin-moonshot` connects [Moonshot AI (Kimi)](https://platform.moonshot.cn/) models to the [XpertAI](https://github.com/xpert-ai/xpert) platform. The plugin integrates Moonshot's OpenAI-compatible API so XpertAI agents can leverage Kimi's powerful long-context language models with context windows up to 262K tokens, including the latest K2 series with advanced reasoning capabilities. ## Core Features @@ -12,6 +12,7 @@ - Supports multiple Moonshot model variants including: - **Moonshot V1 Series**: `moonshot-v1-8k`, `moonshot-v1-32k`, `moonshot-v1-128k` for various context length requirements - **Kimi K2 Series**: `kimi-k2-0711-preview`, `kimi-k2-0905-preview`, `kimi-k2-turbo-preview` for enhanced performance + - **Kimi K2.5**: `kimi-k2.5` with 262K context window, vision support, and deep thinking mode for complex reasoning tasks - **Kimi K2 Thinking Series**: `kimi-k2-thinking`, `kimi-k2-thinking-turbo` for advanced reasoning tasks ## Installation @@ -43,7 +44,7 @@ During validation, the plugin instantiates a ChatOpenAI client with your credent ## Model Capabilities -- **Long Context Support**: All Moonshot models excel at handling long-context scenarios, with the V1-128K variant supporting up to 128,000 tokens of context. +- **Long Context Support**: All Moonshot models excel at handling long-context scenarios, with the V1-128K variant supporting up to 128,000 tokens and the latest K2.5 supporting up to 262,000 tokens of context. - **Conversational Models**: `MoonshotLargeLanguageModel` merges provider credentials with per-model overrides, enables streaming, and registers token usage callbacks so agent telemetry stays accurate. - **Advanced Reasoning**: The K2 Thinking series models provide enhanced reasoning capabilities for complex problem-solving tasks. - **OpenAI Compatibility**: Built on LangChain's `ChatOpenAI`, ensuring seamless integration with existing OpenAI-compatible workflows. diff --git a/xpertai/models/moonshot/src/_assets/icon_k2_s_en.png b/xpertai/models/moonshot/src/_assets/icon_k2_s_en.png index 77864aa5..b1a7f923 100644 Binary files a/xpertai/models/moonshot/src/_assets/icon_k2_s_en.png and b/xpertai/models/moonshot/src/_assets/icon_k2_s_en.png differ diff --git a/xpertai/models/moonshot/src/_assets/icon_l_en.png b/xpertai/models/moonshot/src/_assets/icon_l_en.png index b96bff7f..9dd1feb9 100644 Binary files a/xpertai/models/moonshot/src/_assets/icon_l_en.png and b/xpertai/models/moonshot/src/_assets/icon_l_en.png differ diff --git a/xpertai/models/moonshot/src/_assets/icon_s_en.png b/xpertai/models/moonshot/src/_assets/icon_s_en.png index 62a34700..58ba4b46 100644 Binary files a/xpertai/models/moonshot/src/_assets/icon_s_en.png and b/xpertai/models/moonshot/src/_assets/icon_s_en.png differ diff --git a/xpertai/models/moonshot/src/index.ts b/xpertai/models/moonshot/src/index.ts index 48c37774..337ec6c4 100644 --- a/xpertai/models/moonshot/src/index.ts +++ b/xpertai/models/moonshot/src/index.ts @@ -3,12 +3,16 @@ import { readFileSync } from 'fs'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; import { z } from 'zod'; -import { SvgIcon } from './types.js'; import { MoonshotModule } from './moonshot.module.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); +// Read PNG icon as data URL. No fallback/try-catch: missing asset should fail fast. +const iconPngDataUrl = + 'data:image/png;base64,' + + readFileSync(join(__dirname, '_assets/icon_s_en.png')).toString('base64'); + const packageJson = JSON.parse( readFileSync(join(__dirname, '../package.json'), 'utf8') ) as { @@ -24,8 +28,8 @@ const plugin: XpertPlugin = { version: packageJson.version, category: 'model', icon: { - type: 'svg', - value: SvgIcon, + type: 'image', + value: iconPngDataUrl, }, displayName: 'Moonshot AI (Kimi)', description: 'Provide Moonshot AI (Kimi) Models with Long Context Support', diff --git a/xpertai/models/moonshot/src/llm/_position.yaml b/xpertai/models/moonshot/src/llm/_position.yaml index 8f68f8e0..b4d3427a 100644 --- a/xpertai/models/moonshot/src/llm/_position.yaml +++ b/xpertai/models/moonshot/src/llm/_position.yaml @@ -2,5 +2,8 @@ - moonshot-v1-32k - moonshot-v1-128k - kimi-k2-0711-preview +- kimi-k2-0905-preview +- kimi-k2-turbo-preview - kimi-k2-thinking - kimi-k2-thinking-turbo +- kimi-k2.5 diff --git a/xpertai/models/moonshot/src/llm/kimi-k2.5.yaml b/xpertai/models/moonshot/src/llm/kimi-k2.5.yaml new file mode 100644 index 00000000..a8da74d3 --- /dev/null +++ b/xpertai/models/moonshot/src/llm/kimi-k2.5.yaml @@ -0,0 +1,61 @@ +model: kimi-k2.5 +label: + zh_Hans: kimi-k2.5 + en_US: kimi-k2.5 +model_type: llm +features: + - vision + - agent-thought + - tool-call + - multi-tool-call + - stream-tool-call +model_properties: + mode: chat + context_size: 262144 +parameter_rules: + - name: temperature + use_template: temperature + default: 1.0 + help: + zh_Hans: 采样温度。思考模式下建议使用 1.0,非思考模式下建议使用 0.6。 + en_US: Sampling temperature. Recommended 1.0 for thinking mode, 0.6 for instant mode. + - name: top_p + use_template: top_p + default: 0.95 + help: + zh_Hans: 核采样参数。思考模式下建议使用 0.95。 + en_US: Nucleus sampling parameter. Recommended 0.95 for thinking mode. + - name: max_tokens + use_template: max_tokens + default: 1024 + min: 1 + max: 262144 + - name: thinking + label: + zh_Hans: 深度思考 + en_US: Thinking Mode + type: boolean + default: true + required: false + help: + zh_Hans: 启用深度思考模式,使模型具备强大的推理能力,适合解决复杂的逻辑推理、数学问题和代码编写等任务。 + en_US: Enable thinking mode for enhanced reasoning capabilities, suitable for complex logical reasoning, math problems, and coding tasks. + - name: response_format + label: + zh_Hans: 回复格式 + en_US: Response Format + type: string + help: + zh_Hans: 指定模型必须输出的格式 + en_US: specifying the format that the model must output + required: false + options: + - text + - json_object +pricing: + input: '4' + output: '21' + unit: '0.000001' + currency: RMB + + diff --git a/xpertai/models/moonshot/src/moonshot.yaml b/xpertai/models/moonshot/src/moonshot.yaml index 9b652336..4e80bf01 100644 --- a/xpertai/models/moonshot/src/moonshot.yaml +++ b/xpertai/models/moonshot/src/moonshot.yaml @@ -3,9 +3,8 @@ configurate_methods: - predefined-model - customizable-model description: - en_US: Models provided by Moonshot, such as moonshot-v1-8k, moonshot-v1-32k, and - moonshot-v1-128k. - zh_Hans: Moonshot 提供的模型,例如 moonshot-v1-8k、moonshot-v1-32k 和 moonshot-v1-128k。 + en_US: Models provided by Moonshot, such as kimi-k2.5, kimi-k2, moonshot-v1-8k, moonshot-v1-32k, and moonshot-v1-128k. + zh_Hans: Moonshot 提供的模型,例如 kimi-k2.5, kimi-k2, moonshot-v1-8k、moonshot-v1-32k 和 moonshot-v1-128k。 help: title: en_US: Get your API Key from Moonshot