https://github.com/Brandon-c-tech/RAG-logger Skip to content Navigation Menu Toggle navigation Sign in * Product + GitHub Copilot Write better code with AI + Security Find and fix vulnerabilities + Actions Automate any workflow + Codespaces Instant dev environments + Issues Plan and track work + Code Review Manage code changes + Discussions Collaborate outside of code + Code Search Find more, search less Explore + All features + Documentation + GitHub Skills + Blog * Solutions By company size + Enterprises + Small and medium teams + Startups By use case + DevSecOps + DevOps + CI/CD + View all use cases By industry + Healthcare + Financial services + Manufacturing + Government + View all industries View all solutions * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners + Executive Insights * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} Brandon-c-tech / RAG-logger Public * Notifications You must be signed in to change notification settings * Fork 3 * Star 135 RAG Logger is an open-source logging tool designed specifically for Retrieval-Augmented Generation (RAG) applications. It serves as a lightweight, open-source alternative to LangSmith, focusing on RAG-specific logging needs. License View license 135 stars 3 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights Brandon-c-tech/RAG-logger main BranchesTags [ ] Go to file Code Folders and files Name Name Last commit message Last commit date Latest commit History 10 Commits LICENSE.md LICENSE.md README.md README.md basic_usage.py basic_usage.py logger.py logger.py View all files Repository files navigation * README * License RAG Logger RAG Logger is an open-source logging tool designed specifically for Retrieval-Augmented Generation (RAG) applications. It serves as a lightweight, open-source alternative to LangSmith, focusing on RAG-specific logging needs. Features * Comprehensive RAG Pipeline Logging + Query tracking + Retrieval results logging + LLM interaction recording + Step-by-step performance monitoring * Structured Storage + JSON-based log format + Daily log organization + Automatic file management + Metadata enrichment Quick Start from logger import RAGLogger # Initialize logger logger = RAGLogger(log_dir="logs") # Log a query logger.log_query("What is machine learning?") # Track retrieval step logger.start_step("retrieval") logger.log_retrieval( source="text", total_docs=100, retrieved_docs=[{"id": 1, "content": "..."}] ) logger.end_step("retrieval") # Record LLM interaction logger.log_llm( llm_input="User query and context", llm_output="Generated response" ) # Save logs logger.save() Log Structure { "timestamp": "2024-03-20 10:00:00", "query": "What is machine learning?", "total_time": 8.5, "steps": { "query_understanding": { "name": "query_understanding", "start_time": 1234567890.0, "end_time": 1234567891.0, "duration": 1.0, "metadata": { "detected_intent": "definition_query", "topic": "machine_learning", "confidence": 0.95 } }, "text_embedding": { "name": "text_embedding", "start_time": 1234567891.0, "end_time": 1234567892.5, "duration": 1.5, "metadata": { "model": "text-embedding-3-small", "embedding_dim": 1536, "batch_size": 32 } }, "text_retrieval": { "name": "text_retrieval", "start_time": 1234567892.5, "end_time": 1234567894.0, "duration": 1.5, "metadata": { "index_type": "faiss", "top_k": 5, "similarity_threshold": 0.7 } }, "llm_generation": { "name": "llm_generation", "start_time": 1234567894.0, "end_time": 1234567898.5, "duration": 4.5, "metadata": { "model": "gpt-4o", "max_tokens": 1024, "temperature": 0.7 } } }, "retrieval_results": { "text": { "total_docs": 1000, "retrieved_docs": [ { "id": "doc_123", "book": "Introduction to Machine Learning", "chapter": "Chapter 1: Overview", "content": "Machine learning is a core field of artificial intelligence...", "similarity_score": 0.92, "metadata": { "page": 12, "last_updated": "2024-01-01" } } ], "metadata": { "index_size": "2.5GB", "last_updated": "2024-03-19" } } }, "llm_input": { "query": "What is machine learning?", "context": "...(retrieved text contents)", "system_prompt": "You are a professional educational assistant...", "metadata": { "max_context_length": 4096, "format": "markdown" } }, "llm_output": { "content": "Machine learning is a key branch of artificial intelligence...", "metadata": { "token_count": 512, "generation_time": 4.5 } }, "messages": [ { "timestamp": "2024-03-20 10:00:00", "level": "INFO", "step": "query_understanding", "message": "Successfully identified query intent: definition_query" }, { "timestamp": "2024-03-20 10:00:01", "level": "INFO", "step": "text_retrieval", "message": "Retrieved 5 relevant documents from 1000 total documents" }, { "timestamp": "2024-03-20 10:00:03", "level": "INFO", "step": "llm_generation", "message": "Response generation completed, tokens: 512" } ], "error_tracking": { "has_errors": false, "error_count": 0, "warnings": [] } } About RAG Logger is an open-source logging tool designed specifically for Retrieval-Augmented Generation (RAG) applications. It serves as a lightweight, open-source alternative to LangSmith, focusing on RAG-specific logging needs. Resources Readme License View license Activity Stars 135 stars Watchers 2 watching Forks 3 forks Report repository Releases No releases published Packages 0 No packages published Languages * Python 100.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.