|
|
@ -287,9 +287,9 @@
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"### Extra information\n",
|
|
|
|
"### Extra information\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"The power of functions (relative to using parsers alone) lies in the ability to perform sematic extraction.\n",
|
|
|
|
"The power of functions (relative to using parsers alone) lies in the ability to perform semantic extraction.\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"In particular, `we can ask for things that are not explictly enumerated in the schema`.\n",
|
|
|
|
"In particular, `we can ask for things that are not explicitly enumerated in the schema`.\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"Suppose we want unspecified additional information about dogs. \n",
|
|
|
|
"Suppose we want unspecified additional information about dogs. \n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
@ -499,7 +499,7 @@
|
|
|
|
"And, we need to do a bit more work:\n",
|
|
|
|
"And, we need to do a bit more work:\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"* Define a class that holds multiple instances of `Person`\n",
|
|
|
|
"* Define a class that holds multiple instances of `Person`\n",
|
|
|
|
"* Explicty parse the output of the LLM to the Pydantic class\n",
|
|
|
|
"* Explicitly parse the output of the LLM to the Pydantic class\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"We can see this for other cases, too."
|
|
|
|
"We can see this for other cases, too."
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -543,7 +543,7 @@
|
|
|
|
" raise ValueError(\"Badly formed question!\")\n",
|
|
|
|
" raise ValueError(\"Badly formed question!\")\n",
|
|
|
|
" return field\n",
|
|
|
|
" return field\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"# And a query intented to prompt a language model to populate the data structure.\n",
|
|
|
|
"# And a query intended to prompt a language model to populate the data structure.\n",
|
|
|
|
"joke_query = \"Tell me a joke.\"\n",
|
|
|
|
"joke_query = \"Tell me a joke.\"\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"# Set up a parser + inject instructions into the prompt template.\n",
|
|
|
|
"# Set up a parser + inject instructions into the prompt template.\n",
|
|
|
|