RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Feat: add xAI provider (#8781)
Yongteng Lei1895667573cf
diff --git a/conf/llm_factories.json b/conf/llm_factories.jsonindex 339c537a6e..461520f592 100644--- a/conf/llm_factories.json+++ b/conf/llm_factories.json@@ -141,6 +141,61 @@}]},+ {+ "name": "xAI",+ "logo": "",+ "tags": "LLM",+ "status": "1",+ "llm": [+ {+ "llm_name": "grok-4",+ "tags": "LLM,CHAT,256k",+ "max_tokens": 256000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "grok-3",+ "tags": "LLM,CHAT,130k",+ "max_tokens": 131072,+ "model_type": "chat",+ "is_tools": true++ },+ {+ "llm_name": "grok-3-fast",+ "tags": "LLM,CHAT,130k",+ "max_tokens": 131072,+ "model_type": "chat",+ "is_tools": true++ },+ {+ "llm_name": "grok-3-mini",+ "tags": "LLM,CHAT,130k",+ "max_tokens": 131072,+ "model_type": "chat",+ "is_tools": true++ },+ {+ "llm_name": "grok-3-mini-mini-fast",+ "tags": "LLM,CHAT,130k",+ "max_tokens": 131072,+ "model_type": "chat",+ "is_tools": true++ },+ {+ "llm_name": "grok-2-vision",+ "tags": "LLM,CHAT,IMAGE2TEXT,32k",+ "max_tokens": 32768,+ "model_type": "image2text",+ "is_tools": true++ }+ ]+ },{"name": "Tongyi-Qianwen","logo": "",diff --git a/docs/references/supported_models.mdx b/docs/references/supported_models.mdxindex db8cfb0603..897dcff211 100644--- a/docs/references/supported_models.mdx+++ b/docs/references/supported_models.mdx@@ -58,6 +58,7 @@ A complete list of models supported by RAGFlow, which will continue to expand.| Voyage AI | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | || Xinference | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: || XunFei Spark | :heavy_check_mark: | | | | | :heavy_check_mark: |+| xAI | :heavy_check_mark: | | | :heavy_check_mark: | | || Youdao | | :heavy_check_mark: | :heavy_check_mark: | | | || ZHIPU-AI | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | || 01.AI | :heavy_check_mark: | | | | | |diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.pyindex 9217b4122c..3ffe03af2a 100644--- a/rag/llm/chat_model.py+++ b/rag/llm/chat_model.py@@ -568,6 +568,16 @@ class BaiChuanChat(Base):yield total_tokens+class xAIChat(Base):+ _FACTORY_NAME = "xAI"++ def __init__(self, key, model_name="grok-3", base_url=None, **kwargs):+ if not base_url:+ base_url = "https://api.x.ai/v1"+ super().__init__(key, model_name, base_url=base_url, **kwargs)+ return++class QWenChat(Base):_FACTORY_NAME = "Tongyi-Qianwen"diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.pyindex afa39d69a9..fbccd5dffc 100644--- a/rag/llm/cv_model.py+++ b/rag/llm/cv_model.py@@ -223,6 +223,16 @@ class AzureGptV4(Base):return res.choices[0].message.content.strip(), res.usage.total_tokens+class xAICV(Base):+ _FACTORY_NAME = "xAI"++ def __init__(self, key, model_name="grok-3", base_url=None, **kwargs):+ if not base_url:+ base_url = "https://api.x.ai/v1"+ super().__init__(key, model_name, base_url=base_url, **kwargs)+ return++class QWenCV(Base):_FACTORY_NAME = "Tongyi-Qianwen"