Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
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
ai-tech
dify
Commits
0d9ce1ba
Unverified
Commit
0d9ce1ba
authored
Nov 21, 2023
by
Jyong
Committed by
GitHub
Nov 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix multi retrieval with resource score issue (#1578)
Co-authored-by:
jyong
<
jyong@dify.ai
>
parent
519fb90d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
dataset_multi_retriever_tool.py
api/core/tool/dataset_multi_retriever_tool.py
+6
-1
dataset_retriever_tool.py
api/core/tool/dataset_retriever_tool.py
+3
-3
No files found.
api/core/tool/dataset_multi_retriever_tool.py
View file @
0d9ce1ba
...
...
@@ -80,6 +80,9 @@ class DatasetMultiRetrieverTool(BaseTool):
hit_callback
=
DatasetIndexToolCallbackHandler
(
self
.
conversation_message_task
)
hit_callback
.
on_tool_end
(
all_documents
)
document_score_list
=
{}
for
item
in
all_documents
:
document_score_list
[
item
.
metadata
[
'doc_id'
]]
=
item
.
metadata
[
'score'
]
document_context_list
=
[]
index_node_ids
=
[
document
.
metadata
[
'doc_id'
]
for
document
in
all_documents
]
...
...
@@ -120,8 +123,10 @@ class DatasetMultiRetrieverTool(BaseTool):
'document_name'
:
document
.
name
,
'data_source_type'
:
document
.
data_source_type
,
'segment_id'
:
segment
.
id
,
'retriever_from'
:
self
.
retriever_from
'retriever_from'
:
self
.
retriever_from
,
'score'
:
document_score_list
.
get
(
segment
.
index_node_id
,
None
)
}
if
self
.
retriever_from
==
'dev'
:
source
[
'hit_count'
]
=
segment
.
hit_count
source
[
'word_count'
]
=
segment
.
word_count
...
...
api/core/tool/dataset_retriever_tool.py
View file @
0d9ce1ba
...
...
@@ -196,10 +196,10 @@ class DatasetRetrieverTool(BaseTool):
'document_name'
:
document
.
name
,
'data_source_type'
:
document
.
data_source_type
,
'segment_id'
:
segment
.
id
,
'retriever_from'
:
self
.
retriever_from
'retriever_from'
:
self
.
retriever_from
,
'score'
:
document_score_list
.
get
(
segment
.
index_node_id
,
None
)
}
if
dataset
.
indexing_technique
!=
"economy"
:
source
[
'score'
]
=
document_score_list
.
get
(
segment
.
index_node_id
)
if
self
.
retriever_from
==
'dev'
:
source
[
'hit_count'
]
=
segment
.
hit_count
source
[
'word_count'
]
=
segment
.
word_count
...
...
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