소스 검색

Feat: add xAI provider (#8781)

### What problem does this PR solve?

Add xAI provider (experimental feature, requires user feedback).

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
tags/v0.20.0
Yongteng Lei 3 달 전
부모
커밋
1895667573
No account linked to committer's email address
4개의 변경된 파일76개의 추가작업 그리고 0개의 파일을 삭제
  1. 55
    0
      conf/llm_factories.json
  2. 1
    0
      docs/references/supported_models.mdx
  3. 10
    0
      rag/llm/chat_model.py
  4. 10
    0
      rag/llm/cv_model.py

+ 55
- 0
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": "",

+ 1
- 0
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: | | | | | |

+ 10
- 0
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"


+ 10
- 0
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"


Loading…
취소
저장