Jev AI

Semantic search and re-ranking

Improve a keyword or embedding shortlist with a direct semantic comparison.

NOUL×1
UNSTRUCTUREDSTATEJEVNOUL+ confidenceCODE-OWNEDROUTINGACTESCALATEREVIEW
One request, 1 parallel answer. The model never performs the side effect — your code reads the confidences and decides.
01
HOW IT WORKS
from typesafe_sdk import Noul, NoulCriteria, TypeSafeClient


def score_candidate(client: TypeSafeClient, query: str, candidate: str) -> float:
    response = client.system_one(
        state={"query": query, "candidate": candidate},
        questions={
            "matches": Noul(
                instructions="Could `candidate` be the best answer to `query`?",
                criteria=NoulCriteria(
                    true="The candidate contains the specific information needed to answer the query.",
                    false="The candidate is only topically similar or does not contain the needed evidence.",
                ),
            ),
        },
    )
    return response.answers["matches"].noul


def rerank(client, query: str, shortlist: list[str]) -> list[str]:
    scored = [(score_candidate(client, query, candidate), candidate) for candidate in shortlist]
    return [candidate for _, candidate in sorted(scored, reverse=True)]

For production, bound concurrency, cache stable pairs, batch any independent questions about the same pair, and respect rate limits. Jev cannot recover a candidate that the first-stage retriever omitted.

Source: Re-ranking and line-by-line search.

1 次请求 / 1 个答案
这个模式的一句话