Update examples to prevent confusing missing _type warning (#1391)

The YAML and JSON examples of prompt serialization now give a strange
`No '_type' key found, defaulting to 'prompt'` message when you try to
run them yourself or copy the format of the files. The reason for this
harmless warning is that the _type key was not in the config files,
which means they are parsed as a standard prompt.

This could be confusing to new users (like it was confusing to me after
upgrading from 0.0.85 to 0.0.86+ for my few_shot prompts that needed a
_type added to the example_prompt config), so this update includes the
_type key just for clarity.

Obviously this is not critical as the warning is harmless, but it could
be confusing to track down or be interpreted as an error by a new user,
so this update should resolve that.
searx-doc
Jason Gill 1 year ago committed by GitHub
parent dda5259f68
commit 1989e7d4c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
{ {
"_type": "prompt",
"input_variables": ["input", "output"], "input_variables": ["input", "output"],
"template": "Input: {input}\nOutput: {output}" "template": "Input: {input}\nOutput: {output}"
} }

@ -3,6 +3,7 @@
"input_variables": ["adjective"], "input_variables": ["adjective"],
"prefix": "Write antonyms for the following words.", "prefix": "Write antonyms for the following words.",
"example_prompt": { "example_prompt": {
"_type": "prompt",
"input_variables": ["input", "output"], "input_variables": ["input", "output"],
"template": "Input: {input}\nOutput: {output}" "template": "Input: {input}\nOutput: {output}"
}, },

@ -4,6 +4,7 @@ input_variables:
prefix: prefix:
Write antonyms for the following words. Write antonyms for the following words.
example_prompt: example_prompt:
_type: prompt
input_variables: input_variables:
["input", "output"] ["input", "output"]
template: template:

@ -3,6 +3,7 @@
"input_variables": ["adjective"], "input_variables": ["adjective"],
"prefix": "Write antonyms for the following words.", "prefix": "Write antonyms for the following words.",
"example_prompt": { "example_prompt": {
"_type": "prompt",
"input_variables": ["input", "output"], "input_variables": ["input", "output"],
"template": "Input: {input}\nOutput: {output}" "template": "Input: {input}\nOutput: {output}"
}, },

@ -4,6 +4,7 @@ input_variables:
prefix: prefix:
Write antonyms for the following words. Write antonyms for the following words.
example_prompt: example_prompt:
_type: prompt
input_variables: input_variables:
["input", "output"] ["input", "output"]
template: template:

@ -58,6 +58,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"_type: prompt\r\n",
"input_variables:\r\n", "input_variables:\r\n",
" [\"adjective\", \"content\"]\r\n", " [\"adjective\", \"content\"]\r\n",
"template: \r\n", "template: \r\n",
@ -108,6 +109,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{\r\n", "{\r\n",
" \"_type\": \"prompt\",\r\n",
" \"input_variables\": [\"adjective\", \"content\"],\r\n", " \"input_variables\": [\"adjective\", \"content\"],\r\n",
" \"template\": \"Tell me a {adjective} joke about {content}.\"\r\n", " \"template\": \"Tell me a {adjective} joke about {content}.\"\r\n",
"}\r\n" "}\r\n"
@ -156,6 +158,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{\r\n", "{\r\n",
" \"_type\": \"prompt\",\r\n",
" \"input_variables\": [\"adjective\", \"content\"],\r\n", " \"input_variables\": [\"adjective\", \"content\"],\r\n",
" \"template_path\": \"simple_template.txt\"\r\n", " \"template_path\": \"simple_template.txt\"\r\n",
"}\r\n" "}\r\n"
@ -279,6 +282,7 @@
"prefix: \r\n", "prefix: \r\n",
" Write antonyms for the following words.\r\n", " Write antonyms for the following words.\r\n",
"example_prompt:\r\n", "example_prompt:\r\n",
" _type: prompt\r\n",
" input_variables:\r\n", " input_variables:\r\n",
" [\"input\", \"output\"]\r\n", " [\"input\", \"output\"]\r\n",
" template:\r\n", " template:\r\n",
@ -346,6 +350,7 @@
"prefix: \r\n", "prefix: \r\n",
" Write antonyms for the following words.\r\n", " Write antonyms for the following words.\r\n",
"example_prompt:\r\n", "example_prompt:\r\n",
" _type: prompt\r\n",
" input_variables:\r\n", " input_variables:\r\n",
" [\"input\", \"output\"]\r\n", " [\"input\", \"output\"]\r\n",
" template:\r\n", " template:\r\n",
@ -413,6 +418,7 @@
" \"input_variables\": [\"adjective\"],\r\n", " \"input_variables\": [\"adjective\"],\r\n",
" \"prefix\": \"Write antonyms for the following words.\",\r\n", " \"prefix\": \"Write antonyms for the following words.\",\r\n",
" \"example_prompt\": {\r\n", " \"example_prompt\": {\r\n",
" \"_type\": \"prompt\",\r\n",
" \"input_variables\": [\"input\", \"output\"],\r\n", " \"input_variables\": [\"input\", \"output\"],\r\n",
" \"template\": \"Input: {input}\\nOutput: {output}\"\r\n", " \"template\": \"Input: {input}\\nOutput: {output}\"\r\n",
" },\r\n", " },\r\n",
@ -478,6 +484,7 @@
" \"input_variables\": [\"adjective\"],\r\n", " \"input_variables\": [\"adjective\"],\r\n",
" \"prefix\": \"Write antonyms for the following words.\",\r\n", " \"prefix\": \"Write antonyms for the following words.\",\r\n",
" \"example_prompt\": {\r\n", " \"example_prompt\": {\r\n",
" \"_type\": \"prompt\",\r\n",
" \"input_variables\": [\"input\", \"output\"],\r\n", " \"input_variables\": [\"input\", \"output\"],\r\n",
" \"template\": \"Input: {input}\\nOutput: {output}\"\r\n", " \"template\": \"Input: {input}\\nOutput: {output}\"\r\n",
" },\r\n", " },\r\n",
@ -542,6 +549,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{\r\n", "{\r\n",
" \"_type\": \"prompt\",\r\n",
" \"input_variables\": [\"input\", \"output\"],\r\n", " \"input_variables\": [\"input\", \"output\"],\r\n",
" \"template\": \"Input: {input}\\nOutput: {output}\" \r\n", " \"template\": \"Input: {input}\\nOutput: {output}\" \r\n",
"}\r\n" "}\r\n"
@ -622,7 +630,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.9" "version": "3.11.2"
}, },
"vscode": { "vscode": {
"interpreter": { "interpreter": {

@ -1,4 +1,5 @@
{ {
"_type": "prompt",
"input_variables": ["adjective", "content"], "input_variables": ["adjective", "content"],
"template": "Tell me a {adjective} joke about {content}." "template": "Tell me a {adjective} joke about {content}."
} }

@ -1,3 +1,4 @@
_type: prompt
input_variables: input_variables:
["adjective", "content"] ["adjective", "content"]
template: template:

@ -1,4 +1,5 @@
{ {
"_type": "prompt",
"input_variables": ["adjective", "content"], "input_variables": ["adjective", "content"],
"template_path": "simple_template.txt" "template_path": "simple_template.txt"
} }

Loading…
Cancel
Save