Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into agent
Browse files Browse the repository at this point in the history
  • Loading branch information
cike8899 committed Oct 28, 2024
2 parents 5ee321f + d133cc0 commit ce30997
Show file tree
Hide file tree
Showing 20 changed files with 7,943 additions and 5,564 deletions.
10 changes: 2 additions & 8 deletions agent/component/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,19 @@ def check(self):
self.check_decimal_float(self.similarity_threshold, "[Retrieval] Similarity threshold")
self.check_decimal_float(self.keywords_similarity_weight, "[Retrieval] Keywords similarity weight")
self.check_positive_number(self.top_n, "[Retrieval] Top N")
self.check_empty(self.kb_ids, "[Retrieval] Knowledge bases")


class Retrieval(ComponentBase, ABC):
component_name = "Retrieval"

def _run(self, history, **kwargs):
# query = []
# for role, cnt in history[::-1][:self._param.message_history_window_size]:
# if role != "user":continue
# query.append(cnt)
# # query = "\n".join(query)
# query = query[0]
query = self.get_input()
query = str(query["content"][0]) if "content" in query else ""

kbs = KnowledgebaseService.get_by_ids(self._param.kb_ids)
if not kbs:
raise ValueError("Can't find knowledgebases by {}".format(self._param.kb_ids))
return Retrieval.be_output("")

embd_nms = list(set([kb.embd_id for kb in kbs]))
assert len(embd_nms) == 1, "Knowledge bases use different embedding models."

Expand Down
1,588 changes: 916 additions & 672 deletions agent/templates/DB Assistant.json

Large diffs are not rendered by default.

Loading

0 comments on commit ce30997

Please sign in to comment.