--- title: Rag emoji: 🐢 colorFrom: gray colorTo: indigo sdk: gradio sdk_version: 5.12.0 app_file: app.py pinned: false short_description: Just another rag but with Images 🖼️ --- # Just another RAG, dont bother much!! ## File Descriptions ### `z_document_reader.py` Images are only useful to limited resource computer if it has a caption. So this file helps parse the wikipedia html strips it off the tags. ### `z_embedding.py` Generates vector store. ### `z_generate.py` Use LLM and prompting to find the relevant texts and images stored in the vector stores. ## Adding more data sources Currently limited to wikipedia pages downloaded as HTML. 1. Place the html in the folder `_data` 2. Run command `python z_embedding.py` 3. Output will be two FAISS vectors stores in the folder `cache_vector...` ## Local Debug Highly recommend VS Code, makes life easy. 1. Create Virtual environment with name `sb-rag` using the below command `python -m venv sb-rag` 2. Activate the environemnt (create new terminal VS Code to automatically do so) 3. Edit `.vscode/launch.json`. Fill in the environment variable `HF_SERVERLESS_API`. 4. Start VS Code debugger. ## References 1. UI Blocks Concepts: https://huggingface.co/learn/nlp-course/en/chapter9/7 2. UI Row-Column Arrangement: https://www.gradio.app/guides/controlling-layout 2. Show caption in image gallery: https://github.com/gradio-app/gradio/issues/3364 2. HF Implementation of basic: https://huggingface.co/learn/cookbook/en/advanced_rag 2. https://python.langchain.com/docs/integrations/vectorstores/faiss/ ## Ideas 1. Shows frames of design patterns: https://www.falkordb.com/blog/advanced-rag/ 2. HF Implementation of basic: https://huggingface.co/learn/cookbook/en/advanced_rag 2. HF RAG Evaluation: https://huggingface.co/learn/cookbook/en/rag_evaluation 2. HF Implementation by someone: https://medium.aiplanet.com/advanced-rag-implementation-on-custom-data-using-hybrid-search-embed-caching-and-mistral-ai-ce78fdae4ef6 2. HF Agentic Rag: https://huggingface.co/learn/cookbook/en/agent_rag 2. Future read, tooning https://huggingface.co/blog/lucifertrj/finetune-embeddings 2. Opinion on instruct embeddings: https://huggingface.co/blog/Tonic/instruct-embeddings-and-advanced-rag 2. Another Implementation: https://huggingface.co/learn/cookbook/en/rag_zephyr_langchain 2. Another Opinion on ray: https://www.anyscale.com/blog/retrieval-augmented-generation-with-huggingface-transformers-and-ray 2. Ray Follow up: https://github.com/run-llama/ai-engineer-workshop/blob/main/presentation.pdf?__s=2il5g6hpfc4mtmydioir 2. llama Index rag implementation: https://docs.llamaindex.ai/en/latest/optimizing/production_rag/ 2. Just some termino book: https://www.projectpro.io/article/advanced-rag-techniques/1063 2. Another Evaluation Guide: https://pub.towardsai.net/evaluating-rag-metrics-across-different-retrieval-methods-770aa01380c8 2. Oracle Garbage: https://blogs.oracle.com/ai-and-datascience/post/ai-health-mixtral-oracle-23ai-rag-langchain-streamlit