From 3d6fcb85dc821cdf74e7e2584db432f9ec8c2ad9 Mon Sep 17 00:00:00 2001 From: hung_ng__ <51025722+minhhung123@users.noreply.github.com> Date: Mon, 20 Mar 2023 03:28:56 +1100 Subject: [PATCH] Add load json prompt example (#1776) Hi, I just want to add a PR on the prompt serialization examples of loading from JSON so that it can contain the same as loading from YAML. --- .../examples/prompt_serialization.ipynb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/modules/prompts/examples/prompt_serialization.ipynb b/docs/modules/prompts/examples/prompt_serialization.ipynb index 2e4ff89f..f56f57ca 100644 --- a/docs/modules/prompts/examples/prompt_serialization.ipynb +++ b/docs/modules/prompts/examples/prompt_serialization.ipynb @@ -120,6 +120,25 @@ "!cat simple_prompt.json" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "de75e959", + "metadata": {}, + "outputs": [], + "source": [ + "prompt = load_prompt(\"simple_prompt.json\")\n", + "print(prompt.format(adjective=\"funny\", content=\"chickens\"))" + ] + }, + { + "cell_type": "markdown", + "id": "d1d788f9", + "metadata": {}, + "source": [ + "Tell me a funny joke about chickens." + ] + }, { "cell_type": "markdown", "id": "d788a83c",