World's first open-source enterprise world model.
Rust agent-memorybitemporalgraphragknowledge-baseknowledge-graphllmontologypgvectorpostgresqlragrustself-hostedsemantic-searchtemporal-knowledge-graphworld-model
fix: stop alignment examples from supplying unrelated item IDs (#1323)
Nash Aschenbath0daaed0048e6
diff --git a/crates/utopia-extract/src/align.rs b/crates/utopia-extract/src/align.rsindex fec25043..e73fe5eb 100644--- a/crates/utopia-extract/src/align.rs+++ b/crates/utopia-extract/src/align.rs@@ -67,10 +67,12 @@ the keys of its candidate classes. The classes themselves are listed once undereach with its key, its label and its definition. For each item, answer with the key of the one \candidate class that every thing of this kind is an instance of, or null.\n\\n\-Output exactly one JSON object and nothing else, one pair per item:\n\-{\"b\": [[12, \"organization\"], [13, null]]}\n\-The first element of a pair is the item's id; the second is the chosen key, copied exactly as \-listed under that item, or null.\n\+Output exactly one JSON object and nothing else, one pair per item. Format (uppercase words \+and the ellipsis are placeholders, not literal output):\n\+{\"b\": [[ITEM_ID, CLASS_KEY_OR_NULL], ...]}\n\+Copy the exact integer after \"Item\" in the user message into that item's ITEM_ID slot. \+Never invent an id or renumber the items. Answer every supplied id exactly once. \+The second element is the chosen key, copied exactly as listed under that item, or null.\n\\n\1. Choose a candidate only when every thing of this kind is an instance of that class by the \class's definition. The class may be broader than the word: a bakery is an organization, a \@@ -636,7 +638,7 @@ mod tests {let user = &msgs[1].content;assert!(system.contains("every thing of this kind is an instance of that class"));- assert!(system.contains("{\"b\": [[12, \"organization\"], [13, null]]}"));+ assert!(system.contains("{\"b\": [[ITEM_ID, CLASS_KEY_OR_NULL], ...]}"));assert!(system.contains("never merely related"));assert!(system.contains("Never invent a key"));diff --git a/crates/utopia-extract/src/phrase_align.rs b/crates/utopia-extract/src/phrase_align.rsindex 03ae9b01..69eab3ae 100644--- a/crates/utopia-extract/src/phrase_align.rs+++ b/crates/utopia-extract/src/phrase_align.rs@@ -126,7 +126,9 @@ impl Direction {}}-/// 系统消息。例子是中性的,不出自任何测量语料;规则 1 的「每一条」是整条路的判据+/// 系统消息。例子是中性的,不出自任何测量语料;规则 1 的「每一条」是整条路的判据。+/// Reply slots use placeholders: a local model copied the old example's 12/13/14+/// into a batch numbered 0/1/2, leaving every signature unanswered (#1321).const PHRASE_SYSTEM: &str = "\You bind the relation phrases documents use to the properties of a knowledge base's ontology. \Each numbered item is one signature: a phrase as the documents wrote it, the class of the thing \@@ -144,9 +146,13 @@ states by that property's definition, and the direction: \"forward\" when the stsubject is the property's subject, \"reverse\" when the statement's object is; or null. For a \state, also say which end of it a statement dated at a single moment marks (rule 6).\n\\n\-Output exactly one JSON object and nothing else, one entry per item:\n\-{\"b\": [[12, \"headquartered_in\", \"forward\", \"none\"], [13, \"member_of\", \"forward\", \"start\"], \-[14, null, null, null]]}\n\+Output exactly one JSON object and nothing else, one entry per item. Format (uppercase words \+and the ellipsis are placeholders, not literal output):\n\+{\"b\": [[ITEM_ID, PROPERTY_KEY_OR_NULL, DIRECTION_OR_NULL, MARKS_OR_NULL], ...]}\n\+Copy the exact integer after \"Item\" in the user message into that item's ITEM_ID slot. \+Never invent an id or renumber the items. Answer every supplied id exactly once. \+The other slots contain the chosen property's key, direction and marks, as described below; \+when no property fits, all three are null.\n\\n\1. Choose a property only when each of the statements under this signature states that \property, by the definition as given. The property may be broader than the phrase: \"opened a \diff --git a/crates/utopia-server/src/phrase_alignment.rs b/crates/utopia-server/src/phrase_alignment.rsindex bdce2848..04902722 100644--- a/crates/utopia-server/src/phrase_alignment.rs+++ b/crates/utopia-server/src/phrase_alignment.rs@@ -961,6 +961,7 @@ async fn align_phrases_locked(%kb_id,pass,items = items.len(),+ item_ids = ?items.iter().map(|item| item.id).collect::<Vec<_>>(),malformed,finish_reason = ?reply.finish_reason,chars = reply.text.chars().count(),