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
8d484240
Commit
8d484240
authored
Jul 05, 2024
by
文靖昊
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/geo' into geo
parents
2bf3362d
b6378c25
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
k_store_test.py
test/k_store_test.py
+16
-2
rag_test.py
test/rag_test.py
+12
-6
No files found.
test/k_store_test.py
View file @
8d484240
...
@@ -17,7 +17,7 @@ from src.config.consts import (
...
@@ -17,7 +17,7 @@ from src.config.consts import (
from
src.loader.callback
import
BaseCallback
from
src.loader.callback
import
BaseCallback
from
src.server.rerank
import
BgeRerank
from
src.server.rerank
import
BgeRerank
sys
.
path
.
append
(
"../"
)
import
time
# 当返回值中带有“思考题”字样的时候,默认将其忽略。
# 当返回值中带有“思考题”字样的时候,默认将其忽略。
...
@@ -81,6 +81,19 @@ def test_faiss_load():
...
@@ -81,6 +81,19 @@ def test_faiss_load():
reset
=
False
)
reset
=
False
)
print
(
vecstore_faiss
.
join_document
(
vecstore_faiss
.
get_text_similarity
(
"我国什么时候全面开放低空领域"
)))
print
(
vecstore_faiss
.
join_document
(
vecstore_faiss
.
get_text_similarity
(
"我国什么时候全面开放低空领域"
)))
def
test_faiss_search
():
vecstore_faiss
=
VectorStore_FAISS
(
embedding_model_name
=
EMBEEDING_MODEL_PATH
,
store_path
=
FAISS_STORE_PATH
,
index_name
=
INDEX_NAME
,
info
=
{
"port"
:
VEC_DB_PORT
,
"host"
:
VEC_DB_HOST
,
"dbname"
:
VEC_DB_DBNAME
,
"username"
:
VEC_DB_USER
,
"password"
:
VEC_DB_PASSWORD
},
show_number
=
SIMILARITY_SHOW_NUMBER
,
reset
=
False
)
tic
=
time
.
perf_counter
()
print
(
vecstore_faiss
.
get_text_similarity
(
"化隆县的降雨情况如何"
))
toc
=
time
.
perf_counter
()
-
tic
print
(
"Time:"
,
toc
)
def
test_reranker
():
def
test_reranker
():
from
langchain_core.documents
import
Document
from
langchain_core.documents
import
Document
...
@@ -93,4 +106,5 @@ def test_reranker():
...
@@ -93,4 +106,5 @@ def test_reranker():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# test_faiss_from_dir()
# test_faiss_from_dir()
# test_faiss_load()
# test_faiss_load()
test_reranker
()
# test_reranker()
test_faiss_search
()
test/rag_test.py
View file @
8d484240
...
@@ -13,13 +13,18 @@ base_llm = ChatOpenAI(
...
@@ -13,13 +13,18 @@ base_llm = ChatOpenAI(
verbose
=
True
verbose
=
True
)
)
ext
=
QAExt
(
base_llm
)
def
test_qaext
():
question
=
"明天适合去吗?"
ext
=
QAExt
(
base_llm
)
message
=
[
question
=
"明天适合去吗?"
message
=
[
(
"我们明天去爬山吧"
,
"好呀"
),
(
"我们明天去爬山吧"
,
"好呀"
),
(
"天气怎么样"
,
"天气晴朗"
),
(
"天气怎么样"
,
"天气晴朗"
),
]
]
result
=
ext
.
extend_query
(
question
,
message
)
result
=
ext
.
extend_query
(
question
,
message
)
print
(
result
.
content
)
print
(
result
.
content
)
if
__name__
==
"__main__"
:
pass
\ No newline at end of file
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