Skip to content

Conversation

@mkhludnev
Copy link
Contributor

@mkhludnev mkhludnev commented Nov 9, 2025

Description

This PR fixes #7189

Notes for Reviewers

After applying the fix I see the right reranker output:

curl -X POST http://localhost:8080/v1/rerank \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What are the benefits of exercise?",
    "documents": [
      "Regular exercise can improve cardiovascular health.",
      "Eating a balanced diet is important for overall well-being.",
      "Exercise helps in weight management and builds muscle strength.",
      "Reading books can expand your knowledge and vocabulary."
    ],
    "model": "jina-reranker-v1-tiny-en",
    "top_n": 2
  }'


{
  "model": "jina-reranker-v1-tiny-en",
  "usage": {
    "total_tokens": 41,
    "prompt_tokens": 41
  },
  "results": [
    {
      "index": 2,
      "document": {
        "text": "Exercise helps in weight management and builds muscle strength."
      },
      "relevance_score": 0.07032939791679382
    },
    {
      "index": 0,
      "document": {
        "text": "Regular exercise can improve cardiovascular health."
      },
      "relevance_score": 0.059670690447092056
    }
  ]
}

is there are tests, which I can assert behavior for this backend?

Signed commits

  • [v] Yes, I signed my commits.

@netlify
Copy link

netlify bot commented Nov 9, 2025

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 7d199e7
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/691175fd7fcc920008755536
😎 Deploy Preview https://deploy-preview-7211--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mudler
Copy link
Owner

mudler commented Nov 10, 2025

Description

This PR fixes #7189

Notes for Reviewers

After applying the fix I see the right reranker output:

curl -X POST http://localhost:8080/v1/rerank \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What are the benefits of exercise?",
    "documents": [
      "Regular exercise can improve cardiovascular health.",
      "Eating a balanced diet is important for overall well-being.",
      "Exercise helps in weight management and builds muscle strength.",
      "Reading books can expand your knowledge and vocabulary."
    ],
    "model": "jina-reranker-v1-tiny-en",
    "top_n": 2
  }'


{
  "model": "jina-reranker-v1-tiny-en",
  "usage": {
    "total_tokens": 41,
    "prompt_tokens": 41
  },
  "results": [
    {
      "index": 2,
      "document": {
        "text": "Exercise helps in weight management and builds muscle strength."
      },
      "relevance_score": 0.07032939791679382
    },
    {
      "index": 0,
      "document": {
        "text": "Regular exercise can improve cardiovascular health."
      },
      "relevance_score": 0.059670690447092056
    }
  ]
}

This is great, thanks for opening up a PR!

is there are tests, which I can assert behavior for this backend?

we have tests here that could be likely extended:

Context("reranker", func() {

@mudler mudler added the bug Something isn't working label Nov 12, 2025
@mudler mudler merged commit 04fe0b0 into mudler:master Nov 12, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

llama-cpp reranker doesn't sort results and ignores top_n

2 participants