Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71219aa

Browse files
SilasMarvinlevkk
andauthored
Added pgml.rank docs (#1514)
Co-authored-by: Lev Kokotov <levkk@users.noreply.github.com>
1 parent6a804ba commit71219aa

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
description:Rank documents against a piece of text using the specified ranking model.
3+
---
4+
5+
#pgml.rank()
6+
7+
The`pgml.rank()` function is used to compute a relevance score between documents and some text. This function is primarily used as the last step in a search system where the results returned from the initial search are re-ranked by relevance before being used.
8+
9+
##API
10+
11+
```postgresql
12+
pgml.rank(
13+
transformer TEXT, -- transformer name
14+
query TEXT, -- text to rank against
15+
documents TEXT[], -- documents to rank
16+
kwargs JSON -- optional arguments (see below)
17+
)
18+
```
19+
20+
##Example
21+
22+
Ranking documents is as simple as calling the the function with the documents you want to rank, and text you want to rank against:
23+
24+
```postgresql
25+
SELECT pgml.rank('mixedbread-ai/mxbai-rerank-base-v1', 'test', ARRAY['doc1', 'doc2']);
26+
```
27+
28+
By default the`pgml.rank()` function will return and rank all of the documents. The function can be configured to only return the relevance score and index of the top k documents by setting`return_documents` to`false` and`top_k` to the number of documents you want returned.
29+
30+
```postgresql
31+
SELECT pgml.rank('mixedbread-ai/mxbai-rerank-base-v1', 'test', ARRAY['doc1', 'doc2'], '{"return_documents": false, "top_k": 10}'::JSONB);
32+
```
33+
34+
##Supported ranking models
35+
36+
We currently support cross-encoders for re-ranking. Check out[Sentence Transformer's documentation](https://sbert.net/examples/applications/cross-encoder/README.html) for more information on how cross-encoders work.
37+
38+
By default we provide the following ranking models:
39+
40+
*`mixedbread-ai/mxbai-rerank-base-v1`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp