Fix agentic_rag demos crashing on import (wrong kwarg + hardcoded PDF path)#245
Fix agentic_rag demos crashing on import (wrong kwarg + hardcoded PDF path)#245douxiao398 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughBoth ChangesPortable PDF Path Resolution
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… path The agentic_rag and agentic_rag_deepseek demos crash on import: crew.py calls DocumentSearchTool(pdf=...) but the tool constructor expects file_path (custom_tool.py: def __init__(self, file_path: str)), raising TypeError. The PDF path was also hardcoded to the original author's absolute path (/Users/akshaypachaar/...), so it also fails with FileNotFoundError on any other machine. Fix both demos by: - passing file_path= instead of the non-existent pdf= kwarg - resolving the bundled knowledge/dspy.pdf relative to crew.py via os.path so the demo runs on any machine
d98ca76 to
90a2926
Compare
While trying to run the
agentic_ragdemo I hit aTypeErrorthe moment the crew module is imported. Digging in, it comes down to the tool being constructed with a keyword that doesn't exist on its constructor.In
agentic_rag/src/agentic_rag/crew.pythe tool is created like this:but
DocumentSearchTool.__init__(intools/custom_tool.py) is actually defined as:There is no
pdfparameter, so importingcrew.pyfails withTypeError: __init__() got an unexpected keyword argument 'pdf'. Because that line runs at module load time, the demo can't even start.There's a second problem hiding behind it: the PDF path is hardcoded to the original author's machine (
/Users/akshaypachaar/...). So even once the keyword is fixed, it would still fail withFileNotFoundErrorfor anyone else — even though each demo already ships its own copy atknowledge/dspy.pdf.The exact same two issues exist in the
agentic_rag_deepseekvariant, so I fixed both.What changed
file_path=instead of the non-existentpdf=kwarg.knowledge/dspy.pdfrelative tocrew.pywithos.path, so it works no matter where the repo is cloned instead of pointing at one person's home directory.Diff is small (2 files, the two
crew.pyentry points). Both modules now import cleanly and pick up the PDF that's already in each demo'sknowledge/folder.Summary by CodeRabbit
Bug Fixes