Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LAE
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
文靖昊
LAE
Commits
e7755af4
Commit
e7755af4
authored
Jun 28, 2024
by
tinywell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add BgeRerank test for document reranking
parent
582deb2e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
k_store_test.py
test/k_store_test.py
+12
-2
No files found.
test/k_store_test.py
View file @
e7755af4
...
...
@@ -15,6 +15,7 @@ from src.config.consts import (
INDEX_NAME
)
from
src.loader.callback
import
BaseCallback
from
src.server.rerank
import
BgeRerank
sys
.
path
.
append
(
"../"
)
...
...
@@ -81,6 +82,15 @@ def test_faiss_load():
print
(
vecstore_faiss
.
join_document
(
vecstore_faiss
.
get_text_similarity
(
"我国什么时候全面开放低空领域"
)))
def
test_reranker
():
from
langchain_core.documents
import
Document
reranker
=
BgeRerank
(
model_name
=
"BAAI/bge-reranker-large"
)
docs
=
[
"低空经济是指在 200 米的空域相关业务"
,
"我国什么时候全面开放低空领域"
,
"今天早上雨很大"
]
docs2
=
[
Document
(
page_content
=
d
)
for
d
in
docs
]
print
(
reranker
.
bge_rerank
(
"我国什么时候全面开放低空领域"
,
docs
))
print
(
reranker
.
compress_documents
(
docs2
,
"我国什么时候全面开放低空领域"
))
if
__name__
==
"__main__"
:
test_faiss_from_dir
()
test_faiss_load
()
# test_faiss_from_dir()
# test_faiss_load()
test_reranker
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment