I have a problem, my agent cannot access the file that I placed in the knowledge folder, I have already debugged the file and extracted the text completely, I pass it to the agent and even so it cannot access it, it returns the following response:
“Unfortunately, I don’t have access to external files or documents, including the “main_document.md” file mentioned. To proceed, please provide the content of the document here, and I will assist you in extracting the required information and formatting it into the specified JSON schema.”
I tried using different approaches to pass this file as a knowledge source using TextFileKnowledgeSource, StringKnowledgeSource and CrewDoclingSource, but it still doesn’t work, in the task description I clearly implied that it was necessary to consult the content that is in the knowledge folder as a source of knowledge in the following section:
" Input Data for reference:
Document Content: The content is available in the knowledge source file main_document.md. Make sure to thoroughly analyze this document for the required information."
I also tried to apply the parameter: knowledge_sources=[self.knowledge_source] both to the agent directly and to the crew and even to both
my document is in knowledge/data/file/main_document.md
my agent code:
class Agents:
def init(self, model: str, api_key: str, temperature: float, top_p: float):
os.environ[“OPENAI_API_KEY”] = api_key
self.llm = LLM(
model=model,
api_key=api_key,
temperature=temperature,
top_p=top_p,
)
self.agents_config = self.load_yaml("config/agents.yaml")
self.tasks_config = self.load_yaml("config/tasks.yaml")
def load_yaml(self, filepath):
with open(filepath, "r") as f:
return yaml.safe_load(f)
files = glob.glob("knowledge/data/**/*.md", recursive=True)
files = [file.replace("knowledge/", "", 1) for file in files]
print(f"Found {files} markdown files.")
knowledge_source = CrewDoclingSource(file_paths=files)
# with open("knowledge/data/file/main_document.md", "r") as file:
# content = file.read()
# print(f"Found {content} markdown files.")
# knowledge_source = StringKnowledgeSource(content=content)
@agent
def get_specific_info_agent(self) -> Agent:
return Agent(
config=self.agents_config["GetSpecificInfoAgent"],
llm=self.llm,
max_iter=5,
verbose=True,
knowledge_sources=[self.knowledge_source]
)
@task
def get_specific_info_task(self) -> Task:
return Task(
config=self.tasks_config["GetSpecificInfoTask"],
agent=self.get_specific_info_agent(),
)
def call_agent(self) -> Crew:
return Crew(
agents=[
self.get_specific_info_agent(),
],
tasks=[
self.get_specific_info_task(),
],
verbose=True,
knowledge_sources=[self.knowledge_source]
)
It’s my first time using this parameter in my agent system, I followed the documentation, but I don’t know if I asked for something important, I would love if someone could help me