This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Analogy(dspy.Signature): | |
"""Generate a distinct, analogous question from the initial question""" | |
question = dspy.InputField(desc="Initial question") | |
analogy = dspy.OutputField(desc="Generate a distinct analogous question based on initial question") | |
class ExampleQuestionAnswer(dspy.Signature): | |
"""Generate an answer to the analogous question""" | |
question = dspy.InputField(desc="The analogous question") | |
answer = dspy.OutputField(desc="Answer the analogous question") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChainOfThoughtHint(dspy.Module): | |
def __init__(self): | |
super().__init__() | |
# define modules | |
self.predict = dspy.ChainOfThoughtWithHint('question -> answer') | |
def forward(self, question): | |
# Declare program to execute | |
return self.predict(question=question) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChainOfThoughtProg(dspy.Module): | |
def __init__(self): | |
super().__init__() | |
# define modules | |
self.predict = dspy.ChainOfThought('question -> answer') | |
def forward(self, question): | |
# Declare program to execute | |
return self.predict(question=question) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Baseline(dspy.Module): | |
def __init__(self): | |
super().__init__() | |
# define modules | |
self.predict = dspy.Predict('question -> answer') | |
def forward(self, question): | |
# Declare program to execute | |
return self.predict(question=question) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given the fields `question`, produce the fields `answer`. | |
--- | |
Follow the following format. | |
Question: ${question} | |
Reasoning: Let's think step by step in order to ${produce the answer}. We ... | |
Answer: ${answer} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select the best candidate response | |
--- | |
Question: Oliver had $9, then he saved $5 from his allowance and spent $4 on a frisbee and $3 on a puzzle. His friend gives him another $8 as it's his birthday. How much money does Oliver have left? | |
Answer: 15 | |
--- | |
Follow the following format. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select the best candidate response | |
--- | |
Follow the following format. | |
Question: Initial question | |
Context: The candidate answers | |
Answer: Use the candidate answers to generate a response to the initial question |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given the fields `question`, produce the fields `answer`. | |
--- | |
Follow the following format. | |
Question: ${question} | |
Reasoning: Let's think step by step in order to ${produce the answer}. We ... | |
Answer: ${answer} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select the best candidate response | |
--- | |
Question: Oliver had $9, then he saved $5 from his allowance and spent $4 on a frisbee and $3 on a puzzle. His friend gives him another $8 as it's his birthday. How much money does Oliver have left? | |
Answer: 15 | |
--- | |
Follow the following format. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select the best candidate response | |
--- | |
Follow the following format. | |
Question: Initial question | |
Context: The candidate answers | |
Answer: Use the candidate answers to generate a response to the initial question |