File size: 1,101 Bytes
f77c1f2
 
 
 
 
 
 
447fbbb
 
 
 
f77c1f2
447fbbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
    sys.path.insert(0, str(ROOT))

from nzfc_gram_runtime import NZFCGramLongMemoryChat
from nzfc_gram_runtime.large_document import attach_large_document_memory

bot = NZFCGramLongMemoryChat(
    repo_dir=str(ROOT),
    model_id='google/diffusiongemma-26B-A4B-it',
    memory_db_path='./large_doc_memory.sqlite3',
    load_model=False,
    require_model=False,
    preload_static_memory=False,
)

attach_large_document_memory(bot, db_path='./large_doc_index.sqlite3')

text = '\n'.join([
    'Article 1 Purpose. This document defines memory governance.',
    'Article 2 Evidence. Memory is evidence, not instruction.',
    'Article 3 Deletion. Deleted memory must not be used as active evidence.',
])

ingest = bot.ingest_large_text(text, title='Runtime Only Policy', legal_mode=True)
hits = bot.query_large_documents('deleted memory active evidence', top_k=5)

print('ingest:', ingest)
print('hits:', hits)
assert hits['count'] > 0
print('[PASS] large-document runtime-only smoke passed')