of loading a few-shot example from YAML.cat few_shot_prompt.yaml    _type: few_shot    input_variables:        ["adjective"]    prefix:         Write antonyms for the following words.    example_prompt:        _type: prompt        input_variables:            ["input", "output"]        template:            "Input: {input}\nOutput: {output}"    examples:        examples.json    suffix:        "Input: {adjective}\nOutput:"prompt = load_prompt("few_shot_prompt.yaml")print(prompt.format(adjective="funny"))    Write antonyms for the following words.        Input: happy    Output: sad        Input: tall    Output: short        Input: funny    Output:The same would work if you loaded examples from the yaml file.cat few_shot_prompt_yaml_examples.yaml    _type: few_shot    input_variables:        ["adjective"]    prefix:         Write antonyms for the following words.    example_prompt:        _type: prompt        input_variables:            ["input", "output"]        template:            "Input: {input}\nOutput: {output}"    examples:        examples.yaml    suffix:        "Input: {adjective}\nOutput:"prompt = load_prompt("few_shot_prompt_yaml_examples.yaml")print(prompt.format(adjective="funny"))    Write antonyms for the following words.        Input: happy    Output: sad        Input: tall    Output: short        Input: funny    Output:Loading from JSON‚ÄãThis shows an example of loading a few-shot example from JSON.cat few_shot_prompt.json    {        "_type": "few_shot",        "input_variables": ["adjective"],        "prefix": "Write antonyms for the following words.",        "example_prompt": {            "_type": "prompt",            "input_variables": ["input", "output"],            "template": "Input: {input}\nOutput: {output}"        },        "examples": "examples.json",        "suffix": "Input: {adjective}\nOutput:"    }   prompt = load_prompt("few_shot_prompt.json")print(prompt.format(adjective="funny"))    Write antonyms for the following words.        Input:
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. ->: of loading a few-shot example from YAML.cat few_shot_prompt.yaml    _type: few_shot    input_variables:        ["adjective"]    prefix:         Write antonyms for the following words.    example_prompt:        _type: prompt        input_variables:            ["input", "output"]        template:            "Input: {input}\nOutput: {output}"    examples:        examples.json    suffix:        "Input: {adjective}\nOutput:"prompt = load_prompt("few_shot_prompt.yaml")print(prompt.format(adjective="funny"))    Write antonyms for the following words.        Input: happy    Output: sad        Input: tall    Output: short        Input: funny    Output:The same would work if you loaded examples from the yaml file.cat few_shot_prompt_yaml_examples.yaml    _type: few_shot    input_variables:        ["adjective"]    prefix:         Write antonyms for the following words.    example_prompt:        _type: prompt        input_variables:            ["input", "output"]        template:            "Input: {input}\nOutput: {output}"    examples:        examples.yaml    suffix:        "Input: {adjective}\nOutput:"prompt = load_prompt("few_shot_prompt_yaml_examples.yaml")print(prompt.format(adjective="funny"))    Write antonyms for the following words.        Input: happy    Output: sad        Input: tall    Output: short        Input: funny    Output:Loading from JSON‚ÄãThis shows an example of loading a few-shot example from JSON.cat few_shot_prompt.json    {        "_type": "few_shot",        "input_variables": ["adjective"],        "prefix": "Write antonyms for the following words.",        "example_prompt": {            "_type": "prompt",            "input_variables": ["input", "output"],            "template": "Input: {input}\nOutput: {output}"        },        "examples": "examples.json",        "suffix": "Input: {adjective}\nOutput:"    }   prompt = load_prompt("few_shot_prompt.json")print(prompt.format(adjective="funny"))    Write antonyms for the following words.        Input: