Lessons point at rules (milestone 440 steps 1–2) + the away-from-home usage readout #189
@@ -399,7 +399,7 @@ async def rule_candidates(
|
||||
"""The rules a lesson most resembles, for the writer to judge against.
|
||||
|
||||
Searched with the lesson's claim and its trigger — the same two halves a
|
||||
rule's own document leads with (`{title} — {trigger}`), so like is
|
||||
rule's own document leads with (`trigger_title`), so like is
|
||||
compared with like; the insight is the story and would dilute the vector.
|
||||
Scoped as any project read is: global rules plus the lesson's project's
|
||||
own. The bar is the explicit rule search's, since this is an explicit
|
||||
@@ -409,10 +409,11 @@ async def rule_candidates(
|
||||
caller can say "candidates unavailable" rather than "nothing resembles".
|
||||
"""
|
||||
from scribe.services.embeddings import (
|
||||
DEFAULT_SIMILARITY_THRESHOLD, semantic_search_rules,
|
||||
DEFAULT_SIMILARITY_THRESHOLD, semantic_search_rules, trigger_title,
|
||||
)
|
||||
|
||||
query = " — ".join(p for p in ((what or "").strip(), (when_to_apply or "").strip()) if p)
|
||||
# The rule document's own title join, so like is compared with like.
|
||||
query = trigger_title(what, when_to_apply)
|
||||
report: dict = {}
|
||||
found = await semantic_search_rules(
|
||||
user_id, query, limit=CANDIDATE_LIMIT,
|
||||
|
||||
Reference in New Issue
Block a user