mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
### What problem does this PR solve? This PR adds non-streaming chat support for the Jina Go model provider. The Jina provider was added with embedding, rerank, model listing, and connection checking, but `ChatWithMessages` still returned a not-implemented error even though Jina exposes an OpenAI-compatible `/v1/chat/completions` endpoint. Closes #14933 **The following functionalities are now supported:** ### **Jina:** - [x] Chat - [ ] Stream Chat - [x] Embedding - [x] Rerank - [x] Model listing - [x] Provider connection checking - [ ] Balance ### **Implementation details:** - Implements `JinaModel.ChatWithMessages` - Sends `Authorization: Bearer <api-key>` and JSON chat completion requests - Validates API key, model name, messages, and configured region before making requests - Forwards supported chat config fields: `max_tokens`, `temperature`, `top_p`, and `stop` - Parses the first chat completion choice into `ChatResponse.Answer` - Adds `jina-ai/jina-vlm` as a chat-capable model in `conf/models/jina.json` - Adds focused unit tests for request construction, auth, response parsing, validation errors, provider errors, and region handling **Verification:** ```plaintext docker run --rm -v $PWD:/repo -w /repo golang:1.25 sh -c '/usr/local/go/bin/gofmt -w internal/entity/models/jina.go internal/entity/models/jina_test.go && /usr/local/go/bin/go test -vet=off ./internal/entity/models -run TestJina -count=1' ok ragflow/internal/entity/models 0.037s ``` Note: `go test ./internal/entity/models -run TestJina -count=1` currently hits unrelated existing vet findings in other provider files, so the focused Jina tests were run with `-vet=off`. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Jin Hai <haijin.chn@gmail.com>
108 lines
1.9 KiB
JSON
108 lines
1.9 KiB
JSON
{
|
|
"name": "Jina",
|
|
"url": {
|
|
"default": "https://api.jina.ai/v1",
|
|
"deepsearch": "https://deepsearch.jina.ai/v1"
|
|
},
|
|
"url_suffix": {
|
|
"chat": "chat/completions",
|
|
"models": "models",
|
|
"embedding": "embeddings",
|
|
"rerank": "rerank"
|
|
},
|
|
"class": "jina",
|
|
"models": [
|
|
{
|
|
"name": "jina-vlm",
|
|
"max_tokens": 32768,
|
|
"model_types": [
|
|
"chat"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-reranker-v3",
|
|
"max_tokens": 134144,
|
|
"model_types": [
|
|
"rerank"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-reranker-m0",
|
|
"max_tokens": 134144,
|
|
"model_types": [
|
|
"rerank"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-colbert-v2",
|
|
"max_tokens": 134144,
|
|
"model_types": [
|
|
"rerank"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-reranker-v2-base-multilingual",
|
|
"max_tokens": 134144,
|
|
"model_types": [
|
|
"rerank"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v3",
|
|
"max_tokens": 8192,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v4",
|
|
"max_tokens": 32768,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v5-text-small",
|
|
"max_tokens": 32768,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v5-text-nano",
|
|
"max_tokens": 8192,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v5-omni-small",
|
|
"max_tokens": 32768,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v5-omni-nano",
|
|
"max_tokens": 8192,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-clip-v2",
|
|
"max_tokens": 8192,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
},
|
|
{
|
|
"name": "jina-embeddings-v2-base-en",
|
|
"max_tokens": 8192,
|
|
"model_types": [
|
|
"embedding"
|
|
]
|
|
}
|
|
]
|
|
}
|