revamping crewai tool

This commit is contained in:
João Moura
2024-02-25 21:11:09 -03:00
parent 7c99e9ab50
commit 50bae27948
21 changed files with 100 additions and 144 deletions

View File

@@ -1,21 +0,0 @@
from crewai_tools.tools.rag.rag_tool import Adapter, RagTool
class MockAdapter(Adapter):
answer: str
def query(self, question: str) -> str:
return self.answer
def test_rag_tool():
adapter = MockAdapter(answer="42")
rag_tool = RagTool(adapter=adapter)
assert rag_tool.name == "Knowledge base"
assert (
rag_tool.description == "A knowledge base that can be used to answer questions."
)
assert (
rag_tool.run("What is the answer to life, the universe and everything?") == "42"
)