🤔 Flows - CrewDoclingSource Markdown Knowledge Source Error, Ollama Local LLM Environment

Hi!
I would greatly appreciate any insights on this issue. :blush:
I’m attempting to utilize a markdown.md file as a knowledge source within a crew that is currently in a flow.
The entire environment is local, and I’m working with Ollama.
The knowledge file is located in a folder named [knowledge], which resides in the same directory as main.py.

:fire: Knowledge integration works seamlessly in a single .py crew, in that I can also successfully use a .md file.

Here is the Error:

[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'

Versions:
Crewai: 0.100.1
crewai-tools: 0.33.0
Python 3.12.8
Using Ollama only, local llms i have tried. deepseekR1:7b, llama3.2:3b. others
Different temps.

Here is my code:

# /crews/poem_crew/poemcrew.py
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
knowledge_source = CrewDoclingSource(
    file_paths=["knowledge.md"]
)

And

# /crews/poem_crew/poemcrew.py
@CrewBase
class PoemCrew:
    """Poem Crew"""

    agents_config = "config/agents.yaml"
    tasks_config = "config/tasks.yaml"
    llm = LLM(model="ollama/deepseek-r1:7b", temperature=0.7)

    @agent
    def poem_writer(self) -> Agent:
        return Agent(
            config=self.agents_config["poem_writer"],
            # memory=True,
            llm=self.llm,
            # LLM=LLM(model="ollama/llama3-70b-8192", temperature=0.3),
        )

    @task
    def write_poem(self) -> Task:
        return Task(
            config=self.tasks_config["write_poem"],
        )

    @crew
    def crew(self) -> Crew:

        return Crew(
            agents=self.agents,
            tasks=self.tasks,
            process=Process.sequential,
            # memory=True,
            verbose=True,
            knowledge_sources=[knowledge_source],
            embedder={
                "provider": "ollama",
                "config": {
                    "model": "mxbai-embed-large"
                }
            }
        )

I have also tried the following:

# /crews/poem_crew/poemcrew.py
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
knowledge_source = CrewDoclingSource(
    file_paths=["knowledge.md"],
    chunk_size=4000,     # Characters per chunk (default)
    chunk_overlap=200,  # Overlap between chunks (default)
)

and

# /crews/poem_crew/poemcrew.py
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
from crewai.knowledge.storage.knowledge_storage import KnowledgeStorage
knowledge_source = CrewDoclingSource(
    file_paths=["knowledge.md"],
    storage=KnowledgeStorage(
        embedder_config={
            "provider": "ollama",
            "model": "nomic-embed-text",
            "base_url": "http://localhost:11434"
        }
    )
)
  • The above gives a slightly Different Error:
    Failed to upsert documents: APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’

tried updating:

pip Install --upgrade crewai crewai-tools transformers tokenizers docling docling-core
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
from crewai.knowledge.source.text_file_knowledge_source import TextFileKnowledgeSource

:point_right:t2: Anyone have any examples of a fow: crew.py with Knowledge, CrewDoclingSource and markdown.md with just ollama?

** Is this a flow problem?

Possible Solution - None, I think the sub library just needs to be fixed

Hello

This can also mean that embedding are not being generated and saved in chroma. Put the logger (below code) when you run crew code blog and observe the logs. You might see 429 status code somewhere.

import logging
logging.basicConfig(level=logging.DEBUG)

Try with some open source embedder in that case as shown below:

crew = Crew(
agents=[agent],
tasks=[task],
memory=False,
verbose=True,
knowledge_sources=[pdf_source], 
embedder={
    "provider": "google",
    "config": {
        "model": "models/text-embedding-004",
        "api_key": os.getenv("GEMINI_API_KEY"),
    }
}

Hope it helps :slight_smile:

1 Like

Hello deepak_Dhiman
Thank you for reaching out,
I am using debugging, and i have entered the debugging at the top of my crew.py

print('🪰--- #1 | Debugging 2025.02.10  -------🪰')
import logging
import litellm
logging.basicConfig(level=logging.DEBUG)
litellm.set_verbose = True
os.environ['LITELLM_LOG'] = 'DEBUG'  # Enable detailed logging for LiteLLM
os.environ['LITELLM_CACHE'] = 'True'   # Enable caching to improve API response performance

I am using Ollama.
What exactly is the 429 status code?

Hi Matthew

429 status code is related to API overloaded issue in case of OpenAI and Azure OpenAI. Although you said you are using some other model using Ollama wrapper. So I am not sure how helpful it would be for you. Nonetheless if you are getting APIStatusError.init() missing 2 required keyword-only arguments: ‘response’ and ‘body’ type of error, it indicates that embeddings are not formed and saved in Chroma DB.

Why don’t you try with open source models such as Huggingface or Gemini or Groq. That way you will know whether you have model specific error or it something else. My suggestion is, that you experiment with smaller data file for now. All the best :slight_smile:

https://help.openai.com/en/articles/6891829-error-code-429-rate-limit-reached-for-requests

Fixed the issue. :face_with_head_bandage:
went back to single py file “crew.py”
running just crew.py (kept agents.yaml and tasks.py in config folder)
added this to the bottom of the crew.py
news_input = get_news_input()

poem_crew_instance = PoemCrew() # Create an instance of PoemCrew
crew_object = poem_crew_instance.crew() # Call the crew() method to get a Crew object
result = crew_object.kickoff(inputs=news_input) # Now call kickoff()
print(result)

and everything works great!! ollama, gemini, groq… etc
Hope this helps someone who is stuck!
Never Give Up! :muscle:t2: :fire:

1 Like

I also have this issue when trying to use PDF as knowledge source.

Tried the gemini embedder as suggested but does not work.

I have it working now!
:white_check_mark: CrewDoclingSource Markdown File Knowledge File
:white_check_mark: Ollama using Knowledge md file
:white_check_mark: Update a knowledge markdown file using Obsidian, Knowledge file outside of the script directory for a crew

Here is the code for the community! hope this helps someone

knowledge_file = Path(userprofile_dir) / "OneDrive" / "Documents" / "Obsidian2025" / "matt" / "IN" / "knowledge" / "knowledge.md"
print(f"Looking for knowledge file at: {knowledge_file}")
print(f"File exists: {knowledge_file.exists()}")from crewai.knowledge.storage.knowledge_storage import KnowledgeStorage
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
# Initialize the knowledge storage with Ollama embeddings
knowledge_storage = KnowledgeStorage()
knowledge_storage._set_embedder_config({
    "provider": "ollama",
    "config": {
        "model": "mxbai-embed-large",
        "api_key": "NA",
        "base_url": "http://127.0.0.1:11434"
    }
})

knowledge_source = CrewDoclingSource(
    file_paths=[knowledge_file],
    storage=knowledge_storage
)
print(f"✅ Knowledge source initialized with file: {knowledge_file}")