diff --git a/code/floop/dspy_modules.py b/code/floop/dspy_modules.py index 1096837..aef5c66 100644 --- a/code/floop/dspy_modules.py +++ b/code/floop/dspy_modules.py @@ -31,20 +31,31 @@ class Subquestion(BaseModel): answer_type: AnswerType = dspy.OutputField( desc="OPEN for a single value, FUNCTION for a formula, INTERVAL for a range, " "CONSTANT for a universal constant, LIST for an enumeration of things, " - "DATE for a specific date (a day, month and year — '15' alone is NOT a date)") + "DATE for a specific date") class InitSignature(dspy.Signature): - """You are the INIT step of a reasoning machine. Using ONLY concepts literally - present in the question plus a generic planning scaffold (number, method, - machine, resources, dependencies), ask: what information or knowledge do I - need to answer this? Write 1-4 open subquestions in dependency order. - Masked entities like PERSON_1 or ORGANIZATION_1 are ALREADY-RESOLVED - named entities from the question — treat each as a known specific entity; - do not ask what or who the placeholder is.""" + """You are the INIT step of a reasoning machine. Your job is to make the + final answer a direct lookup. Follow this procedure: + 1. Re-read the question and: + 1.1. List every word or phrase that could refer to more than one + real thing or moment. + 1.2. Think: what information or knowledge do I need to answer this? + 2. HIDDEN PRECONDITIONS: for every entity, relation, or value that the + question assumes but does not state and that is required to answer + it (an implicit owner, role, time window, or intermediate fact), + write an explicit subquestion that resolves it. NEVER collapse a + hidden precondition into the final subquestion. Always use the most + generic term to ask about them. + 3. Write the subquestion that produces the final answer, with + depends_on pointing at the preconditions it needs. + Order the subquestions by dependency (1-4 in total). + Masked entities like PERSON_1 or ORGANIZATION_1 are ALREADY-RESOLVED named + entities from the question — treat each as a known specific entity; do not + ask what or who the placeholder is.""" question: str = dspy.InputField() subquestions: list[Subquestion] = dspy.OutputField( - desc="1-4 subquestions in dependency order; empty when the question is atomic") + desc="1-4 subquestions in dependency order; never empty") class Attendant(str, Enum): @@ -258,4 +269,4 @@ def parse_subquestions(raw: str) -> list[dict]: deps.append(int(tok)) # sibling line number, resolved by the machine atype = next((t for t in AnswerType if t.value == atype_raw), AnswerType.OPEN) out.append({"text": text, "deps": deps, "answer_type": atype}) - return out \ No newline at end of file + return out