DiffusionGemma-26B-A4B-it-Infinite-Context / examples /high_frequency_multi_context_runtime_only.py
SingularityPrinciple's picture
Fix validation and example script import paths
f77c1f2 verified
Raw
History Blame Contribute Delete
1.35 kB
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.quality import attach_answer_quality_governor
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='./runtime_only_memory.sqlite3',
load_model=False,
require_model=False,
preload_static_memory=False,
)
attach_large_document_memory(bot, db_path='./runtime_only_large_docs.sqlite3')
attach_answer_quality_governor(bot)
user_id = 'demo_user'
project_id = 'demo_project'
session_id = 'demo_session'
bot.remember(
'The project high-frequency test code is PROJECT_CODE_RUNTIME_ONLY.',
user_id=user_id,
project_id=project_id,
session_id=session_id,
scope='project',
tags=['project_code'],
trust_level=0.95,
)
res = bot.quality_chat(
'What was the project high-frequency test code? Answer only with the code.',
user_id=user_id,
project_id=project_id,
session_id='new_session',
max_new_tokens=40,
)
print(res['answer'])
assert res['answer'] == 'PROJECT_CODE_RUNTIME_ONLY'
print('[PASS] runtime-only exact slot smoke passed')