Skip to content

Commit 917c8fe

Browse files
authored
Merge pull request #86 from ContextualAI/add-metadata
adding metadata notebook
2 parents 6cb206b + 733f1a1 commit 917c8fe

File tree

8 files changed

+1990
-0
lines changed

8 files changed

+1990
-0
lines changed

15-metadata-intro/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](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+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# KB — Customer email template (DE)
2+
3+
Localized template for customer emails for Germany / Deutschland. Sehr geehrte Kundin, sehr geehrter Kunde, vielen Dank für Ihren Einkauf bei uns. Für Produkte, die in Deutschland erworben wurden, gilt eine gesetzliche Gewährleistung von 24 Monaten. Darüber hinaus können Sie innerhalb von 30 Tagen nach Lieferung eine Rückerstattung beantragen.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# KB — Customer email template (EU)
2+
3+
Localized template for customer emails for European Union. Subject: Your refund and warranty information Dear Customer, Thank you for your purchase. For products purchased in the European Union: You may request a refund within 30 days of delivery. Digital goods are refundable only if they have not been used or downloaded. Warranty coverage is provided according to EU consumer law.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# KB — Customer email template (US)
2+
3+
Localized template for customer emails for United States Dear Customer, Thank you for shopping with us. For products purchased in the United States: Refunds are available for 30 days on physical goods. Refunds for digital goods are limited to 14 days and only if the product has not been activated. Subscriptions are generally non-refundable once started.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Refund Policy EU v3
2+
3+
EU customers: refunds within 30 days. Digital goods only if unused.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Refund Policy US v2
2+
3+
US customers: refunds within 14 days. Subscriptions non-refundable.

0 commit comments

Comments
 (0)