|
| 1 | +# Metadata Management in Contextual AI |
| 2 | + |
| 3 | +A comprehensive notebook demonstrating how to add, configure, and utilize metadata within the Contextual AI Platform for enhanced document retrieval and filtering. Learn to organize documents with rich metadata, apply precise filters, and leverage metadata in reranking and generation. |
| 4 | + |
| 5 | +## 📋 Overview |
| 6 | + |
| 7 | +This example showcases how to implement advanced metadata management for RAG systems that can: |
| 8 | + |
| 9 | +1. **Configure Metadata at Ingest Time** with flexible field settings and configurations |
| 10 | +2. **Update Metadata Post-Processing** for dynamic document organization |
| 11 | +3. **Apply Precise Document Filters** using multiple operators and complex logic |
| 12 | +4. **Enhance Retrieval Quality** through metadata-based filtering and reranking |
| 13 | +5. **Leverage Metadata in Generation** for contextually aware responses |
| 14 | + |
| 15 | +## 🗂️ Project Structure |
| 16 | + |
| 17 | +``` |
| 18 | +📁 Metadata Management/ |
| 19 | +├── 📁 data/ # Sample policy documents |
| 20 | +│ ├── 📄 POL_EU-v3.md # EU refund policy document |
| 21 | +│ ├── 📄 POL_US-v2.md # US refund policy document |
| 22 | +│ ├── 📄 KB_Template_US.md # US customer email template |
| 23 | +│ ├── 📄 KB_Template_EU.md # EU customer email template |
| 24 | +│ └── 📄 KB_Template_DE.md # German customer template |
| 25 | +├── 📓 metadata_intro.ipynb # Main metadata notebook |
| 26 | +└── 📄 README.md # This file |
| 27 | +``` |
| 28 | + |
| 29 | +## 🚀 Quick Start |
| 30 | + |
| 31 | +### Prerequisites |
| 32 | +- **API Key:** Contextual AI API key from your workspace dashboard |
| 33 | +- **Python Environment:** Google Colab or Jupyter with internet access |
| 34 | +- **Python Client:** Version 0.8.0 or higher required |
| 35 | + |
| 36 | +### Run on Google Colab |
| 37 | +[](https://colab.research.google.com/github/ContextualAI/examples/blob/main/15-metadata-intro/metadata_intro.ipynb) |
| 38 | + |
| 39 | + |
| 40 | +## 📚 Related Examples |
| 41 | + |
| 42 | +- 🔗 **RAG Agent Monitoring**: [14-monitoring](../14-monitoring/) |
| 43 | +- 🔗 **Retrieval Analysis**: [11-retrieval-analysis](../11-retrieval-analysis/) |
| 44 | +- 🔗 **Policy Change Management**: [05-policy-changes](../05-policy-changes/) |
| 45 | +- 🔗 **Agent Performance**: [06-improve-agent-performance](../06-improve-agent-performance/) |
| 46 | + |
| 47 | +## 📖 Additional Resources |
| 48 | + |
| 49 | +- **Contextual AI Documentation**: [docs.contextual.ai](https://docs.contextual.ai/) |
| 50 | +- **Metadata API Reference**: [API Documentation](https://docs.contextual.ai/api-reference/datastores-documents/get-document-metadata) |
| 51 | +- **Best Practices Guide**: [Metadata Management](https://docs.contextual.ai/user-guides/beginner-guide) |
| 52 | + |
0 commit comments