From f2c74a64b61b14f4c0137e527bb42c6945b2b9db Mon Sep 17 00:00:00 2001 From: Alexey Masterov Date: Tue, 15 Apr 2025 14:45:00 +0200 Subject: [PATCH] Fix rag_jina_reranker_v1_tiny_en-src --- .../expected/reranking_functions.out | 36 +++--- .../expected/reranking_functions_enhanced.out | 104 +++++++++--------- .../sql/reranking_functions.sql | 10 +- .../sql/reranking_functions_enhanced.sql | 32 +++--- 4 files changed, 93 insertions(+), 89 deletions(-) diff --git a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions.out b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions.out index 475718ea99..cbfcbbca4c 100644 --- a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions.out +++ b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions.out @@ -1,25 +1,27 @@ -- Reranking function tests -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon'); - rerank_distance +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); + round +-------- + 0.8989 +(1 row) + +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) AS x); + array ----------------- - 0.8989152 + {0.8989,1.3018} (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); - rerank_distance ------------------------ - {0.8989152,1.3018152} +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); + round +--------- + -0.8989 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon'); - rerank_score --------------- - -0.8989152 -(1 row) - -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); - rerank_score -------------------------- - {-0.8989152,-1.3018152} +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) as x); + array +------------------- + {-0.8989,-1.3018} (1 row) diff --git a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions_enhanced.out b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions_enhanced.out index b610896fa2..e27eb6791d 100644 --- a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions_enhanced.out +++ b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/expected/reranking_functions_enhanced.out @@ -1,41 +1,41 @@ -- Reranking function tests - single passage -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon'); - rerank_distance ------------------ - 0.8989152 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); + round +-------- + 0.8989 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the tanks fired at the buildings'); - rerank_distance ------------------ - 1.3018152 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the tanks fired at the buildings')::NUMERIC,4); + round +-------- + 1.3018 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('query about cats', 'information about felines'); - rerank_distance ------------------ - 1.3133051 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('query about cats', 'information about felines')::NUMERIC,4); + round +-------- + 1.3133 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('', 'empty query test'); - rerank_distance ------------------ - 0.7075559 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('', 'empty query test')::NUMERIC,4); + round +-------- + 0.7076 (1 row) -- Reranking function tests - array of passages -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', - ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); - rerank_distance ------------------------ - {0.8989152,1.3018152} +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) AS x); + array +----------------- + {0.8989,1.3018} (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('query about programming', - ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases']); - rerank_distance ------------------------------------- - {0.16591403,0.33475375,0.10132827} +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_distance('query about programming', + ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases'])) AS x); + array +------------------------ + {0.1659,0.3348,0.1013} (1 row) SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('empty array test', ARRAY[]::text[]); @@ -45,43 +45,43 @@ SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('empty array test', ARRAY[]: (1 row) -- Reranking score function tests - single passage -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon'); - rerank_score --------------- - -0.8989152 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); + round +--------- + -0.8989 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the tanks fired at the buildings'); - rerank_score --------------- - -1.3018152 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the tanks fired at the buildings')::NUMERIC,4); + round +--------- + -1.3018 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('query about cats', 'information about felines'); - rerank_score --------------- - -1.3133051 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('query about cats', 'information about felines')::NUMERIC,4); + round +--------- + -1.3133 (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('', 'empty query test'); - rerank_score --------------- - -0.7075559 +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('', 'empty query test')::NUMERIC,4); + round +--------- + -0.7076 (1 row) -- Reranking score function tests - array of passages -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', - ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); - rerank_score -------------------------- - {-0.8989152,-1.3018152} +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) AS x); + array +------------------- + {-0.8989,-1.3018} (1 row) -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('query about programming', - ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases']); - rerank_score ---------------------------------------- - {-0.16591403,-0.33475375,-0.10132827} +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_score('query about programming', + ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases'])) AS x); + array +--------------------------- + {-0.1659,-0.3348,-0.1013} (1 row) SELECT rag_jina_reranker_v1_tiny_en.rerank_score('empty array test', ARRAY[]::text[]); diff --git a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions.sql b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions.sql index 0837b18ffd..851692e350 100644 --- a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions.sql +++ b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions.sql @@ -1,8 +1,10 @@ -- Reranking function tests -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) AS x); -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); \ No newline at end of file +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) as x); \ No newline at end of file diff --git a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions_enhanced.sql b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions_enhanced.sql index b967d9e98e..98368d533d 100644 --- a/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions_enhanced.sql +++ b/docker-compose/ext-src/rag_jina_reranker_v1_tiny_en-src/sql/reranking_functions_enhanced.sql @@ -1,35 +1,35 @@ -- Reranking function tests - single passage -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the tanks fired at the buildings'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', 'the tanks fired at the buildings')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('query about cats', 'information about felines'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('query about cats', 'information about felines')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('', 'empty query test'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_distance('', 'empty query test')::NUMERIC,4); -- Reranking function tests - array of passages -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', - ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_distance('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) AS x); -SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('query about programming', - ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases']); +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_distance('query about programming', + ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases'])) AS x); SELECT rag_jina_reranker_v1_tiny_en.rerank_distance('empty array test', ARRAY[]::text[]); -- Reranking score function tests - single passage -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the baboon played with the balloon')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the tanks fired at the buildings'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', 'the tanks fired at the buildings')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('query about cats', 'information about felines'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('query about cats', 'information about felines')::NUMERIC,4); -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('', 'empty query test'); +SELECT ROUND(rag_jina_reranker_v1_tiny_en.rerank_score('', 'empty query test')::NUMERIC,4); -- Reranking score function tests - array of passages -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', - ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings']); +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_score('the cat sat on the mat', + ARRAY['the baboon played with the balloon', 'the tanks fired at the buildings'])) AS x); -SELECT rag_jina_reranker_v1_tiny_en.rerank_score('query about programming', - ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases']); +SELECT ARRAY(SELECT ROUND(x::NUMERIC,4) FROM unnest(rag_jina_reranker_v1_tiny_en.rerank_score('query about programming', + ARRAY['Python is a programming language', 'Java is also a programming language', 'SQL is used for databases'])) AS x); SELECT rag_jina_reranker_v1_tiny_en.rerank_score('empty array test', ARRAY[]::text[]);