Skip to content

Commit d35ada3

Browse files
committed
Cleanup initialization
1 parent 820a7ff commit d35ada3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tools/test_email.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ async def load_or_create_email_index(db_path: str, create_new: bool) -> EmailMem
349349
)
350350
# return await EmailMemory.create(settings)
351351
email_memory = await EmailMemory.create(settings)
352-
await email_memory.configure_memory()
352+
# await email_memory.configure_memory()
353353
return email_memory
354354

355355

typeagent/emails/email_memory.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def __init__(self, settings, name, tags):
5555
self.noise_terms: set[str] = set()
5656

5757
async def configure_memory(self):
58+
# Adjust settings to support knowledge extraction from message ext
59+
self.settings.semantic_ref_index_settings.auto_extract_knowledge = True
5860
# Add aliases for all the ways in which people can say 'send' and 'received'
5961
await _add_synonyms_file_as_aliases(self, "emailVerbs.json", clean=True)
6062
# Remove common terms used in email search that can make retrieval noisy
@@ -81,6 +83,19 @@ def create_answer_context_options() -> answers.AnswerContextOptions:
8183
entities_top_k=50, topics_top_k=50, messages_top_k=None, chunking=None
8284
)
8385

86+
@classmethod
87+
async def create(
88+
cls,
89+
settings: ConversationSettings,
90+
name: str | None = None,
91+
tags: list[str] | None = None,
92+
) -> "EmailMemory":
93+
instance = await super().create(settings, name, tags)
94+
await instance.configure_memory()
95+
# Post-processing: customize instance as needed
96+
# await instance.configure_memory() # Uncomment if needed
97+
return instance
98+
8499
async def query(
85100
self,
86101
question: str,

0 commit comments

Comments
 (0)