text_relevance_llm

更新时间:
复制 MD 格式

Use the text_relevance_llm function to reorder search results using a reranker.

Prerequisites

Connect the Industry Algorithm Edition to the Open Platform for AI Search.

Rerankers are provided by the Open Platform for AI Search. To use a reranker in the Industry Algorithm Edition, you must first access the model.

On the Model List page of the Open Platform for AI Search, find the reranker and click one-click access to enable the reranking service.

Syntax

text_relevance_llm(service_id, fields)

This function uses the reranker specified by service_id to calculate the text relevance between the content of the specified fields and the original query (raw_query).

Parameters:

  • service_id: The service ID of the reranker. The ID must be enclosed in double quotation marks, for example, "ops-bge-reranker-larger".

    Supported service IDs:
    • ops-bge-reranker-larger: Provides a doc scoring service based on the BGE model. This service reranks docs in descending order based on their relevance to the query and outputs the corresponding scores. It supports both Chinese and English, with a maximum input length of 512 tokens (query + doc).
    • ops-text-reranker-001: This proprietary OpenSearch reranker, trained on multi-industry datasets, provides high-quality reranking, sorting docs in descending order based on their semantic relevance to the query. It supports both Chinese and English, with a maximum input length of 512 tokens (query + doc).
  • fields: One or more attribute fields of the LITERAL type for reranking. Enclose the field names in double quotation marks and concatenate them with a hash symbol (#), for example: "title_attr#detail_attr".

Examples

Single field:

text_relevance_llm("ops-bge-reranker-larger","title_attr")

Multiple fields:

text_relevance_llm("ops-text-reranker-001","title_attr#detail_attr")

Cava usage

See TextRelevanceLLM-Cava.