NativePort
← All use cases

Put the most useful passages in front of your agent

Rerank retrieved candidates against the question before building the model’s context.

The problem

A search can give your agent results that mention the right topic but do not answer the question. It needs a tool that checks which passages are most useful and moves them to the top. Otherwise, it may overlook the information that would support a better answer.

How NativePort helps

NativePort connects to Jina to compare search results with your question and put the more relevant passages first. Your agent can then focus on useful information before answering. It can keep the source links so you can check the material yourself.

Let your agent build it

You don’t need to write this code yourself. Copy the prompt and paste it into your agent. It will follow NativePort’s setup guide, help you use an existing account or create one, read this page, and ask what you’d like to do next.

View prompt
Help me use NativePort for this use case.

1. Read https://nativeport.ai/SKILL.md and follow its instructions to learn how to use NativePort. Save or update the skill if your environment supports it.

2. Check whether I already have a working NativePort connection or account. Reuse it if available. Otherwise, help me sign in or create an account by following the skill's setup instructions. Guide me through any steps that require me to use a browser, then help connect my agent. Keep credentials private.

3. Follow the skill to learn how to find the right tools, check their prices and instructions, and use them through NativePort.

4. Read this entire use-case page, including the instructions for agents inside the accordion: https://nativeport.ai/use-cases/rerank-search-results/

Once setup is complete and you have read the page, briefly explain what you can help me do and ask me what I would like to do next. Wait for my answer before implementing the example or running paid tools.
Instructions for the agents - You don't need to read this

Technical implementation

Use Python 3 with requests installed (python -m pip install requests). Set NATIVEPORT_API_KEY in your environment to your NativePort key. Run the snippets on your server, where your key stays private.

Reranking starts with candidates you already retrieved; it does not search the web or your database.

python
import os
import requests

BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}

documents = [
    "Our support team is available Monday to Friday.",
    "Unused items can be returned within 30 days of delivery.",
    "Delivery usually takes three business days.",
]
response = requests.post(BASE + "/jina/rerank", headers=HEADERS,
    json={"model": "jina-reranker-v2-base-multilingual",
          "query": "How long do I have to return an unused item?",
          "documents": documents, "top_n": 2}, timeout=90)
response.raise_for_status()
for match in response.json()["results"]:
    print(match["relevance_score"], documents[match["index"]])

Use the returned index to reconnect each result to your source metadata. Choose top_n for the prompt budget and check relevance on your own questions. A high score does not establish that a source is factually correct. See the Jina gateway reference.

Tool costs

Tool used in the examplePrice per call
Jina — reranking $0.0000211 / 1,000 tokens (usage-based)

Prices in USD. Usage-based tools have no fixed per-call price. View pricing.