mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-06 06:12:39 +02:00
docstring are usually english, discard jieba tokenizer
This commit is contained in:
parent
8d4567ea19
commit
28d293d490
2 changed files with 3 additions and 5 deletions
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
import json
|
||||
from typing import Any
|
||||
|
||||
import jieba
|
||||
import numpy as np
|
||||
from pydantic import BaseModel, field_validator
|
||||
from rank_bm25 import BM25Okapi
|
||||
|
|
@ -182,7 +181,7 @@ class BM25ToolRecommender(ToolRecommender):
|
|||
self.bm25 = BM25Okapi(tokenized_corpus)
|
||||
|
||||
def _tokenize(self, text):
|
||||
return jieba.lcut(text) # FIXME: needs more sophisticated tokenization
|
||||
return text.split() # FIXME: needs more sophisticated tokenization
|
||||
|
||||
async def recall_tools(self, context: str = "", plan: Plan = None, topk: int = 20) -> list[Tool]:
|
||||
query = plan.current_task.instruction if plan else context
|
||||
|
|
@ -193,7 +192,7 @@ class BM25ToolRecommender(ToolRecommender):
|
|||
recalled_tools = [list(self.tools.values())[index] for index in top_indexes]
|
||||
|
||||
logger.info(
|
||||
f"Recalled tools: \n{[tool.name for tool in recalled_tools]}; Scores: {[doc_scores[index] for index in top_indexes]}"
|
||||
f"Recalled tools: \n{[tool.name for tool in recalled_tools]}; Scores: {[np.round(doc_scores[index], 4) for index in top_indexes]}"
|
||||
)
|
||||
|
||||
return recalled_tools
|
||||
|
|
|
|||
|
|
@ -71,5 +71,4 @@ Pillow
|
|||
imap_tools==1.5.0 # Used by metagpt/tools/libs/email_login.py
|
||||
qianfan==0.3.2
|
||||
dashscope==1.14.1
|
||||
rank-bm25==0.2.2 # for tool recommendation
|
||||
jieba==0.42.1 # for tool recommendation
|
||||
rank-bm25==0.2.2 # for tool recommendation
|
||||
Loading…
Add table
Add a link
Reference in a new issue