GasolSun36 / PyRAG
PublicRetrieval is CheapShow Me the Code: Executable Multi-Hop Reasoning for Retrieval-Augmented Generation
PyRAG is a research framework that transforms complex question-answering into a step-by-step code execution process. Instead of having an AI answer questions directly, it breaks complex questions into simpler parts, generates Python code to search Wikipedia and answer each part, executes that code automatically, and combines the results. The system can fix its own errors and retry failed steps. There are two versions: a training-free version that works out of the box, and a reinforcement-learning-trained version that requires more setup but performs better. This is legitimate academic research with an associated arXiv paper, though users should be aware it executes AI-generated code.
How It Works
You type a multi-part question like 'Who is older, Jed Hoyer or John William Henry II?' that requires reasoning across multiple facts.
The system automatically splits your complex question into simpler sub-questions that can each be answered with a search.
The system writes executable Python code that will search for information and combine the results to answer your original question.
Each line of the generated code executes in order, searching Wikipedia for relevant facts and extracting answers from the retrieved documents.
If the code hits an error or returns incomplete information, the system rewrites and retries that part automatically.
The system combines all the retrieved facts and reasoning steps to give you a clear, accurate answer to your original question.
Star Growth
Repurpose is a Pro feature
Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.
Unlock RepurposeSimilar repos coming soon.