File size: 943 Bytes
a23fd30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from nzfc_gram_runtime import NZFCGramLongMemoryChat
from nzfc_gram_runtime.large_document import attach_large_document_memory

MODEL_ID = 'google/gemma-4-E2B-it'

bot = NZFCGramLongMemoryChat(
    repo_dir='.',
    model_id=MODEL_ID,
    memory_db_path='./user_memory_large_doc.sqlite3',
    load_model=False,
    require_model=False,
    preload_static_memory=True,
)

attach_large_document_memory(bot)

sample_text = '\n'.join([
    'Article 1 Purpose. This document explains evidence-bound long-term memory.',
    'Article 2 Deletion. Deleted memories must not be used as active evidence.',
    'Article 3 Scope. User and project boundaries must be preserved.',
])

ingest = bot.ingest_large_text(
    sample_text,
    title='Sample Memory Governance Policy',
    law_name='Sample Policy',
    legal_mode=True,
)

print('ingest:', ingest)

hits = bot.query_large_documents('deleted memories active evidence', top_k=5)
print('hits:', hits)