### What problem does this PR solve? Support 302.AI provider. ### Type of change - [x] New Feature (non-breaking change which adds functionality)tags/v0.20.0
| "max_tokens": 131072, | "max_tokens": 131072, | ||||
| "model_type": "chat", | "model_type": "chat", | ||||
| "is_tools": true | "is_tools": true | ||||
| }, | }, | ||||
| { | { | ||||
| "llm_name": "grok-3-fast", | "llm_name": "grok-3-fast", | ||||
| "max_tokens": 131072, | "max_tokens": 131072, | ||||
| "model_type": "chat", | "model_type": "chat", | ||||
| "is_tools": true | "is_tools": true | ||||
| }, | }, | ||||
| { | { | ||||
| "llm_name": "grok-3-mini", | "llm_name": "grok-3-mini", | ||||
| "max_tokens": 131072, | "max_tokens": 131072, | ||||
| "model_type": "chat", | "model_type": "chat", | ||||
| "is_tools": true | "is_tools": true | ||||
| }, | }, | ||||
| { | { | ||||
| "llm_name": "grok-3-mini-mini-fast", | "llm_name": "grok-3-mini-mini-fast", | ||||
| "max_tokens": 131072, | "max_tokens": 131072, | ||||
| "model_type": "chat", | "model_type": "chat", | ||||
| "is_tools": true | "is_tools": true | ||||
| }, | }, | ||||
| { | { | ||||
| "llm_name": "grok-2-vision", | "llm_name": "grok-2-vision", | ||||
| "max_tokens": 32768, | "max_tokens": 32768, | ||||
| "model_type": "image2text", | "model_type": "image2text", | ||||
| "is_tools": true | "is_tools": true | ||||
| } | } | ||||
| ] | ] | ||||
| }, | }, | ||||
| { | { | ||||
| "name": "BAAI", | "name": "BAAI", | ||||
| "logo": "", | "logo": "", | ||||
| "tags": "TEXT EMBEDDING", | |||||
| "tags": "TEXT EMBEDDING", | |||||
| "status": "1", | "status": "1", | ||||
| "llm": [ | "llm": [ | ||||
| { | { | ||||
| "model_type": "embedding" | "model_type": "embedding" | ||||
| } | } | ||||
| ] | ] | ||||
| }, | |||||
| { | |||||
| "name": "302.AI", | |||||
| "logo": "", | |||||
| "tags": "LLM,TEXT EMBEDDING,TEXT RE-RANK,IMAGE2TEXT", | |||||
| "status": "1", | |||||
| "llm": [ | |||||
| { | |||||
| "llm_name": "deepseek-chat", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 32000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "gpt-4o", | |||||
| "tags": "LLM,CHAT,128k", | |||||
| "max_tokens": 128000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "chatgpt-4o-latest", | |||||
| "tags": "LLM,CHAT,128k", | |||||
| "max_tokens": 128000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "llama3.3-70b", | |||||
| "tags": "LLM,CHAT,128k", | |||||
| "max_tokens": 128000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "deepseek-reasoner", | |||||
| "tags": "LLM,CHAT,64k", | |||||
| "max_tokens": 64000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "gemini-2.0-flash", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 1000000, | |||||
| "model_type": "image2text", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "claude-3-7-sonnet-20250219", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 200000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "claude-3-7-sonnet-latest", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 200000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "grok-3-beta", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 131072, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "grok-3-mini-beta", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 131072, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "gpt-4.1", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 1000000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "o3", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 200000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "o4-mini", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 200000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "qwen3-235b-a22b", | |||||
| "tags": "LLM,CHAT,128k", | |||||
| "max_tokens": 128000, | |||||
| "model_type": "chat", | |||||
| "is_tools": false | |||||
| }, | |||||
| { | |||||
| "llm_name": "qwen3-32b", | |||||
| "tags": "LLM,CHAT,128k", | |||||
| "max_tokens": 128000, | |||||
| "model_type": "chat", | |||||
| "is_tools": false | |||||
| }, | |||||
| { | |||||
| "llm_name": "gemini-2.5-pro-preview-05-06", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 1000000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "llama-4-maverick", | |||||
| "tags": "LLM,CHAT,128k", | |||||
| "max_tokens": 128000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "gemini-2.5-flash", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 1000000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "claude-sonnet-4-20250514", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 200000, | |||||
| "model_type": "chat", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "claude-opus-4-20250514", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 200000, | |||||
| "model_type": "image2text", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "gemini-2.5-pro", | |||||
| "tags": "LLM,CHAT", | |||||
| "max_tokens": 1000000, | |||||
| "model_type": "image2text", | |||||
| "is_tools": true | |||||
| }, | |||||
| { | |||||
| "llm_name": "jina-clip-v2", | |||||
| "tags": "TEXT EMBEDDING,TEXT RE-RANK", | |||||
| "max_tokens": 8192, | |||||
| "model_type": "embedding", | |||||
| "is_tools": false | |||||
| }, | |||||
| { | |||||
| "llm_name": "jina-reranker-m0", | |||||
| "tags": "TEXT EMBEDDING,TEXT RE-RANK", | |||||
| "max_tokens": 10240, | |||||
| "model_type": "rerank", | |||||
| "is_tools": false | |||||
| } | |||||
| ] | |||||
| } | } | ||||
| ] | ] | ||||
| } | } |
| --- | --- | ||||
| # Supported models | # Supported models | ||||
| import APITable from '@site/src/components/APITable'; | import APITable from '@site/src/components/APITable'; | ||||
| A complete list of models supported by RAGFlow, which will continue to expand. | A complete list of models supported by RAGFlow, which will continue to expand. | ||||
| | ZHIPU-AI | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | | ZHIPU-AI | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | ||||
| | 01.AI | :heavy_check_mark: | | | | | | | | 01.AI | :heavy_check_mark: | | | | | | | ||||
| | DeepInfra | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: | | | DeepInfra | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: | | ||||
| | 302.AI | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | |||||
| ```mdx-code-block | ```mdx-code-block | ||||
| </APITable> | </APITable> | ||||
| :::danger IMPORTANT | :::danger IMPORTANT | ||||
| If your model is not listed here but has APIs compatible with those of OpenAI, click **OpenAI-API-Compatible** on the **Model providers** page to configure your model. | If your model is not listed here but has APIs compatible with those of OpenAI, click **OpenAI-API-Compatible** on the **Model providers** page to configure your model. | ||||
| ::: | |||||
| ::: | |||||
| :::note | :::note | ||||
| The list of supported models is extracted from [this source](https://github.com/infiniflow/ragflow/blob/main/rag/llm/__init__.py) and may not be the most current. For the latest supported model list, please refer to the Python file. | The list of supported models is extracted from [this source](https://github.com/infiniflow/ragflow/blob/main/rag/llm/__init__.py) and may not be the most current. For the latest supported model list, please refer to the Python file. |
| raise ValueError("Local llm url cannot be None") | raise ValueError("Local llm url cannot be None") | ||||
| base_url = urljoin(base_url, "v1") | base_url = urljoin(base_url, "v1") | ||||
| super().__init__(key, model_name, base_url, **kwargs) | super().__init__(key, model_name, base_url, **kwargs) | ||||
| class DeepInfraChat(Base): | class DeepInfraChat(Base): | ||||
| _FACTORY_NAME = "DeepInfra" | _FACTORY_NAME = "DeepInfra" | ||||
| if not base_url: | if not base_url: | ||||
| base_url = "https://api.deepinfra.com/v1/openai" | base_url = "https://api.deepinfra.com/v1/openai" | ||||
| super().__init__(key, model_name, base_url, **kwargs) | super().__init__(key, model_name, base_url, **kwargs) | ||||
| class Ai302Chat(Base): | |||||
| _FACTORY_NAME = "302.AI" | |||||
| def __init__(self, key, model_name, base_url="https://api.302.ai/v1", **kwargs): | |||||
| if not base_url: | |||||
| base_url = "https://api.302.ai/v1" | |||||
| super().__init__(key, model_name, base_url, **kwargs) |
| if not base_url: | if not base_url: | ||||
| base_url = "https://ai.gitee.com/v1/embeddings" | base_url = "https://ai.gitee.com/v1/embeddings" | ||||
| super().__init__(key, model_name, base_url) | super().__init__(key, model_name, base_url) | ||||
| class DeepInfraEmbed(OpenAIEmbed): | class DeepInfraEmbed(OpenAIEmbed): | ||||
| _FACTORY_NAME = "DeepInfra" | _FACTORY_NAME = "DeepInfra" | ||||
| if not base_url: | if not base_url: | ||||
| base_url = "https://api.deepinfra.com/v1/openai" | base_url = "https://api.deepinfra.com/v1/openai" | ||||
| super().__init__(key, model_name, base_url) | super().__init__(key, model_name, base_url) | ||||
| class Ai302Embed(Base): | |||||
| _FACTORY_NAME = "302.AI" | |||||
| def __init__(self, key, model_name, base_url="https://api.302.ai/v1/embeddings"): | |||||
| if not base_url: | |||||
| base_url = "https://api.302.ai/v1/embeddings" | |||||
| super().__init__(key, model_name, base_url) |
| if not base_url: | if not base_url: | ||||
| base_url = "https://ai.gitee.com/v1/rerank" | base_url = "https://ai.gitee.com/v1/rerank" | ||||
| super().__init__(key, model_name, base_url) | super().__init__(key, model_name, base_url) | ||||
| class Ai302Rerank(Base): | |||||
| _FACTORY_NAME = "302.AI" | |||||
| def __init__(self, key, model_name, base_url="https://api.302.ai/v1/rerank"): | |||||
| if not base_url: | |||||
| base_url = "https://api.302.ai/v1/rerank" | |||||
| super().__init__(key, model_name, base_url) |
| self.client = OpenAI(api_key=key, base_url=base_url) | self.client = OpenAI(api_key=key, base_url=base_url) | ||||
| self.model_name = model_name | self.model_name = model_name | ||||
| class DeepInfraSeq2txt(Base): | class DeepInfraSeq2txt(Base): | ||||
| _FACTORY_NAME = "DeepInfra" | _FACTORY_NAME = "DeepInfra" | ||||
| if chunk: | if chunk: | ||||
| yield chunk | yield chunk | ||||
| class DeepInfraTTS(OpenAITTS): | class DeepInfraTTS(OpenAITTS): | ||||
| _FACTORY_NAME = "DeepInfra" | _FACTORY_NAME = "DeepInfra" | ||||
| <svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>302.AI</title><path d="M13.086 23.25c5.614 0 10.164-4.559 10.164-10.182 0-5.624-4.55-10.182-10.164-10.182-5.613 0-10.163 4.558-10.163 10.182 0 5.623 4.55 10.182 10.163 10.182z" fill="#3F3FAA"></path><path d="M10.914 21.114c5.613 0 10.163-4.559 10.163-10.182S16.527.75 10.914.75C5.3.75.75 5.309.75 10.932S5.3 21.114 10.914 21.114z" fill="#8E47FF"></path><path d="M10.755 17.708c-.722 0-1.416-.24-1.995-.69a3.25 3.25 0 01-1.23-2.177 3.248 3.248 0 01-.006-.782c-.201.04-.407.056-.618.056a3.265 3.265 0 01-3.261-3.262A3.27 3.27 0 017.65 7.67a3.27 3.27 0 013.241-3.638 3.266 3.266 0 013.242 3.577 3.269 3.269 0 012.694 5.693 3.227 3.227 0 01-2.365.782 3.26 3.26 0 01-.466-.066c0 .008.005.014.005.02a3.254 3.254 0 01-.664 2.41 3.235 3.235 0 01-2.583 1.259zm-1.808-4.313c-.228.397-.32.847-.263 1.304a2.092 2.092 0 002.335 1.826 2.086 2.086 0 001.398-.791 2.08 2.08 0 00.425-1.548 2.091 2.091 0 00-.405-1.004 3.253 3.253 0 01-.39-.462.58.58 0 11.947-.675c.044.062.088.117.137.173a.61.61 0 01.111.101l.056.071a2.096 2.096 0 003.49-1.405 2.096 2.096 0 00-1.93-2.248 2.076 2.076 0 00-1.251.304.579.579 0 01-.648.061.59.59 0 01-.233-.796A2.102 2.102 0 0010.888 5.2 2.1 2.1 0 009.14 8.457l.03.056c.61.594.993 1.42.993 2.339A3.273 3.273 0 018.947 13.4v-.005zM6.901 8.752a2.098 2.098 0 00-2.092 2.1c0 1.16.936 2.101 2.092 2.101a2.1 2.1 0 000-4.201z" fill="#fff"></path></svg> |
| GPUStack = 'GPUStack', | GPUStack = 'GPUStack', | ||||
| VLLM = 'VLLM', | VLLM = 'VLLM', | ||||
| GiteeAI = 'GiteeAI', | GiteeAI = 'GiteeAI', | ||||
| Ai302 = '302.AI', | |||||
| DeepInfra = 'DeepInfra', | DeepInfra = 'DeepInfra', | ||||
| } | } | ||||
| [LLMFactory.GPUStack]: 'gpustack', | [LLMFactory.GPUStack]: 'gpustack', | ||||
| [LLMFactory.VLLM]: 'vllm', | [LLMFactory.VLLM]: 'vllm', | ||||
| [LLMFactory.GiteeAI]: 'gitee-ai', | [LLMFactory.GiteeAI]: 'gitee-ai', | ||||
| [LLMFactory.Ai302]: 'ai302', | |||||
| [LLMFactory.DeepInfra]: 'deepinfra', | [LLMFactory.DeepInfra]: 'deepinfra', | ||||
| }; | }; |
| LLMFactory.ZhipuAI, | LLMFactory.ZhipuAI, | ||||
| LLMFactory.Ollama, | LLMFactory.Ollama, | ||||
| LLMFactory.Xinference, | LLMFactory.Xinference, | ||||
| LLMFactory.Ai302, | |||||
| ]; | ]; | ||||
| export const sortLLmFactoryListBySpecifiedOrder = (list: IFactory[]) => { | export const sortLLmFactoryListBySpecifiedOrder = (list: IFactory[]) => { |