mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-05 16:02:14 +02:00
update code: reduce top-k number and change k during runtime
This commit is contained in:
parent
4b29758dd8
commit
a893da1a39
6 changed files with 51 additions and 40 deletions
|
|
@ -26,7 +26,13 @@ class RetrieveSkills(Action):
|
|||
if k == 0:
|
||||
return []
|
||||
logger.info(f"Skill Manager retrieving for {k} skills")
|
||||
docs_and_scores = vectordb.similarity_search_with_score(query, k=k)
|
||||
try:
|
||||
docs_and_scores = vectordb.similarity_search_with_score(query, k=k)
|
||||
|
||||
except Exception as e:
|
||||
docs_and_scores = vectordb.similarity_search_with_score(query, k=1)
|
||||
logger.debug(f"{e}")
|
||||
|
||||
logger.info(
|
||||
f"Skill Manager retrieved skills: "
|
||||
f"{', '.join([doc.metadata['name'] for doc, _ in docs_and_scores])}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue