Enable registering and retrieving tools from a path
- Example usage
from metagpt.tools.tool_recommend import BM25ToolRecommender
tools = ["workspace/scikit_learn/sklearn/linear_model"]
req = "Classify wine dataset with logistic regression"
tr = BM25ToolRecommender(tools=tools)
results = await tr.recall_tools(req) # recall only
results = await tr.recommend_tools(req) # recall + llm rank
# results are list[Tool]
print(results[0].name)
print(results[0].path)
print(results[0].code)
- output
Codecov Report
Attention: Patch coverage is 34.65347% with 66 lines in your changes are missing coverage. Please review.
Project coverage is 81.64%. Comparing base (
916185d) to head (da98495). Report is 35 commits behind head on swebench_di.
| Files | Patch % | Lines |
|---|---|---|
| metagpt/tools/tool_convert.py | 21.42% | 44 Missing :warning: |
| metagpt/tools/tool_registry.py | 30.00% | 21 Missing :warning: |
| metagpt/strategy/task_type.py | 83.33% | 1 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## swebench_di #1097 +/- ##
===============================================
- Coverage 81.85% 81.64% -0.21%
===============================================
Files 246 246
Lines 13724 13809 +85
===============================================
+ Hits 11234 11275 +41
- Misses 2490 2534 +44
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Are the test cases enough?
Not enough yet. Since its target is not main, I suggest merging it first if needed. Tests must be supplemented if merge is filed to main later.
I recommend using the example mentioned in the issue as a test case. In addition, try to add as few self-consistent examples as possible to illustrate the function itself.
BTW, is "workspace/scikit_learn/sklearn/linear_model" the only way to use it? import sklearn.linear_model and use it may be better?