PDFKnowledgeSource APIStatusError

When initializing a PDFKnowledgeSource component with CrewAI, I’m encountering a critical error that prevents document ingestion: APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’. The error occurs specifically during the document “upserting” process, where PDFKnowledgeSource tries to load PDF content into Mem0 storage. The logs show [ERROR]: Failed to upsert documents: APIStatusError.init() missing 2 required keyword-only arguments followed by [WARNING]: Failed to init knowledge.


If anyone knows how to deal with the error, I would greatly appreciate that, thank you.

(base) maxnaro@Maxims-MacBook-Pro crewai-customerzero % cd “/Users/maxnaro/Documents/itnb ag/cursor_agents/NEW BEGINNING (07.03.2025)/my-concierge-crewai/crewai-customerzero” && cd src/crewai-customerzero && python main.py
ERROR:crew:Error during PDFKnowledgeSource inspection: ImportError - cannot import name ‘KnowledgeStorage’ from ‘crewai.knowledge’ (/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/crewai/knowledge/init.py)
Traceback (most recent call last):
File “/Users/maxnaro/Documents/itnb ag/cursor_agents/NEW BEGINNING (07.03.2025)/my-concierge-crewai/crewai-customerzero/src/crewai-customerzero/crew.py”, line 58, in
from crewai.knowledge import KnowledgeStorage
ImportError: cannot import name ‘KnowledgeStorage’ from ‘crewai.knowledge’ (/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/crewai/knowledge/init.py)

=== CustomerZero Knowledge Assistant ===
Type ‘exit’, ‘quit’, or ‘bye’ to end the conversation.
Type ‘save’ to save the current response to a file.
Full session log will be saved to: /Users/maxnaro/Documents/itnb ag/cursor_agents/NEW BEGINNING (07.03.2025)/my-concierge-crewai/crewai-customerzero/src/crewai-customerzero/output/full_session_20250331_140152.txt

[2025-03-31 14:01:52][ERROR]: Failed to upsert documents: APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’

[2025-03-31 14:01:52][WARNING]: Failed to init knowledge: APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’
User: exit
Assistant: Goodbye! It was nice talking to you.

getting similar error. Any update on this ??

Hi Max and welcome to the community Niya

What version of crewai are you running @maxnaro

Name: crewai
Version: 0.121.1

Im getting
[ERROR]: Failed to upsert documents: APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’
[WARNING]: Failed to init knowledge: APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’

while trying to add knowledge_sources to crew

self.crew = Crew(
agents=[

],
tasks=,
process=Process.sequential,
verbose=True,
manager_llm=self.llm,
knowledge_sources=[pdf_knowledge],
embedder=embedder_config,
)

pdf_knowledge = PDFKnowledgeSource(
    file_paths=["sample.pdf"],  
)

From reading through there are a couple of areas

  • worth upgrading to latest version
  • check the path to the pdf_filename
  • ensure your environment is working correctly

Whenever I get stuck like this.. I use crewai create crew test a new crew and then add in the tool I want to use… It means you can avoid any other code etc.

Hope this helps