Improving hidden preconditions in INIT prompt

This commit is contained in:
2026-10-23 12:36:27 +02:00
parent 86b444391d
commit 30d0a48f7a
+20 -9
View File
@@ -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):