mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-17 05:07:23 +08:00
### What problem does this PR solve? Fixes #14893 The Novita Go driver landed in #14850 and shipped a stub `Embed` method that returned `"novita, no such method"`, so Novita could not be used as an embedding provider in RAGFlow. This PR fills that gap. Novita exposes a public embeddings endpoint at `POST https://api.novita.ai/v3/embeddings` that accepts the standard OpenAI-compatible request shape (`{model, input}`) with `Authorization: Bearer <api_key>`. Two embedding models are documented in Novita's model library: `baai/bge-m3` (multilingual, 8192 tokens) and `baai/bge-large-en-v1.5`. ### Changes - `internal/entity/models/novita.go`: implement `NovitaModel.Embed`. - Validate inputs (api key, model name) and short-circuit on empty texts. - Resolve region with the existing `baseURLForRegion` helper. - Build URL from `URLSuffix.Embedding` (the embeddings path lives under `/v3/`, separate from the chat path under `/openai/v1/`). - Send `{model, input}` POST body, add `dimensions` when `embeddingConfig.Dimension > 0` (matches the pattern in #14735). - Bearer auth + JSON content type, mirroring the chat path. - Parse `{data: [{embedding, index}]}` and reorder by `index`, rejecting out-of-range indices, duplicates, and missing entries so the output always lines up with the input. Same shape as the merged Mistral and Upstage Embed implementations. - `conf/models/novita.json`: - Add `"embedding": "v3/embeddings"` to `url_suffix`. - Add default embedding model entries for `baai/bge-m3` and `baai/bge-large-en-v1.5` so they appear in the model picker. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Jin Hai <haijin.chn@gmail.com>
71 lines
1.3 KiB
JSON
71 lines
1.3 KiB
JSON
{
|
|
"name": "Novita",
|
|
"url": {
|
|
"default": "https://api.novita.ai"
|
|
},
|
|
"url_suffix": {
|
|
"chat": "openai/v1/chat/completions",
|
|
"models": "openai/v1/models",
|
|
"embedding": "openai/v1/embeddings"
|
|
},
|
|
"class": "novita",
|
|
"models": [
|
|
{
|
|
"name": "deepseek/deepseek-v4-pro",
|
|
"max_tokens": 65536,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "meta-llama/llama-3.3-70b-instruct",
|
|
"max_tokens": 131072,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "qwen/qwen3-30b-a3b-fp8",
|
|
"max_tokens": 32768,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "qwen/qwen3-235b-a22b-fp8",
|
|
"max_tokens": 32768,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "moonshotai/kimi-k2-instruct",
|
|
"max_tokens": 131072,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "google/gemma-3-27b-it",
|
|
"max_tokens": 131072,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "mistralai/mistral-nemo",
|
|
"max_tokens": 131072,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "baai/bge-m3",
|
|
"max_tokens": 8192,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
}
|
|
]
|
|
}
|