Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: add kimi-k2-thinking and moonshot-v1-vision-preview (#11110)

Yongteng Lei9fcc4946e29f
diff --git a/conf/llm_factories.json b/conf/llm_factories.json
index 1c069e8dc4..681480ca20 100644
--- a/conf/llm_factories.json
+++ b/conf/llm_factories.json
@@ -892,7 +892,7 @@
{
"name": "Moonshot",
"logo": "",
- "tags": "LLM,TEXT EMBEDDING",
+ "tags": "LLM,TEXT EMBEDDING,IMAGE2TEXT",
"status": "1",
"llm": [
{
@@ -916,6 +916,20 @@
"model_type": "chat",
"is_tools": true
},
+ {
+ "llm_name": "kimi-k2-thinking",
+ "tags": "LLM,CHAT,256k",
+ "max_tokens": 262144,
+ "model_type": "chat",
+ "is_tools": true
+ },
+ {
+ "llm_name": "kimi-k2-thinking-turbo",
+ "tags": "LLM,CHAT,256k",
+ "max_tokens": 262144,
+ "model_type": "chat",
+ "is_tools": true
+ },
{
"llm_name": "kimi-k2-turbo-preview",
"tags": "LLM,CHAT,256k",
@@ -932,25 +946,46 @@
},
{
"llm_name": "moonshot-v1-8k",
- "tags": "LLM,CHAT,",
- "max_tokens": 7900,
+ "tags": "LLM,CHAT,8k",
+ "max_tokens": 8192,
"model_type": "chat",
"is_tools": true
},
{
"llm_name": "moonshot-v1-32k",
- "tags": "LLM,CHAT,",
+ "tags": "LLM,CHAT,32k",
"max_tokens": 32768,
"model_type": "chat",
"is_tools": true
},
{
"llm_name": "moonshot-v1-128k",
- "tags": "LLM,CHAT",
- "max_tokens": 128000,
+ "tags": "LLM,CHAT,128k",
+ "max_tokens": 131072,
"model_type": "chat",
"is_tools": true
},
+ {
+ "llm_name": "moonshot-v1-8k-vision-preview",
+ "tags": "LLM,IMAGE2TEXT,8k",
+ "max_tokens": 8192,
+ "model_type": "image2text",
+ "is_tools": true
+ },
+ {
+ "llm_name": "moonshot-v1-32k-vision-preview",
+ "tags": "LLM,IMAGE2TEXT,32k",
+ "max_tokens": 32768,
+ "model_type": "image2text",
+ "is_tools": true
+ },
+ {
+ "llm_name": "moonshot-v1-128k-vision-preview",
+ "tags": "LLM,IMAGE2TEXT,128k",
+ "max_tokens": 131072,
+ "model_type": "image2text",
+ "is_tools": true
+ },
{
"llm_name": "moonshot-v1-auto",
"tags": "LLM,CHAT,",
diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.py
index 9ea9459073..21f78a819c 100644
--- a/rag/llm/cv_model.py
+++ b/rag/llm/cv_model.py
@@ -464,7 +464,7 @@ class GPUStackCV(GptV4):
class LocalCV(Base):
- _FACTORY_NAME = "Moonshot"
+ _FACTORY_NAME = "Local"
def __init__(self, key, model_name="glm-4v", lang="Chinese", **kwargs):
pass
@@ -975,3 +975,12 @@ class GoogleCV(AnthropicCV, GeminiCV):
else:
for ans in GeminiCV.chat_streamly(self, system, history, gen_conf, images):
yield ans
+
+
+class MoonshotCV(GptV4):
+ _FACTORY_NAME = "Moonshot"
+
+ def __init__(self, key, model_name="moonshot-v1-8k-vision-preview", lang="Chinese", base_url="https://api.moonshot.cn/v1", **kwargs):
+ if not base_url:
+ base_url = "https://api.moonshot.cn/v1"
+ super().__init__(key, model_name, lang=lang, base_url=base_url, **kwargs)