OutputParser‚ÄãThis shows an example of loading a prompt along with an OutputParser from a file.cat prompt_with_output_parser.json    {        "input_variables": [            "question",            "student_answer"        ],        "output_parser": {            "regex": "(.*?)\\nScore: (.*)",            "output_keys": [                "answer",                "score"            ],            "default_output_key": null,            "_type": "regex_parser"        },        "partial_variables": {},        "template": "Given the following question and student answer, provide a correct answer and score the student answer.\nQuestion: {question}\nStudent Answer: {student_answer}\nCorrect Answer:",        "template_format": "f-string",        "validate_template": true,        "_type": "prompt"    }prompt = load_prompt("prompt_with_output_parser.json")prompt.output_parser.parse(    "George Washington was born in 1732 and died in 1799.\nScore: 1/2")    {'answer': 'George Washington was born in 1732 and died in 1799.',     'score': '1/2'}PreviousCompositionNextPrompt pipeliningPromptTemplateLoading from YAMLLoading from JSONLoading template from a fileFewShotPromptTemplateExamplesLoading from YAMLLoading from JSONExamples in the configExample prompt from a filePromptTemplate with OutputParserCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
It is often preferable to store prompts not as python code but as files. This can make it easy to share, store, and version prompts. This notebook covers how to do that in LangChain, walking through all the different types of prompts and the different serialization options.
It is often preferable to store prompts not as python code but as files. This can make it easy to share, store, and version prompts. This notebook covers how to do that in LangChain, walking through all the different types of prompts and the different serialization options. ->: OutputParser‚ÄãThis shows an example of loading a prompt along with an OutputParser from a file.cat prompt_with_output_parser.json    {        "input_variables": [            "question",            "student_answer"        ],        "output_parser": {            "regex": "(.*?)\\nScore: (.*)",            "output_keys": [                "answer",                "score"            ],            "default_output_key": null,            "_type": "regex_parser"        },        "partial_variables": {},        "template": "Given the following question and student answer, provide a correct answer and score the student answer.\nQuestion: {question}\nStudent Answer: {student_answer}\nCorrect Answer:",        "template_format": "f-string",        "validate_template": true,        "_type": "prompt"    }prompt = load_prompt("prompt_with_output_parser.json")prompt.output_parser.parse(    "George Washington was born in 1732 and died in 1799.\nScore: 1/2")    {'answer': 'George Washington was born in 1732 and died in 1799.',     'score': '1/2'}PreviousCompositionNextPrompt pipeliningPromptTemplateLoading from YAMLLoading from JSONLoading template from a fileFewShotPromptTemplateExamplesLoading from YAMLLoading from JSONExamples in the configExample prompt from a filePromptTemplate with OutputParserCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.