Adding updates to Festinger
This commit is contained in:
@@ -495,17 +495,19 @@ async def process_prompt(body: dict, path: str, pool, cfg: dict) -> dict:
|
||||
salient_for_read: list[int] = []
|
||||
salient_for_write: list[str] = []
|
||||
|
||||
# Novel words found this prompt that aren't in the cache yet.
|
||||
# We cap at MAX_NOVEL_PER_PROMPT to avoid flooding on large system prompts.
|
||||
MAX_NOVEL_PER_PROMPT = 5
|
||||
novel_this_prompt: list[str] = []
|
||||
|
||||
for token in tokens:
|
||||
soas_row = cache.soas_by_token.get(token)
|
||||
|
||||
if soas_row is None:
|
||||
# Token is absent from the dictionary entirely → novel domain word.
|
||||
# Give it an initial high saliency so recollection fires immediately
|
||||
# and instructs the model to ask the user what it is.
|
||||
soas_row = await create_novel_soas(pool, token)
|
||||
salient_for_read.append(soas_row.id)
|
||||
# Do NOT add to salient_for_write: we have no basis for LLM-inferred
|
||||
# relationships yet — let the conversation teach us via cue scanner.
|
||||
# Token absent from dictionary → candidate novel domain word.
|
||||
# Collect for batch processing; apply a per-prompt cap.
|
||||
if len(novel_this_prompt) < MAX_NOVEL_PER_PROMPT:
|
||||
novel_this_prompt.append(token)
|
||||
continue
|
||||
|
||||
if soas_row.saliency == 0.0 and soas_row.novelty == 0.0:
|
||||
@@ -517,11 +519,21 @@ async def process_prompt(body: dict, path: str, pool, cfg: dict) -> dict:
|
||||
if soas_row.saliency >= read_threshold:
|
||||
salient_for_read.append(soas_row.id)
|
||||
|
||||
if soas_row.saliency >= write_threshold and soas_row.novelty > 0.0:
|
||||
# Only enqueue domain-specific words for LLM relationship extraction,
|
||||
# not freshly-created novel words (novelty=1.0 but just inserted).
|
||||
# Only enqueue for LLM write if the concept already has URD edges —
|
||||
# i.e. we know *something* about it and may want to expand that knowledge.
|
||||
# Never enqueue freshly-novel words: let the conversation teach us instead.
|
||||
if (
|
||||
soas_row.saliency >= write_threshold
|
||||
and soas_row.novelty > 0.0
|
||||
and cache.urd_by_concept.get(soas_row.id)
|
||||
):
|
||||
salient_for_write.append(token)
|
||||
|
||||
# Create SOAS entries for novel words and add them to the read list.
|
||||
for token in novel_this_prompt:
|
||||
soas_row = await create_novel_soas(pool, token)
|
||||
salient_for_read.append(soas_row.id)
|
||||
|
||||
for token in salient_for_write:
|
||||
await enqueue_concept(token)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user