Embedder error in KnowledgeBase

I’m using PDFKnowledgeBase in the following way:

class GPTService:
    def __init__(self):
        self.model = AzureOpenAI(
            id=AZURE_OPENAI_CONFIG["model"],
            api_key=AZURE_OPENAI_CONFIG["api_key"],
            api_version=AZURE_OPENAI_CONFIG["api_version"],
            azure_endpoint=AZURE_OPENAI_CONFIG["azure_endpoint"]
        )

        self.knowledge_base = PDFKnowledgeBase(
            path="app/data/files/BPHS.pdf",
            chunking_strategy=DocumentChunking(
                chunk_size=500,
                overlap=0,
            ),
            vector_db=ChromaDb(
                collection="bphs",
                embedder=AzureOpenAIEmbedder(),
                # persistent_client=True,
                path="app/data/chroma_db"
            ),
        )
        self.knowledge_base.load(recreate=True)
        print("Loaded documents:", len(list(self.knowledge_base.document_lists)))

        self.agent = Agent(
            model=self.model,
            system_message=SYSTEM_PROMPT,
            knowledge=self.knowledge_base,
            search_knowledge=True,
            add_history_to_messages=True,
            num_history_responses=10,
            read_chat_history=True,
            markdown=True,
            monitoring=True
        )

When I remove the vector_db part, the agent works fine.
But with the vector_db, it gives the following error. I don’t know why.

    File "D:\AskDevi Intern\ask-devi\devi-backend\.venv\Lib\site-packages\openai\_base_client.py", line 1034, in request
        raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}

The agent works fine without the knowledge base.
Also, I’m using Azure OpenAI API keys and not OpenAI API keys.

Hey @Hrish17
thanks for reaching out and supporting Agno. I’ve shared this with the team, we’re working through all requests one by one and will get back to you soon.
If it’s urgent, please let us know. We appreciate your patience!

Hey @Hrish17 I tried a similar code pattern and it works for me see below-

Also make sure you have the following api keys-

AZURE_OPENAI_API_KEY=
AZURE_OPENAI_ENDPOINT=

AZURE_EMBEDDER_DEPLOYMENT="text-embedding-3-large"
AZURE_EMBEDDER_OPENAI_API_KEY=
AZURE_EMBEDDER_OPENAI_ENDPOINT=
"""Run `pip install duckduckgo-search sqlalchemy pgvector pypdf openai` to install dependencies."""

from agno.agent import Agent
from agno.embedder.azure_openai import AzureOpenAIEmbedder
from agno.knowledge.pdf import PDFKnowledgeBase, PDFReader
from agno.models.azure import AzureOpenAI
from agno.vectordb.chroma import ChromaDb

# Initialize ChromaDB
vector_db = ChromaDb(collection="recipes",
                     path="tmp/chromadb", persistent_client=True, embedder=AzureOpenAIEmbedder())

knowledge_base = PDFKnowledgeBase(
    path="libs/agno/tests/integration/knowledge/data/thai_recipes_short.pdf",
    vector_db=vector_db,
    reader=PDFReader(chunk=True),
)
knowledge_base.load(recreate=True)  # Comment out after first run

agent = Agent(
    model=AzureOpenAI(id="gpt-4o-mini"),
    knowledge=knowledge_base,
    show_tool_calls=True,
    debug_mode=True,
)
agent.print_response("How to make Thai curry?", markdown=True)