to the input: Who was the father of Mary Ball Washington?    question: Who was the maternal grandfather of George Washington?    answer:    Are follow up questions needed here: Yes.    Follow up: Who was the mother of George Washington?    Intermediate answer: The mother of George Washington was Mary Ball Washington.    Follow up: Who was the father of Mary Ball Washington?    Intermediate answer: The father of Mary Ball Washington was Joseph Ball.    So the final answer is: Joseph BallFeed example selector into FewShotPromptTemplate‚ÄãFinally, create a FewShotPromptTemplate object. This object takes in the example selector and the formatter for the few-shot examples.prompt = FewShotPromptTemplate(    example_selector=example_selector,    example_prompt=example_prompt,    suffix="Question: {input}",    input_variables=["input"])print(prompt.format(input="Who was the father of Mary Ball Washington?"))    Question: Who was the maternal grandfather of George Washington?    Are follow up questions needed here: Yes.    Follow up: Who was the mother of George Washington?    Intermediate answer: The mother of George Washington was Mary Ball Washington.    Follow up: Who was the father of Mary Ball Washington?    Intermediate answer: The father of Mary Ball Washington was Joseph Ball.    So the final answer is: Joseph Ball    Question: Who was the father of Mary Ball Washington?PreviousCustom prompt templateNextFew-shot examples for chat modelsUse CaseUsing an example setCreate the example setCreate a formatter for the few-shot examplesFeed examples and formatter to FewShotPromptTemplateUsing an example selectorFeed examples into ExampleSelectorFeed example selector into FewShotPromptTemplateCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
In this tutorial, we'll learn how to create a prompt template that uses few-shot examples. A few-shot prompt template can be constructed from either a set of examples, or from an Example Selector object.
In this tutorial, we'll learn how to create a prompt template that uses few-shot examples. A few-shot prompt template can be constructed from either a set of examples, or from an Example Selector object. ->: to the input: Who was the father of Mary Ball Washington?    question: Who was the maternal grandfather of George Washington?    answer:    Are follow up questions needed here: Yes.    Follow up: Who was the mother of George Washington?    Intermediate answer: The mother of George Washington was Mary Ball Washington.    Follow up: Who was the father of Mary Ball Washington?    Intermediate answer: The father of Mary Ball Washington was Joseph Ball.    So the final answer is: Joseph BallFeed example selector into FewShotPromptTemplate‚ÄãFinally, create a FewShotPromptTemplate object. This object takes in the example selector and the formatter for the few-shot examples.prompt = FewShotPromptTemplate(    example_selector=example_selector,    example_prompt=example_prompt,    suffix="Question: {input}",    input_variables=["input"])print(prompt.format(input="Who was the father of Mary Ball Washington?"))    Question: Who was the maternal grandfather of George Washington?    Are follow up questions needed here: Yes.    Follow up: Who was the mother of George Washington?    Intermediate answer: The mother of George Washington was Mary Ball Washington.    Follow up: Who was the father of Mary Ball Washington?    Intermediate answer: The father of Mary Ball Washington was Joseph Ball.    So the final answer is: Joseph Ball    Question: Who was the father of Mary Ball Washington?PreviousCustom prompt templateNextFew-shot examples for chat modelsUse CaseUsing an example setCreate the example setCreate a formatter for the few-shot examplesFeed examples and formatter to FewShotPromptTemplateUsing an example selectorFeed examples into ExampleSelectorFeed example selector into FewShotPromptTemplateCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.