RAG Tools (docx, pdf search) returns error

Hi,

My code is pretty simple, but I can’t get the PDF Search or Docx search tools to work. My LLM connection is working, because the agent is able to generate a response, but it can’t read from the pdf.

Using tool: Search a PDF’s content
2024-12-11 15:49:16 +1100 52523 execution.flow INFO [testpy in line 0 (index starts from 0)] stdout> ## Tool Input:
“{"query": "test query"}”

It always responds with Error code: 404 - {‘error’: {‘code’: ‘404’, ‘message’: ‘Resource not found’}}, and then it retries multiple times, before eventually moving on to the next task.

This is my code:

@CrewBase
class TestCrew:
    agents_config = 'config/agents.yaml'
    tasks_config = 'config/tasks.yaml'
    
    def __init__(self, azure_open_ai_connection: AzureOpenAIConnection, azure_search_connection: CognitiveSearchConnection, local_files_location: str):

        os.environ["OPENAI_API_KEY"] = azure_open_ai_connection.api_key
        os.environ["OPENAI_API_BASE"] = azure_open_ai_connection.api_base
        os.environ["OPENAI_API_VERSION"] = azure_open_ai_connection.api_version
        os.environ["OPENAI_API_TYPE"] = "azure"

        self.azure_connection = azure_open_ai_connection
        self.llm = self._setup_llm()
        self.pdf_tool = PDFSearchTool(pdf="./test.pdf")
        self.docx_tool = DOCXSearchTool()

        super().__init__()
    
    def _setup_llm(self) -> LLM:
        """Setup LLM with Azure OpenAI connection"""

        return LLM(
            model="azure/gpt-4o",
            temperature=0.7,
            api_base=self.azure_connection.api_base,
            api_key=self.azure_connection.api_key,
            api_version=self.azure_connection.api_version
        )
    
    @agent
    def researcher(self) -> Agent:
        return Agent(
            config = self.agents_config['researcher'],
            llm = self.llm,
        )
    
    @task
    def gather_context_task(self) -> Task:
        return Task(
            config=self.tasks_config['research_task'],
            agent=self.researcher(),
            tools = [self.pdf_tool]
        )  
    
    @crew
    def crew(self) -> Crew:
        return Crew(
            agents=self.agents,
            tasks=self.tasks,
            process=Process.sequential,
            verbose=True
        )