I have been trying to specify custom text sources for my Agent as well as my Crew, which is failing.
I am running Ollama locally, and using llama3.
Initially I tried to add a custom source to my agent like this:
text_source = TextFileKnowledgeSource(
file_paths=["./source.txt"]
)
return Agent(
config=self.agents_config['Source_updater'],
verbose=True,
llm = ollama_llm,
tools=[GetAccessToken(), ....],
knowledge_sources=[text_source],
max_iter=5
)
But it was asking for an OpenAI api key… I checked the community chats and found that it defaults to OpenAI, and we have to provide embedder configuration for it. so I provided the same:
embedder={
"provider": "ollama",
"config": {
"model": "nomic-embed-text",
}
},
but it still throws an error…
[2025-02-19 12:07:04][ERROR]: Failed to upsert documents: Expected Embedings to be non-empty list or numpy array, got [] in upsert.
So I tried adding the source to the Crew itself,
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True,
knowledge_sources=[text_source],
embedder={
"provider": "ollama",
"config": {
"model": "nomic-embed-text",
}
},
)
Doing this, the crew doesn’t entirely crash, it runs, but doesn’t seem to take in the knowledge source:
python main.py
check:: True
[2025-02-19 12:10:56][ERROR]: Failed to upsert documents: Expected Embedings to be non-empty list or numpy array, got [] in upsert.
[2025-02-19 12:10:56][WARNING]: Failed to init knowledge: Expected Embedings to be non-empty list or numpy array, got [] in upsert.
# Agent: Source Agent
Anyone facing the same issues?
Any help will be greatly appreciated!