Skip to content

[BUG] RAG filtering error in types.py: len(where) != 1 fails when where has 2 conditions #1728

@AstrumPush

Description

@AstrumPush

Environment

  • Provider (select one):

    • Deepseek
  • PraisonAI 4.6.46

  • praisonai-tools 0.2.30

  • praisonaiagents 1.6.46

  • Operating System: Windows 11

Thank you for open-sourcing this project! Today I spent a lot of time debugging an issue related to RAG: I found that even though my question was explicitly mentioned in the documentation, the system still couldn't answer it correctly. After debugging, I discovered that the retrieval step successfully found relevant chunks, but an error occurred during the filtering step in types.py (and the error was not printed). Specifically, the where parameter passed to the filter contained 2 conditions, but the code checks for len(where) != 1. I don't understand the design rationale behind this. Also, I'm not sure how to resolve this issue. Could you please provide some guidance on how to get the RAG test to work properly? Thank you very much!

Full Code

from praisonaiagents import Agent

agent = Agent(
name="RAG Agent",
instructions="Answer questions using the knowledge base",
knowledge=["docs/manual.pdf"] # Your documents
)

 results = self.knowledge.search(
            query=query,
            user_id=user_id,
            agent_id=agent_id,
            run_id=run_id,
            **kwargs,
        )

  1. pipeline.py
     results = self.knowledge.search(
                query=query,
                user_id=user_id,
                agent_id=agent_id,
                run_id=run_id,
                **kwargs,
            )

  2. knowledge.py
    results = self.memory.search(query, user_id=user_id, agent_id=agent_id, run_id=run_id, rerank=rerank, **kwargs)

  3. factories.py

Image
  1. CollectionCommon.py
Image
  1. types.py
Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions