-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Description
I am testing my crew with 3 agents and I have a PDFKnowledgeSource defined.
When running 'crewai test' I get this error.
Steps to Reproduce
I am testing my crew with 3 agents and I have a PDFKnowledgeSource defined.
from licenseproai.tools.pdf_knowledge_source import PDFKnowledgeSource
Knowledge base
pdf_source = PDFKnowledgeSource(file_paths=["cnmi.pdf"])
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'],
tools=[self.search_tool],
verbose=True,
knowledge_sources=[pdf_source],
llm=self.llm
)
When running 'crewai test' I get this error: Exception: An error occurred while testing the crew: Can't instantiate abstract class BaseKnowledgeSource without an implementation for abstract methods 'add', 'validate_content'.
I have used both the standard import and also imported the PDFKnowledgeSource file under my project without making any changes to it.
I get the same error in both cases.
Expected behavior
PDFKnowledgeSource should work properly, as per the documentation.
Screenshots/Code snippets
from licenseproai.tools.pdf_knowledge_source import PDFKnowledgeSource
Knowledge base
pdf_source = PDFKnowledgeSource(file_paths=["cnmi.pdf"])
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'],
tools=[self.search_tool],
verbose=True,
knowledge_sources=[pdf_source],
llm=self.llm
)
Operating System
Windows 10
Python Version
3.12
crewAI Version
0.114.0
crewAI Tools Version
0.40.1
Virtual Environment
Conda
Evidence
PS C:\Users\ppalacean\Desktop\licenseproai> crewai test
Testing the crew for 3 iterations with model gpt-4o-mini
LLM value is already an LLM object
LLM value is already an LLM object
LLM value is already an LLM object
Traceback (most recent call last):
File "C:\Users\ppalacean\Desktop\licenseproai\src\licenseproai\main.py", line 64, in test
Licenseproai().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs)
File "C:\Users\ppalacean\Desktop\licenseproai.venv\Lib\site-packages\crewai\crew.py", line 1119, in test
test_crew = self.copy()
^^^^^^^^^^^
File "C:\Users\ppalacean\Desktop\licenseproai.venv\Lib\site-packages\crewai\crew.py", line 1041, in copy
cloned_agents = [agent.copy() for agent in self.agents]
^^^^^^^^^^^^
File "C:\Users\ppalacean\Desktop\licenseproai.venv\Lib\site-packages\crewai\agents\agent_builder\base_agent.py", line 265, in copy
copied_agent = type(self)(**copied_data, llm=existing_llm, tools=self.tools)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ppalacean\Desktop\licenseproai.venv\Lib\site-packages\pydantic\main.py", line 214, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Can't instantiate abstract class BaseKnowledgeSource without an implementation for abstract methods 'add', 'validate_content'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\ppalacean\Desktop\licenseproai.venv\Scripts\test.exe_main.py", line 10, in
File "C:\Users\ppalacean\Desktop\licenseproai\src\licenseproai\main.py", line 67, in test
raise Exception(f"An error occurred while testing the crew: {e}")
Exception: An error occurred while testing the crew: Can't instantiate abstract class BaseKnowledgeSource without an implementation for abstract methods 'add', 'validate_content'
An error occurred while testing the crew: Command '['uv', 'run', 'test', '3', 'gpt-4o-mini']' returned non-zero exit status 1.
Possible Solution
None
Additional context
None