File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -82,16 +82,18 @@ Main method to execute the code generation and refinement process.
8282
8383``` python
8484# Define a simple signature for basic question answering
85- generate_answer_signature = dspy.Signature(" question -> answer" )
86- generate_answer_signature.attach(question = (" Question:" , " " )).attach(answer = (" Answer:" , " often between 1 and 5 words" ))
85+ class GenerateAnswer (dspy .Signature ):
86+ """ Answer questions with short factoid answers."""
87+ question = dspy.InputField()
88+ answer = dspy.OutputField(desc = " often between 1 and 5 words" )
8789
8890# Pass signature to ProgramOfThought Module
89- pot = dspy.ProgramOfThought(generate_answer_signature )
91+ pot = dspy.ProgramOfThought(GenerateAnswer )
9092
9193# Call the ProgramOfThought module on a particular input
9294question = ' Sarah has 5 apples. She buys 7 more apples from the store. How many apples does Sarah have now?'
9395result = pot(question = question)
9496
9597print (f " Question: { question} " )
9698print (f " Final Predicted Answer (after ProgramOfThought process): { result.answer} " )
97- ```
99+ ```
You can’t perform that action at this time.
0 commit comments