RAG • AI Agent SDK

rag: Lazy-loaded RAG instance for advanced retrieval with citations.

rag

Method

</div>

This is a method of the Agent class in the agent module.

Lazy-loaded RAG instance for advanced retrieval with citations.

Returns RAG instance configured with agent’s knowledge and retrieval_config. Returns None if no knowledge is configured.

Signature

python
def rag() -> Optional[Any]

Returns

ResponseField Optional[Any]

The result of the operation.

Usage

python
agent = Agent(knowledge=["doc.pdf"], retrieval_config={"citations": True})
    result = agent.rag.query("What is the main finding?")
    print(result.answer)
    for citation in result.citations:
        print(f"[{citation.id}] {citation.source}")

Uses

  • RAGConfig
  • to_rag_config
  • SimpleReranker
  • RAG
  • logging.warning

Source

View on GitHub

praisonaiagents/agent/agent.py at line 6677


Related Documentation