[Python] Agno (Phidata) reading PDF as knowledge base failed

Discussão em 'Python' iniciado por Stack, Março 3, 2025.

  1. Stack

    Stack Membro Participativo

    This is the code

    from agno.agent import Agent
    from agno.models.openai import OpenAIChat
    from agno.embedder.openai import OpenAIEmbedder
    from agno.knowledge.pdf_url import PDFUrlKnowledgeBase
    from agno.vectordb.lancedb import LanceDb, SearchType

    api_key = 'sk-XXX'

    knowledge_base = PDFUrlKnowledgeBase(
    urls=["https://arxiv.org/pdf/1311.2524v5"],
    vector_db=LanceDb(
    uri="tmp/lancedb",
    table_name="paper",
    search_type=SearchType.hybrid,
    embedder=OpenAIEmbedder(id="text-embedding-3-small", api_key=api_key),
    ),
    )

    agent = Agent(
    model=OpenAIChat(id="gpt-4o", api_key=api_key),
    description="You are a person who read a paper and knows about it",
    instructions=[
    "Search only the knowledge base.",
    "Don't search the web"
    ],
    knowledge=knowledge_base,
    show_tool_calls=True,
    markdown=True
    )


    agent.print_response("what is title of paper?.", stream=True)


    and it says


    I'm sorry, but I couldn't find any specific paper title in the knowledge base I have access to. Could you please provide more details or specify a different query related to a paper you are interested in?
    ​

    The paper is online and readable, I would like to know why agno failed to create knowledge base database?

    Continue reading...

Compartilhe esta Página