GH-5776: Add Jina AI Scoring (Reranker) Module#5887
Open
cylin0201 wants to merge 3 commits intospring-projects:mainfrom
Open
GH-5776: Add Jina AI Scoring (Reranker) Module#5887cylin0201 wants to merge 3 commits intospring-projects:mainfrom
cylin0201 wants to merge 3 commits intospring-projects:mainfrom
Conversation
Add scoring (reranking) abstraction to spring-ai-model: - ScoringModel, ScoringOptions, ScoringRequest, ScoringResponse - ScoringResult, ScoringResultMetadata, ScoringResponseMetadata - Register SCORING in SpringAIModels and SpringAIModelProperties - ScoringOptions.getModel() as default method for backward compatibility Signed-off-by: Wongi Kim <cylin0201@naver.com>
Implement Jina AI Reranker integration as a ScoringModel: - JinaScoringApi: REST client with Builder pattern for Jina Reranker API - JinaScoringModel: ScoringModel implementation with retry support, options merging - JinaScoringOptions: model, topK, returnDocuments, truncation configuration - ScoringDocumentPostProcessor: RAG post-retrieval reranking pipeline - Unit tests with MockWebServer (5 tests: success, merge, error, empty, retry) - Integration tests for API and model level (require JINA_API_KEY) Signed-off-by: Wongi Kim <cylin0201@naver.com>
- JinaScoringAutoConfiguration: conditional bean registration for JinaScoringModel - JinaScoringProperties: spring.ai.jina.scoring.* configuration properties - Register spring-ai-jina modules in spring-ai-bom - Register Jina modules in root pom.xml Signed-off-by: Wongi Kim <cylin0201@naver.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GH-5776: Add Jina AI Scoring (Reranker) Module
Motivation
Spring AI currently lacks a built-in scoring/reranking abstraction. This PR introduces a
ScoringModelabstraction inspring-ai-modeland provides the first implementation using the Jina AI Reranker API.Reranking is a critical component in RAG pipelines — it re-scores retrieved documents against the user query to improve relevance ordering before passing them to the LLM.
Changes
1. Core Scoring Abstraction (
spring-ai-model)ScoringModel,ScoringOptions,ScoringRequest,ScoringResponse,ScoringResultScoringOptions.getModel()added as adefaultmethod for backward compatibilitySCORINGinSpringAIModelsandSpringAIModelProperties2. Jina AI Implementation (
models/spring-ai-jina)JinaScoringApi— REST client with Builder pattern for Jina Reranker API (POST /v1/rerank)JinaScoringModel—ScoringModelimplementation with retry support, options merging, input validationJinaScoringOptions— model, topK, returnDocuments, truncation configurationjina-reranker-v2-base-multilingual,jina-reranker-v1-*,jina-colbert-v1-en,jina-colbert-v2,jina-reranker-m0,jina-reranker-v33. RAG Integration (
spring-ai-rag)ScoringDocumentPostProcessor— post-retrieval reranking pipeline forRetrievalAugmentationAdvisor4. Auto-Configuration (
auto-configurations/models/spring-ai-autoconfigure-model-jina)JinaScoringAutoConfiguration— conditional bean registrationJinaScoringProperties—spring.ai.jina.scoring.*configuration propertiesspring-ai-starter-model-jina)5. BOM Registration
spring-ai-jina,spring-ai-autoconfigure-model-jina,spring-ai-starter-model-jinaadded tospring-ai-bomTest Coverage
JinaScoringModelTestsJinaScoringApiITJinaScoringModelITScoringDocumentPostProcessorITJinaScoringAutoConfigurationITUsage Example
Checklist
mvnw clean verify -pl models/spring-ai-jina)Closes #5776