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"],
"template": "Input: {input}\nOutput: {output}"
}

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

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

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

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

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

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

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

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

Loading…
Cancel
Save