🐾 feat(library): add 'email' library type #4

Merged
r merged 1 commits from feat/email-library-type into main 2026-07-12 12:20:49 +00:00
4 changed files with 36 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ LIBRARY_TYPE_CHOICES = [
"film", "film",
"art", "art",
"journal", "journal",
"email",
"business", "business",
"finance", "finance",
] ]

View File

@@ -241,6 +241,38 @@ LIBRARY_TYPE_DEFAULTS = {
"4) The commercial purpose — positioning, pricing, capability demonstration." "4) The commercial purpose — positioning, pricing, capability demonstration."
), ),
}, },
"email": {
"chunking_config": {
"strategy": "entry_level",
"chunk_size": 512,
"chunk_overlap": 32,
"respect_boundaries": ["message", "quote", "paragraph"],
},
"embedding_instruction": (
"Represent this email message for retrieval. "
"Focus on the sender, recipients, subject, dates, requests and "
"commitments made, and the people, organizations, and events discussed."
),
"reranker_instruction": (
"Re-rank email messages based on relevance to the query. "
"Prioritize messages matching the correspondents, subject matter, "
"time period, and any specific commitments or requests mentioned."
),
"llm_context_prompt": (
"The following excerpts are from personal email correspondence. "
"This is private content — answer with discretion. Attribute "
"statements to their senders, note dates, and distinguish what was "
"asked from what was agreed. Quoted text below a reply is earlier "
"context, not the sender's own words."
),
"vision_prompt": (
"Analyze this image from an email message. Identify:\n"
"1) Image type (photograph, screenshot, scanned document, chart, signature graphic).\n"
"2) What it depicts — people, places, documents, data.\n"
"3) Any visible text, dates, or figures.\n"
"4) Its role in the message — attachment content, inline illustration, or boilerplate."
),
},
"finance": { "finance": {
"chunking_config": { "chunking_config": {
"strategy": "section_aware", "strategy": "section_aware",
@@ -282,7 +314,7 @@ def get_library_type_config(library_type):
Args: Args:
library_type: One of 'fiction', 'nonfiction', 'technical', 'music', library_type: One of 'fiction', 'nonfiction', 'technical', 'music',
'film', 'art', 'journal', 'business', 'finance' 'film', 'art', 'journal', 'email', 'business', 'finance'
Returns: Returns:
dict with keys: chunking_config, embedding_instruction, dict with keys: chunking_config, embedding_instruction,

View File

@@ -77,6 +77,7 @@ class Library(StructuredNode):
"film": "Film", "film": "Film",
"art": "Art", "art": "Art",
"journal": "Journal", "journal": "Journal",
"email": "Email",
"business": "Business", "business": "Business",
"finance": "Finance", "finance": "Finance",
}, },

View File

@@ -21,6 +21,7 @@ class LibraryTypeDefaultsTests(TestCase):
"film", "film",
"art", "art",
"journal", "journal",
"email",
"business", "business",
"finance", "finance",
} }