{'api_help': 'Show an example curl command for using openai Completion API'}\n",
"
\n"
],
"text/plain": [
- "\u001b[1m{\u001b[0m\n",
- " \u001b[32m'api_help'\u001b[0m: \u001b[32m'curl -X POST -H \"Content-Type: application/json\" -H \"Authorization: Bearer YOUR_API_KEY\" -d \u001b[0m\n",
- "\u001b[32m\\'\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"prompt\": \"Once upon a time\", \"max_tokens\": 100\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\' \u001b[0m\n",
- "\u001b[32m\"https://api.openai.com/v1/engines/davinci-codex/completions\"'\u001b[0m\n",
- "\u001b[1m}\u001b[0m\n"
+ "\u001b[1m{\u001b[0m\u001b[32m'api_help'\u001b[0m: \u001b[32m'Show an example curl command for using openai Completion API'\u001b[0m\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
@@ -376,27 +404,21 @@
" │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
" │ │ │ │\n",
" │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ │ Json Output: │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭───────────────────────────────────────────── Instructions ──────────────────────────────────────────────╮ │\n",
- " │ │ You are a helpful assistant, able to express yourself purely through JSON, strictly and precisely │ │\n",
- " │ │ adhering to the provided XML schemas. │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
" │ │ No message history. │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
" │ │ { │ │\n",
- " │ │ \"api_help\": \"curl -X POST -H \\\"Content-Type: application/json\\\" -H \\\"Authorization: Bearer │ │\n",
- " │ │ YOUR_API_KEY\\\" -d '{\\\"prompt\\\": \\\"Once upon a time\\\", \\\"max_tokens\\\": 100}' │ │\n",
- " │ │ \\\"https://api.openai.com/v1/engines/davinci-codex/completions\\\"\" │ │\n",
+ " │ │ \"api_help\": \"Show an example curl command for using openai Completion API\" │ │\n",
" │ │ } │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- " │ │ { │ │\n",
- " │ │ 'api_help': 'curl -X POST -H \"Content-Type: application/json\" -H \"Authorization: Bearer │ │\n",
- " │ │ YOUR_API_KEY\" -d \\'{\"prompt\": \"Once upon a time\", \"max_tokens\": 100}\\' │ │\n",
- " │ │ \"https://api.openai.com/v1/engines/davinci-codex/completions\"' │ │\n",
- " │ │ } │ │\n",
+ " │ │ {'api_help': 'Show an example curl command for using openai Completion API'} │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
"
\n"
@@ -433,27 +455,21 @@
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mformat=\"1-indexed\" />` => `{'baz': {'foo': 'Some String', 'index': 1}}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mJson Output:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
- " │ \u001b[48;2;255;240;242m╭─\u001b[0m\u001b[48;2;255;240;242m────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m Instructions \u001b[0m\u001b[48;2;255;240;242m─────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m─╮\u001b[0m │\n",
- " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242mYou are a helpful assistant, able to express yourself purely through JSON, strictly and precisely \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
- " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242madhering to the provided XML schemas.\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
- " │ \u001b[48;2;255;240;242m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m{\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
- " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"api_help\": \"curl -X POST -H \\\"Content-Type: application/json\\\" -H \\\"Authorization: Bearer \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
- " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mYOUR_API_KEY\\\" -d '{\\\"prompt\\\": \\\"Once upon a time\\\", \\\"max_tokens\\\": 100}' \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
- " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m\\\"https://api.openai.com/v1/engines/davinci-codex/completions\\\"\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"api_help\": \"Show an example curl command for using openai Completion API\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m}\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
- " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m{\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
- " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m 'api_help': 'curl -X POST -H \"Content-Type: application/json\" -H \"Authorization: Bearer \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
- " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mYOUR_API_KEY\" -d \\'{\"prompt\": \"Once upon a time\", \"max_tokens\": 100}\\' \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
- " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m\"https://api.openai.com/v1/engines/davinci-codex/completions\"'\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
- " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m}\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m{'api_help': 'Show an example curl command for using openai Completion API'}\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
" │ \u001b[48;2;240;255;240m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n"
]
@@ -483,7 +499,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.17"
+ "version": "3.11.9"
},
"orig_nbformat": 4,
"vscode": {
diff --git a/docs/examples/response_is_on_topic.ipynb b/docs/examples/response_is_on_topic.ipynb
index 2eefbbf54..58692a146 100644
--- a/docs/examples/response_is_on_topic.ipynb
+++ b/docs/examples/response_is_on_topic.ipynb
@@ -2,10 +2,32 @@
"cells": [
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Installing hub:\u001b[35m/\u001b[0m\u001b[35m/tryolabs/\u001b[0m\u001b[95mrestricttotopic...\u001b[0m\n",
+ "\u001b[2K\u001b[32m[ ===]\u001b[0m Fetching manifestst\n",
+ "\u001b[2K\u001b[32m[== ]\u001b[0m Downloading dependencies Running command git clone --filter=blob:none --quiet https://github.com/tryolabs/restricttotopic.git /private/var/folders/w2/ssf16z690zd7_4dggw0y5s_m0000gn/T/pip-req-build-advwvzw9\n",
+ "\u001b[2K\u001b[32m[=== ]\u001b[0m Downloading dependencies\n",
+ "\u001b[1A\u001b[2K\u001b[?25l\u001b[32m[ ]\u001b[0m Running post-install setup\n",
+ "\u001b[1A\u001b[2K✅Successfully installed tryolabs/restricttotopic!\n",
+ "\n",
+ "\n",
+ "\u001b[1mImport validator:\u001b[0m\n",
+ "from guardrails.hub import RestrictToTopic\n",
+ "\n",
+ "\u001b[1mGet more info:\u001b[0m\n",
+ "\u001b[4;94mhttps://hub.guardrailsai.com/validator/tryolabs/restricttotopic\u001b[0m\n",
+ "\n"
+ ]
+ }
+ ],
"source": [
+ "\n",
"!guardrails hub install hub://tryolabs/restricttotopic"
]
},
@@ -46,7 +68,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@@ -63,7 +85,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
@@ -85,7 +107,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
@@ -124,22 +146,14 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 12,
"metadata": {},
"outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages/torch/cuda/__init__.py:611: UserWarning: Can't initialize NVML\n",
- " warnings.warn(\"Can't initialize NVML\")\n"
- ]
- },
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Validation failed for field with errors: Most relevant topic is tablet.\n"
+ "Validation failed for field with errors: Invalid topics found: ['tablet', 'computer', 'phone']\n"
]
}
],
@@ -183,14 +197,14 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Validation failed for field with errors: Most relevant topic is tablet.\n"
+ "Validation failed for field with errors: Invalid topics found: ['tablet', 'computer', 'phone']\n"
]
}
],
@@ -229,21 +243,14 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 14,
"metadata": {},
"outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n"
- ]
- },
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Validation failed for field with errors: Most relevant topic is tablet.\n"
+ "Validation failed for field with errors: Invalid topics found: ['tablet']\n"
]
}
],
@@ -288,7 +295,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.7"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/examples/text_summarization_quality.ipynb b/docs/examples/text_summarization_quality.ipynb
index cca6538eb..b9c7e59ed 100644
--- a/docs/examples/text_summarization_quality.ipynb
+++ b/docs/examples/text_summarization_quality.ipynb
@@ -2,9 +2,42 @@
"cells": [
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n",
+ "To disable this warning, you can either:\n",
+ "\t- Avoid using `tokenizers` before the fork if possible\n",
+ "\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Installing hub:\u001b[35m/\u001b[0m\u001b[35m/guardrails/\u001b[0m\u001b[95msimilar_to_document...\u001b[0m\n",
+ "\u001b[2K\u001b[32m[= ]\u001b[0m Fetching manifestst\n",
+ "\u001b[2K\u001b[32m[== ]\u001b[0m Downloading dependenciespendencies Running command git clone --filter=blob:none --quiet https://github.com/guardrails-ai/similar_to_document.git /private/var/folders/w2/ssf16z690zd7_4dggw0y5s_m0000gn/T/pip-req-build-oys8q6q2\n",
+ "\u001b[2K\u001b[32m[=== ]\u001b[0m Downloading dependencies\u001b[33mWARNING: Target directory /Users/calebcourier/Projects/gr-mono/guardrails/docs/examples/.venv/lib/python3.11/site-packages/guardrails/hub/guardrails/similar_to_document/validator already exists. Specify --upgrade to force replacement.\u001b[0m\u001b[33m\n",
+ "\u001b[0m\u001b[33mWARNING: Target directory /Users/calebcourier/Projects/gr-mono/guardrails/docs/examples/.venv/lib/python3.11/site-packages/guardrails/hub/guardrails/similar_to_document/similar_to_document-0.0.0.dist-info already exists. Specify --upgrade to force replacement.\u001b[0m\u001b[33m\n",
+ "\u001b[2K\u001b[32m[ ==]\u001b[0m Downloading dependencies\n",
+ "\u001b[1A\u001b[2K\u001b[?25l\u001b[32m[ ]\u001b[0m Running post-install setup\n",
+ "\u001b[1A\u001b[2K✅Successfully installed guardrails/similar_to_document!\n",
+ "\n",
+ "\n",
+ "\u001b[1mImport validator:\u001b[0m\n",
+ "from guardrails.hub import SimilarToDocument\n",
+ "\n",
+ "\u001b[1mGet more info:\u001b[0m\n",
+ "\u001b[4;94mhttps://hub.guardrailsai.com/validator/guardrails/similar_to_document\u001b[0m\n",
+ "\n"
+ ]
+ }
+ ],
"source": [
"!guardrails hub install hub://guardrails/similar_to_document"
]
@@ -32,17 +65,9 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Requirement already satisfied: numpy in /home/zayd/workspace/shreya/guardrails/.venv/lib/python3.11/site-packages (1.25.2)\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"!pip install numpy"
]
@@ -70,14 +95,14 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
- "with open('data/article1.txt', 'r') as file:\n",
+ "with open(\"data/article1.txt\", \"r\") as file:\n",
" document = file.read()\n",
" file.seek(0)\n",
- " content = ''.join(line.strip() for line in file.readlines())"
+ " content = \"\".join(line.strip() for line in file.readlines())"
]
},
{
@@ -89,13 +114,14 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"from string import Template\n",
"\n",
- "rail_str = Template(\"\"\"\n",
+ "rail_str = Template(\n",
+ " \"\"\"\n",
"\n",
"\n",
"\n",
- "\"\"\").safe_substitute(document=document)"
+ "\"\"\"\n",
+ ").safe_substitute(document=document)"
]
},
{
@@ -127,11 +154,12 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pydantic import BaseModel, Field\n",
+ "\n",
"from guardrails.hub import SimilarToDocument\n",
"\n",
"prompt = \"\"\"\n",
@@ -142,10 +170,13 @@
"${gr.complete_json_suffix}\n",
"\"\"\"\n",
"\n",
+ "\n",
"class DocumentSummary(BaseModel):\n",
" summary: str = Field(\n",
" description=\"Summarize the given document faithfully.\",\n",
- " validators=[SimilarToDocument(document=f\"'{content}'\", threshold=0.60, on_fail=\"filter\")]\n",
+ " validators=[\n",
+ " SimilarToDocument(document=f\"'{content}'\", threshold=0.60, on_fail=\"filter\")\n",
+ " ],\n",
" )"
]
},
@@ -174,13 +205,13 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
- "import guardrails as gd\n",
+ "from rich import print\n",
"\n",
- "from rich import print"
+ "import guardrails as gd"
]
},
{
@@ -192,7 +223,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -208,9 +239,17 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 21,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Loading the model all-MiniLM-L6-v2. This may take a while...\n"
+ ]
+ }
+ ],
"source": [
"guard = gd.Guard.from_pydantic(output_class=DocumentSummary, prompt=prompt)"
]
@@ -224,7 +263,7 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 27,
"metadata": {},
"outputs": [
{
@@ -239,7 +278,26 @@
"Given below is XML that describes the information to extract from this document and the tags to extract it into.\n",
"\n",
"<output>\n",
- " <string name=\"summary\"description=\"Summarize the given document faithfully.\"/>\n",
+ " <string name=\"summary\"description=\"Summarize the given document faithfully.\"\n",
+ "format=\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted shall be vested \n",
+ "in a Congress of the United States, which shall consist of a Senate and House of Representatives.Section. 2.The \n",
+ "House of Representatives shall be composed of Members chosen every second Year by the People of the several States,\n",
+ "and the Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch of \n",
+ "the State Legislature.No Person shall be a Representative who shall not have attained to the Age of twenty five \n",
+ "Years, and been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of \n",
+ "that State in which he shall be chosen.Representatives and direct Taxes shall be apportioned among the several \n",
+ "States which may be included within this Union, according to their respective Numbers, which shall be determined by\n",
+ "adding to the whole Number of free Persons, including those bound to Service for a Term of Years, and excluding \n",
+ "Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three Years after\n",
+ "the first Meeting of the Congress of the United States, and within every subsequent Term of ten Years, in such \n",
+ "Manner as they shall by Law direct. The Number of Representatives shall not exceed one for every thirty Thousand, \n",
+ "but each State shall have at Least one Representative; and until such enumeration shall be made, the State of New \n",
+ "Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, \n",
+ "Connecticut five, New-York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, \n",
+ "North Carolina five, South Carolina five, and Georgia three.When vacancies happen in the Representation from any \n",
+ "State, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.The House of \n",
+ "Representatives shall chuse their Speaker and other Officers; and shall have the sole Power of Impeachment.' \n",
+ "threshold=0.6 model=all-MiniLM-L6-v2\"/>\n",
"</output>\n",
"\n",
"\n",
@@ -267,7 +325,26 @@
"Given below is XML that describes the information to extract from this document and the tags to extract it into.\n",
"\n",
"\u001b[1m<\u001b[0m\u001b[1;95moutput\u001b[0m\u001b[39m>\u001b[0m\n",
- "\u001b[39m \u001b[0m\n",
+ "\u001b[39m \u001b[0m\n",
"\u001b[39m<\u001b[0m\u001b[35m/\u001b[0m\u001b[95moutput\u001b[0m\u001b[39m>\u001b[0m\n",
"\n",
"\n",
@@ -290,7 +367,7 @@
}
],
"source": [
- "print(guard.base_prompt)"
+ "print(guard.rail.prompt)"
]
},
{
@@ -316,34 +393,58 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 23,
"metadata": {},
"outputs": [
{
- "name": "stderr",
+ "name": "stdout",
"output_type": "stream",
"text": [
- "Async event loop found, but guard was invoked synchronously.For validator parallelization, please call `validate_async` instead.\n"
+ "Similarity: 0.971, Type: \n"
]
},
{
"data": {
"text/html": [
- "
Validated Output: {'summary': 'The US Congress consists of a Senate and House of Representatives, with the House of\n",
- "Representatives being chosen every two years by the people of the several states. Representatives must be at least \n",
- "25 years old and have been a citizen of the US for seven years. Representation and taxes are apportioned among the \n",
- "states according to their population, and the number of representatives cannot exceed one for every 30,000 people. \n",
- "Vacancies are filled by the executive authority of the state. The House of Representatives chooses its speaker and \n",
- "other officers, and has the sole power of impeachment.'}\n",
+ "
Validated Output: {'summary': 'All legislative Powers herein granted shall be vested in a Congress of the United \n",
+ "States, which shall consist of a Senate and House of Representatives. The House of Representatives shall be \n",
+ "composed of Members chosen every second Year by the People of the several States, and the Electors in each State \n",
+ "shall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature. No \n",
+ "Person shall be a Representative who shall not have attained to the Age of twenty five Years, and been seven Years \n",
+ "a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State in which he shall \n",
+ "be chosen. Representatives and direct Taxes shall be apportioned among the several States which may be included \n",
+ "within this Union, according to their respective Numbers, which shall be determined by adding to the whole Number \n",
+ "of free Persons, including those bound to Service for a Term of Years, and excluding Indians not taxed, three \n",
+ "fifths of all other Persons. The actual Enumeration shall be made within three Years after the first Meeting of the\n",
+ "Congress of the United States, and within every subsequent Term of ten Years, in such Manner as they shall by Law \n",
+ "direct. The Number of Representatives shall not exceed one for every thirty Thousand, but each State shall have at \n",
+ "Least one Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitled to\n",
+ "chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New \n",
+ "Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina \n",
+ "five, and Georgia three. When vacancies happen in the Representation from any State, the Executive Authority \n",
+ "thereof shall issue Writs of Election to fill such Vacancies. The House of Representatives shall chuse their \n",
+ "Speaker and other Officers; and shall have the sole Power of Impeachment.'}\n",
"
\n"
],
"text/plain": [
- "Validated Output: \u001b[1m{\u001b[0m\u001b[32m'summary'\u001b[0m: \u001b[32m'The US Congress consists of a Senate and House of Representatives, with the House of\u001b[0m\n",
- "\u001b[32mRepresentatives being chosen every two years by the people of the several states. Representatives must be at least \u001b[0m\n",
- "\u001b[32m25 years old and have been a citizen of the US for seven years. Representation and taxes are apportioned among the \u001b[0m\n",
- "\u001b[32mstates according to their population, and the number of representatives cannot exceed one for every 30,000 people. \u001b[0m\n",
- "\u001b[32mVacancies are filled by the executive authority of the state. The House of Representatives chooses its speaker and \u001b[0m\n",
- "\u001b[32mother officers, and has the sole power of impeachment.'\u001b[0m\u001b[1m}\u001b[0m\n"
+ "Validated Output: \u001b[1m{\u001b[0m\u001b[32m'summary'\u001b[0m: \u001b[32m'All legislative Powers herein granted shall be vested in a Congress of the United \u001b[0m\n",
+ "\u001b[32mStates, which shall consist of a Senate and House of Representatives. The House of Representatives shall be \u001b[0m\n",
+ "\u001b[32mcomposed of Members chosen every second Year by the People of the several States, and the Electors in each State \u001b[0m\n",
+ "\u001b[32mshall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature. No \u001b[0m\n",
+ "\u001b[32mPerson shall be a Representative who shall not have attained to the Age of twenty five Years, and been seven Years \u001b[0m\n",
+ "\u001b[32ma Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State in which he shall \u001b[0m\n",
+ "\u001b[32mbe chosen. Representatives and direct Taxes shall be apportioned among the several States which may be included \u001b[0m\n",
+ "\u001b[32mwithin this Union, according to their respective Numbers, which shall be determined by adding to the whole Number \u001b[0m\n",
+ "\u001b[32mof free Persons, including those bound to Service for a Term of Years, and excluding Indians not taxed, three \u001b[0m\n",
+ "\u001b[32mfifths of all other Persons. The actual Enumeration shall be made within three Years after the first Meeting of the\u001b[0m\n",
+ "\u001b[32mCongress of the United States, and within every subsequent Term of ten Years, in such Manner as they shall by Law \u001b[0m\n",
+ "\u001b[32mdirect. The Number of Representatives shall not exceed one for every thirty Thousand, but each State shall have at \u001b[0m\n",
+ "\u001b[32mLeast one Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitled to\u001b[0m\n",
+ "\u001b[32mchuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New \u001b[0m\n",
+ "\u001b[32mJersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina \u001b[0m\n",
+ "\u001b[32mfive, and Georgia three. When vacancies happen in the Representation from any State, the Executive Authority \u001b[0m\n",
+ "\u001b[32mthereof shall issue Writs of Election to fill such Vacancies. The House of Representatives shall chuse their \u001b[0m\n",
+ "\u001b[32mSpeaker and other Officers; and shall have the sole Power of Impeachment.'\u001b[0m\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
@@ -354,11 +455,11 @@
"import openai\n",
"\n",
"raw_llm_response, validated_response, *rest = guard(\n",
- " openai.completions.create,\n",
- " prompt_params={'document': document},\n",
- " model='text-davinci-003',\n",
+ " openai.chat.completions.create,\n",
+ " prompt_params={\"document\": document},\n",
+ " model=\"gpt-3.5-turbo\",\n",
" max_tokens=2048,\n",
- " temperature=0\n",
+ " temperature=0,\n",
")\n",
"\n",
"print(f\"Validated Output: {validated_response}\")"
@@ -374,7 +475,7 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 24,
"metadata": {},
"outputs": [
{
@@ -382,190 +483,278 @@
"text/html": [
"
Logs\n",
"└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
- " │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
- " │ │ │ │\n",
- " │ │ Summarize the following document: │ │\n",
- " │ │ │ │\n",
- " │ │ Section. 1. │ │\n",
- " │ │ All legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
- " │ │ consist of a Senate and House of Representatives. │ │\n",
- " │ │ │ │\n",
- " │ │ Section. 2. │ │\n",
- " │ │ The House of Representatives shall be composed of Members chosen every second Year by the People of the │ │\n",
- " │ │ several States, and the Electors in each State shall have the Qualifications requisite for Electors of │ │\n",
- " │ │ the most numerous Branch of the State Legislature. │ │\n",
- " │ │ │ │\n",
- " │ │ No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and │ │\n",
- " │ │ been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of │ │\n",
- " │ │ that State in which he shall be chosen. │ │\n",
- " │ │ │ │\n",
- " │ │ Representatives and direct Taxes shall be apportioned among the several States which may be included │ │\n",
- " │ │ within this Union, according to their respective Numbers, which shall be determined by adding to the │ │\n",
- " │ │ whole Number of free Persons, including those bound to Service for a Term of Years, and excluding │ │\n",
- " │ │ Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three │ │\n",
- " │ │ Years after the first Meeting of the Congress of the United States, and within every subsequent Term of │ │\n",
- " │ │ ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed │ │\n",
- " │ │ one for every thirty Thousand, but each State shall have at Least one Representative; and until such │ │\n",
- " │ │ enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts │ │\n",
- " │ │ eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, │ │\n",
- " │ │ Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, │ │\n",
- " │ │ and Georgia three. │ │\n",
- " │ │ │ │\n",
- " │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
- " │ │ Writs of Election to fill such Vacancies. │ │\n",
- " │ │ │ │\n",
- " │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- " │ │ Power of Impeachment. │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
- " │ │ it into. │ │\n",
- " │ │ │ │\n",
- " │ │ <output> │ │\n",
- " │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\"/> │ │\n",
- " │ │ </output> │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- " │ │ enter `null`. │ │\n",
- " │ │ │ │\n",
- " │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
- " │ │ - `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}` │ │\n",
- " │ │ - `<list name='bar'><string format='upper-case' /></list>` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
- " │ │ etc.]}` │ │\n",
- " │ │ - `<object name='baz'><string name=\"foo\" format=\"capitalize two-words\" /><integer name=\"index\" │ │\n",
- " │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Json Output: │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
- " │ │ ┏━━━━━━┳━━━━━━━━━┓ │ │\n",
- " │ │ ┃ Role ┃ Content ┃ │ │\n",
- " │ │ ┡━━━━━━╇━━━━━━━━━┩ │ │\n",
- " │ │ └──────┴─────────┘ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- " │ │ {\"summary\": \"The US Congress consists of a Senate and House of Representatives, with the House of │ │\n",
- " │ │ Representatives being chosen every two years by the people of the several states. Representatives must │ │\n",
- " │ │ be at least 25 years old and have been a citizen of the US for seven years. Representation and taxes │ │\n",
- " │ │ are apportioned among the states according to their population, and the number of representatives │ │\n",
- " │ │ cannot exceed one for every 30,000 people. Vacancies are filled by the executive authority of the │ │\n",
- " │ │ state. The House of Representatives chooses its speaker and other officers, and has the sole power of │ │\n",
- " │ │ impeachment.\"} │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- " │ │ { │ │\n",
- " │ │ 'summary': 'The US Congress consists of a Senate and House of Representatives, with the House of │ │\n",
- " │ │ Representatives being chosen every two years by the people of the several states. Representatives must │ │\n",
- " │ │ be at least 25 years old and have been a citizen of the US for seven years. Representation and taxes │ │\n",
- " │ │ are apportioned among the states according to their population, and the number of representatives │ │\n",
- " │ │ cannot exceed one for every 30,000 people. Vacancies are filled by the executive authority of the │ │\n",
- " │ │ state. The House of Representatives chooses its speaker and other officers, and has the sole power of │ │\n",
- " │ │ impeachment.' │ │\n",
- " │ │ } │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
+ " │ │ │ │\n",
+ " │ │ Summarize the following document: │ │\n",
+ " │ │ │ │\n",
+ " │ │ Section. 1. │ │\n",
+ " │ │ All legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
+ " │ │ consist of a Senate and House of Representatives. │ │\n",
+ " │ │ │ │\n",
+ " │ │ Section. 2. │ │\n",
+ " │ │ The House of Representatives shall be composed of Members chosen every second Year by the People of the │ │\n",
+ " │ │ several States, and the Electors in each State shall have the Qualifications requisite for Electors of │ │\n",
+ " │ │ the most numerous Branch of the State Legislature. │ │\n",
+ " │ │ │ │\n",
+ " │ │ No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and │ │\n",
+ " │ │ been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of │ │\n",
+ " │ │ that State in which he shall be chosen. │ │\n",
+ " │ │ │ │\n",
+ " │ │ Representatives and direct Taxes shall be apportioned among the several States which may be included │ │\n",
+ " │ │ within this Union, according to their respective Numbers, which shall be determined by adding to the │ │\n",
+ " │ │ whole Number of free Persons, including those bound to Service for a Term of Years, and excluding │ │\n",
+ " │ │ Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three │ │\n",
+ " │ │ Years after the first Meeting of the Congress of the United States, and within every subsequent Term of │ │\n",
+ " │ │ ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed │ │\n",
+ " │ │ one for every thirty Thousand, but each State shall have at Least one Representative; and until such │ │\n",
+ " │ │ enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts │ │\n",
+ " │ │ eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, │ │\n",
+ " │ │ Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, │ │\n",
+ " │ │ and Georgia three. │ │\n",
+ " │ │ │ │\n",
+ " │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
+ " │ │ Writs of Election to fill such Vacancies. │ │\n",
+ " │ │ │ │\n",
+ " │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
+ " │ │ Power of Impeachment. │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
+ " │ │ it into. │ │\n",
+ " │ │ │ │\n",
+ " │ │ <output> │ │\n",
+ " │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\" │ │\n",
+ " │ │ format=\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted │ │\n",
+ " │ │ shall be vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ " │ │ Representatives.Section. 2.The House of Representatives shall be composed of Members chosen every │ │\n",
+ " │ │ second Year by the People of the several States, and the Electors in each State shall have the │ │\n",
+ " │ │ Qualifications requisite for Electors of the most numerous Branch of the State Legislature.No Person │ │\n",
+ " │ │ shall be a Representative who shall not have attained to the Age of twenty five Years, and been seven │ │\n",
+ " │ │ Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State │ │\n",
+ " │ │ in which he shall be chosen.Representatives and direct Taxes shall be apportioned among the several │ │\n",
+ " │ │ States which may be included within this Union, according to their respective Numbers, which shall be │ │\n",
+ " │ │ determined by adding to the whole Number of free Persons, including those bound to Service for a Term │ │\n",
+ " │ │ of Years, and excluding Indians not taxed, three fifths of all other Persons. The actual Enumeration │ │\n",
+ " │ │ shall be made within three Years after the first Meeting of the Congress of the United States, and │ │\n",
+ " │ │ within every subsequent Term of ten Years, in such Manner as they shall by Law direct. The Number of │ │\n",
+ " │ │ Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one │ │\n",
+ " │ │ Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitled │ │\n",
+ " │ │ to chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, │ │\n",
+ " │ │ New-York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North │ │\n",
+ " │ │ Carolina five, South Carolina five, and Georgia three.When vacancies happen in the Representation from │ │\n",
+ " │ │ any State, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.The │ │\n",
+ " │ │ House of Representatives shall chuse their Speaker and other Officers; and shall have the sole Power of │ │\n",
+ " │ │ Impeachment.' threshold=0.6 model=all-MiniLM-L6-v2\"/> │ │\n",
+ " │ │ </output> │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
+ " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
+ " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
+ " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
+ " │ │ enter `null`. │ │\n",
+ " │ │ │ │\n",
+ " │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
+ " │ │ - `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}` │ │\n",
+ " │ │ - `<list name='bar'><string format='upper-case' /></list>` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
+ " │ │ etc.]}` │ │\n",
+ " │ │ - `<object name='baz'><string name=\"foo\" format=\"capitalize two-words\" /><integer name=\"index\" │ │\n",
+ " │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭───────────────────────────────────────────── Instructions ──────────────────────────────────────────────╮ │\n",
+ " │ │ You are a helpful assistant, able to express yourself purely through JSON, strictly and precisely │ │\n",
+ " │ │ adhering to the provided XML schemas. │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
+ " │ │ No message history. │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
+ " │ │ {\"summary\":\"All legislative Powers herein granted shall be vested in a Congress of the United States, │ │\n",
+ " │ │ which shall consist of a Senate and House of Representatives. The House of Representatives shall be │ │\n",
+ " │ │ composed of Members chosen every second Year by the People of the several States, and the Electors in │ │\n",
+ " │ │ each State shall have the Qualifications requisite for Electors of the most numerous Branch of the │ │\n",
+ " │ │ State Legislature. No Person shall be a Representative who shall not have attained to the Age of twenty │ │\n",
+ " │ │ five Years, and been seven Years a Citizen of the United States, and who shall not, when elected, be an │ │\n",
+ " │ │ Inhabitant of that State in which he shall be chosen. Representatives and direct Taxes shall be │ │\n",
+ " │ │ apportioned among the several States which may be included within this Union, according to their │ │\n",
+ " │ │ respective Numbers, which shall be determined by adding to the whole Number of free Persons, including │ │\n",
+ " │ │ those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of all other │ │\n",
+ " │ │ Persons. The actual Enumeration shall be made within three Years after the first Meeting of the │ │\n",
+ " │ │ Congress of the United States, and within every subsequent Term of ten Years, in such Manner as they │ │\n",
+ " │ │ shall by Law direct. The Number of Representatives shall not exceed one for every thirty Thousand, but │ │\n",
+ " │ │ each State shall have at Least one Representative; and until such enumeration shall be made, the State │ │\n",
+ " │ │ of New Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode-Island and Providence │ │\n",
+ " │ │ Plantations one, Connecticut five, New-York six, New Jersey four, Pennsylvania eight, Delaware one, │ │\n",
+ " │ │ Maryland six, Virginia ten, North Carolina five, South Carolina five, and Georgia three. When vacancies │ │\n",
+ " │ │ happen in the Representation from any State, the Executive Authority thereof shall issue Writs of │ │\n",
+ " │ │ Election to fill such Vacancies. The House of Representatives shall chuse their Speaker and other │ │\n",
+ " │ │ Officers; and shall have the sole Power of Impeachment.\"} │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
+ " │ │ { │ │\n",
+ " │ │ 'summary': 'All legislative Powers herein granted shall be vested in a Congress of the United │ │\n",
+ " │ │ States, which shall consist of a Senate and House of Representatives. The House of Representatives │ │\n",
+ " │ │ shall be composed of Members chosen every second Year by the People of the several States, and the │ │\n",
+ " │ │ Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch │ │\n",
+ " │ │ of the State Legislature. No Person shall be a Representative who shall not have attained to the Age of │ │\n",
+ " │ │ twenty five Years, and been seven Years a Citizen of the United States, and who shall not, when │ │\n",
+ " │ │ elected, be an Inhabitant of that State in which he shall be chosen. Representatives and direct Taxes │ │\n",
+ " │ │ shall be apportioned among the several States which may be included within this Union, according to │ │\n",
+ " │ │ their respective Numbers, which shall be determined by adding to the whole Number of free Persons, │ │\n",
+ " │ │ including those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of │ │\n",
+ " │ │ all other Persons. The actual Enumeration shall be made within three Years after the first Meeting of │ │\n",
+ " │ │ the Congress of the United States, and within every subsequent Term of ten Years, in such Manner as │ │\n",
+ " │ │ they shall by Law direct. The Number of Representatives shall not exceed one for every thirty Thousand, │ │\n",
+ " │ │ but each State shall have at Least one Representative; and until such enumeration shall be made, the │ │\n",
+ " │ │ State of New Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode-Island and │ │\n",
+ " │ │ Providence Plantations one, Connecticut five, New-York six, New Jersey four, Pennsylvania eight, │ │\n",
+ " │ │ Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, and Georgia three. │ │\n",
+ " │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
+ " │ │ Writs of Election to fill such Vacancies. The House of Representatives shall chuse their Speaker and │ │\n",
+ " │ │ other Officers; and shall have the sole Power of Impeachment.' │ │\n",
+ " │ │ } │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
"
\n"
],
"text/plain": [
"Logs\n",
"└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
- " │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
- " │ │ │ │\n",
- " │ │ Summarize the following document: │ │\n",
- " │ │ │ │\n",
- " │ │ Section. 1. │ │\n",
- " │ │ All legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
- " │ │ consist of a Senate and House of Representatives. │ │\n",
- " │ │ │ │\n",
- " │ │ Section. 2. │ │\n",
- " │ │ The House of Representatives shall be composed of Members chosen every second Year by the People of the │ │\n",
- " │ │ several States, and the Electors in each State shall have the Qualifications requisite for Electors of │ │\n",
- " │ │ the most numerous Branch of the State Legislature. │ │\n",
- " │ │ │ │\n",
- " │ │ No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and │ │\n",
- " │ │ been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of │ │\n",
- " │ │ that State in which he shall be chosen. │ │\n",
- " │ │ │ │\n",
- " │ │ Representatives and direct Taxes shall be apportioned among the several States which may be included │ │\n",
- " │ │ within this Union, according to their respective Numbers, which shall be determined by adding to the │ │\n",
- " │ │ whole Number of free Persons, including those bound to Service for a Term of Years, and excluding │ │\n",
- " │ │ Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three │ │\n",
- " │ │ Years after the first Meeting of the Congress of the United States, and within every subsequent Term of │ │\n",
- " │ │ ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed │ │\n",
- " │ │ one for every thirty Thousand, but each State shall have at Least one Representative; and until such │ │\n",
- " │ │ enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts │ │\n",
- " │ │ eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, │ │\n",
- " │ │ Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, │ │\n",
- " │ │ and Georgia three. │ │\n",
- " │ │ │ │\n",
- " │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
- " │ │ Writs of Election to fill such Vacancies. │ │\n",
- " │ │ │ │\n",
- " │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- " │ │ Power of Impeachment. │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
- " │ │ it into. │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- " │ │ enter `null`. │ │\n",
- " │ │ │ │\n",
- " │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
- " │ │ - `` => `{'foo': 'example one'}` │ │\n",
- " │ │ - `` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
- " │ │ etc.]}` │ │\n",
- " │ │ - `` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Json Output: │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
- " │ │ ┏━━━━━━┳━━━━━━━━━┓ │ │\n",
- " │ │ ┃\u001b[1m \u001b[0m\u001b[1mRole\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mContent\u001b[0m\u001b[1m \u001b[0m┃ │ │\n",
- " │ │ ┡━━━━━━╇━━━━━━━━━┩ │ │\n",
- " │ │ └──────┴─────────┘ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- " │ │ {\"summary\": \"The US Congress consists of a Senate and House of Representatives, with the House of │ │\n",
- " │ │ Representatives being chosen every two years by the people of the several states. Representatives must │ │\n",
- " │ │ be at least 25 years old and have been a citizen of the US for seven years. Representation and taxes │ │\n",
- " │ │ are apportioned among the states according to their population, and the number of representatives │ │\n",
- " │ │ cannot exceed one for every 30,000 people. Vacancies are filled by the executive authority of the │ │\n",
- " │ │ state. The House of Representatives chooses its speaker and other officers, and has the sole power of │ │\n",
- " │ │ impeachment.\"} │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- " │ │ { │ │\n",
- " │ │ 'summary': 'The US Congress consists of a Senate and House of Representatives, with the House of │ │\n",
- " │ │ Representatives being chosen every two years by the people of the several states. Representatives must │ │\n",
- " │ │ be at least 25 years old and have been a citizen of the US for seven years. Representation and taxes │ │\n",
- " │ │ are apportioned among the states according to their population, and the number of representatives │ │\n",
- " │ │ cannot exceed one for every 30,000 people. Vacancies are filled by the executive authority of the │ │\n",
- " │ │ state. The House of Representatives chooses its speaker and other officers, and has the sole power of │ │\n",
- " │ │ impeachment.' │ │\n",
- " │ │ } │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ \u001b[48;2;240;248;255m╭─\u001b[0m\u001b[48;2;240;248;255m───────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m Prompt \u001b[0m\u001b[48;2;240;248;255m────────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mSummarize the following document:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mSection. 1.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mAll legislative Powers herein granted shall be vested in a Congress of the United States, which shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mconsist of a Senate and House of Representatives.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mSection. 2.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mThe House of Representatives shall be composed of Members chosen every second Year by the People of the\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mseveral States, and the Electors in each State shall have the Qualifications requisite for Electors of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mthe most numerous Branch of the State Legislature.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mNo Person shall be a Representative who shall not have attained to the Age of twenty five Years, and \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mbeen seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mthat State in which he shall be chosen.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mRepresentatives and direct Taxes shall be apportioned among the several States which may be included \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mwithin this Union, according to their respective Numbers, which shall be determined by adding to the \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mwhole Number of free Persons, including those bound to Service for a Term of Years, and excluding \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mIndians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mYears after the first Meeting of the Congress of the United States, and within every subsequent Term of\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mone for every thirty Thousand, but each State shall have at Least one Representative; and until such \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255menumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255meight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mPennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five,\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mand Georgia three.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mWhen vacancies happen in the Representation from any State, the Executive Authority thereof shall issue\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mWrits of Election to fill such Vacancies.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mThe House of Representatives shall chuse their Speaker and other Officers; and shall have the sole \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mPower of Impeachment.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mGiven below is XML that describes the information to extract from this document and the tags to extract\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mit into.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m`name` attribute of the corresponding XML, and the value is of the type specified by the corresponding \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mXML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mrequests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255menter `null`.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mHere are examples of simple (XML, JSON) pairs that show the expected behavior:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m- `` => `{'foo': 'example one'}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m- `` => `{\"bar\": ['STRING ONE', 'STRING TWO', \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255metc.]}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m- `` => `{'baz': {'foo': 'Some String', 'index': 1}}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m╭─\u001b[0m\u001b[48;2;255;240;242m────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m Instructions \u001b[0m\u001b[48;2;255;240;242m─────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242mYou are a helpful assistant, able to express yourself purely through JSON, strictly and precisely \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242madhering to the provided XML schemas.\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
+ " │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m{\"summary\":\"All legislative Powers herein granted shall be vested in a Congress of the United States, \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mwhich shall consist of a Senate and House of Representatives. The House of Representatives shall be \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mcomposed of Members chosen every second Year by the People of the several States, and the Electors in \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220meach State shall have the Qualifications requisite for Electors of the most numerous Branch of the \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mState Legislature. No Person shall be a Representative who shall not have attained to the Age of twenty\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mfive Years, and been seven Years a Citizen of the United States, and who shall not, when elected, be an\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mInhabitant of that State in which he shall be chosen. Representatives and direct Taxes shall be \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mapportioned among the several States which may be included within this Union, according to their \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mrespective Numbers, which shall be determined by adding to the whole Number of free Persons, including \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthose bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of all other \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mPersons. The actual Enumeration shall be made within three Years after the first Meeting of the \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mCongress of the United States, and within every subsequent Term of ten Years, in such Manner as they \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mshall by Law direct. The Number of Representatives shall not exceed one for every thirty Thousand, but \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220meach State shall have at Least one Representative; and until such enumeration shall be made, the State \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof New Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode-Island and Providence \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mPlantations one, Connecticut five, New-York six, New Jersey four, Pennsylvania eight, Delaware one, \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mMaryland six, Virginia ten, North Carolina five, South Carolina five, and Georgia three. When vacancies\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mhappen in the Representation from any State, the Executive Authority thereof shall issue Writs of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mElection to fill such Vacancies. The House of Representatives shall chuse their Speaker and other \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mOfficers; and shall have the sole Power of Impeachment.\"}\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m{\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m 'summary': 'All legislative Powers herein granted shall be vested in a Congress of the United \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mStates, which shall consist of a Senate and House of Representatives. The House of Representatives \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mshall be composed of Members chosen every second Year by the People of the several States, and the \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mElectors in each State shall have the Qualifications requisite for Electors of the most numerous Branch\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mof the State Legislature. No Person shall be a Representative who shall not have attained to the Age of\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mtwenty five Years, and been seven Years a Citizen of the United States, and who shall not, when \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240melected, be an Inhabitant of that State in which he shall be chosen. Representatives and direct Taxes \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mshall be apportioned among the several States which may be included within this Union, according to \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mtheir respective Numbers, which shall be determined by adding to the whole Number of free Persons, \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mincluding those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mall other Persons. The actual Enumeration shall be made within three Years after the first Meeting of \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mthe Congress of the United States, and within every subsequent Term of ten Years, in such Manner as \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mthey shall by Law direct. The Number of Representatives shall not exceed one for every thirty Thousand,\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mbut each State shall have at Least one Representative; and until such enumeration shall be made, the \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mState of New Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode-Island and \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mProvidence Plantations one, Connecticut five, New-York six, New Jersey four, Pennsylvania eight, \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mDelaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, and Georgia three. \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mWhen vacancies happen in the Representation from any State, the Executive Authority thereof shall issue\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mWrits of Election to fill such Vacancies. The House of Representatives shall chuse their Speaker and \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mother Officers; and shall have the sole Power of Impeachment.'\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m}\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n"
]
},
@@ -589,7 +778,7 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 25,
"metadata": {},
"outputs": [
{
@@ -609,10 +798,10 @@
"source": [
"raw_llm_response, validated_response, *rest = guard(\n",
" openai.completions.create,\n",
- " prompt_params={'document': open(\"data/article1.txt\", \"r\").read()},\n",
- " model='text-ada-001',\n",
+ " prompt_params={\"document\": open(\"data/article1.txt\", \"r\").read()},\n",
+ " model=\"babbage-002\",\n",
" max_tokens=512,\n",
- " temperature=0\n",
+ " temperature=0,\n",
")\n",
"\n",
"print(f\"Validated Output: {validated_response}\")"
@@ -628,7 +817,7 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": 26,
"metadata": {},
"outputs": [
{
@@ -636,298 +825,570 @@
"text/html": [
"
Logs\n",
"├── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
- "│ │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Summarize the following document: │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Section. 1. │ │\n",
- "│ │ │ All legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
- "│ │ │ consist of a Senate and House of Representatives. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Section. 2. │ │\n",
- "│ │ │ The House of Representatives shall be composed of Members chosen every second Year by the People of the │ │\n",
- "│ │ │ several States, and the Electors in each State shall have the Qualifications requisite for Electors of │ │\n",
- "│ │ │ the most numerous Branch of the State Legislature. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and │ │\n",
- "│ │ │ been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of │ │\n",
- "│ │ │ that State in which he shall be chosen. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Representatives and direct Taxes shall be apportioned among the several States which may be included │ │\n",
- "│ │ │ within this Union, according to their respective Numbers, which shall be determined by adding to the │ │\n",
- "│ │ │ whole Number of free Persons, including those bound to Service for a Term of Years, and excluding │ │\n",
- "│ │ │ Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three │ │\n",
- "│ │ │ Years after the first Meeting of the Congress of the United States, and within every subsequent Term of │ │\n",
- "│ │ │ ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed │ │\n",
- "│ │ │ one for every thirty Thousand, but each State shall have at Least one Representative; and until such │ │\n",
- "│ │ │ enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts │ │\n",
- "│ │ │ eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, │ │\n",
- "│ │ │ Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, │ │\n",
- "│ │ │ and Georgia three. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
- "│ │ │ Writs of Election to fill such Vacancies. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- "│ │ │ Power of Impeachment. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
- "│ │ │ it into. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ <output> │ │\n",
- "│ │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\"/> │ │\n",
- "│ │ │ </output> │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- "│ │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- "│ │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- "│ │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- "│ │ │ enter `null`. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
- "│ │ │ - `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}` │ │\n",
- "│ │ │ - `<list name='bar'><string format='upper-case' /></list>` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
- "│ │ │ etc.]}` │ │\n",
- "│ │ │ - `<object name='baz'><string name=\"foo\" format=\"capitalize two-words\" /><integer name=\"index\" │ │\n",
- "│ │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Json Output: │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- "│ │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
- "│ │ │ ┏━━━━━━┳━━━━━━━━━┓ │ │\n",
- "│ │ │ ┃ Role ┃ Content ┃ │ │\n",
- "│ │ │ ┡━━━━━━╇━━━━━━━━━┩ │ │\n",
- "│ │ │ └──────┴─────────┘ │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- "│ │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- "│ │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\"/> │ │\n",
- "│ │ │ </string> │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- "│ │ │ Power of Impeachment. │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- "│ │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- "│ │ │ None │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ "│ │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Summarize the following document: │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Section. 1. │ │\n",
+ "│ │ │ All legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
+ "│ │ │ consist of a Senate and House of Representatives. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Section. 2. │ │\n",
+ "│ │ │ The House of Representatives shall be composed of Members chosen every second Year by the People of the │ │\n",
+ "│ │ │ several States, and the Electors in each State shall have the Qualifications requisite for Electors of │ │\n",
+ "│ │ │ the most numerous Branch of the State Legislature. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and │ │\n",
+ "│ │ │ been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of │ │\n",
+ "│ │ │ that State in which he shall be chosen. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Representatives and direct Taxes shall be apportioned among the several States which may be included │ │\n",
+ "│ │ │ within this Union, according to their respective Numbers, which shall be determined by adding to the │ │\n",
+ "│ │ │ whole Number of free Persons, including those bound to Service for a Term of Years, and excluding │ │\n",
+ "│ │ │ Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three │ │\n",
+ "│ │ │ Years after the first Meeting of the Congress of the United States, and within every subsequent Term of │ │\n",
+ "│ │ │ ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed │ │\n",
+ "│ │ │ one for every thirty Thousand, but each State shall have at Least one Representative; and until such │ │\n",
+ "│ │ │ enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts │ │\n",
+ "│ │ │ eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, │ │\n",
+ "│ │ │ Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, │ │\n",
+ "│ │ │ and Georgia three. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
+ "│ │ │ Writs of Election to fill such Vacancies. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
+ "│ │ │ Power of Impeachment. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
+ "│ │ │ it into. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ <output> │ │\n",
+ "│ │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\" │ │\n",
+ "│ │ │ format=\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted │ │\n",
+ "│ │ │ shall be vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ "│ │ │ Representatives.Section. 2.The House of Representatives shall be composed of Members chosen every │ │\n",
+ "│ │ │ second Year by the People of the several States, and the Electors in each State shall have the │ │\n",
+ "│ │ │ Qualifications requisite for Electors of the most numerous Branch of the State Legislature.No Person │ │\n",
+ "│ │ │ shall be a Representative who shall not have attained to the Age of twenty five Years, and been seven │ │\n",
+ "│ │ │ Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State │ │\n",
+ "│ │ │ in which he shall be chosen.Representatives and direct Taxes shall be apportioned among the several │ │\n",
+ "│ │ │ States which may be included within this Union, according to their respective Numbers, which shall be │ │\n",
+ "│ │ │ determined by adding to the whole Number of free Persons, including those bound to Service for a Term │ │\n",
+ "│ │ │ of Years, and excluding Indians not taxed, three fifths of all other Persons. The actual Enumeration │ │\n",
+ "│ │ │ shall be made within three Years after the first Meeting of the Congress of the United States, and │ │\n",
+ "│ │ │ within every subsequent Term of ten Years, in such Manner as they shall by Law direct. The Number of │ │\n",
+ "│ │ │ Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one │ │\n",
+ "│ │ │ Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitled │ │\n",
+ "│ │ │ to chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, │ │\n",
+ "│ │ │ New-York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North │ │\n",
+ "│ │ │ Carolina five, South Carolina five, and Georgia three.When vacancies happen in the Representation from │ │\n",
+ "│ │ │ any State, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.The │ │\n",
+ "│ │ │ House of Representatives shall chuse their Speaker and other Officers; and shall have the sole Power of │ │\n",
+ "│ │ │ Impeachment.' threshold=0.6 model=all-MiniLM-L6-v2\"/> │ │\n",
+ "│ │ │ </output> │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
+ "│ │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
+ "│ │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
+ "│ │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
+ "│ │ │ enter `null`. │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
+ "│ │ │ - `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}` │ │\n",
+ "│ │ │ - `<list name='bar'><string format='upper-case' /></list>` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
+ "│ │ │ etc.]}` │ │\n",
+ "│ │ │ - `<object name='baz'><string name=\"foo\" format=\"capitalize two-words\" /><integer name=\"index\" │ │\n",
+ "│ │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ Json Output: │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ "│ │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
+ "│ │ │ No message history. │ │\n",
+ "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ "│ │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
+ "│ │ │ { │ │\n",
+ "│ │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ "│ │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ "│ │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ "│ │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ "│ │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ "│ │ │ of Representatives.', │ │\n",
+ "│ │ │ \"name\": \"summary\", │ │\n",
+ "│ │ │ \"threshold\": 0.6, │ │\n",
+ "│ │ │ \"model\": \"all-MiniLM-L6-v2\" │ │\n",
+ "│ │ │ } │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ JSON Output: │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ { │ │\n",
+ "│ │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ "│ │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ "│ │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ "│ │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ "│ │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ "│ │ │ of Representatives.', │ │\n",
+ "│ │ │ \"name\": \"summary\", │ │\n",
+ "│ │ │ \"threshold\": 0.6, │ │\n",
+ "│ │ │ \"model\": \"all-MiniLM-L6-v2\" │ │\n",
+ "│ │ │ } │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ JSON Output: │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ { │ │\n",
+ "│ │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ "│ │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ "│ │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ "│ │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ "│ │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ "│ │ │ of Representatives.', │ │\n",
+ "│ │ │ \"name\": \"summary\", │ │\n",
+ "│ │ │ \"threshold\": 0.6, │ │\n",
+ "│ │ │ \"model\": \"all-MiniLM-L6-v2\" │ │\n",
+ "│ │ │ } │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ JSON Output: │ │\n",
+ "│ │ │ │ │\n",
+ "│ │ │ { │ │\n",
+ "│ │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ "│ │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ "│ │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ "│ │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ "│ │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ "│ │ │ of Representatives.', │ │\n",
+ "│ │ │ \"name\": \"summary\", │ │\n",
+ "│ │ │ \"threshold\": 0.6, │ │\n",
+ "│ │ │ \"model\": \"all-M │ │\n",
+ "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ "│ │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
+ "│ │ │ None │ │\n",
+ "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
"│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
"└── ╭────────────────────────────────────────────────── Step 1 ───────────────────────────────────────────────────╮\n",
- " │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
- " │ │ │ │\n",
- " │ │ I was given the following response, which was not parseable as JSON. │ │\n",
- " │ │ │ │\n",
- " │ │ { │ │\n",
- " │ │ \"incorrect_value\": \" <string name=\\\"summary\\\" description=\\\"Summarize the given document │ │\n",
- " │ │ faithfully.\\\"/>\\n</string>\\n\\nThe House of Representatives shall chuse their Speaker and other │ │\n",
- " │ │ Officers; and shall have the sole Power of Impeachment.\", │ │\n",
- " │ │ \"error_messages\": [ │ │\n",
- " │ │ \"Output is not parseable as JSON\" │ │\n",
- " │ │ ] │ │\n",
- " │ │ } │ │\n",
- " │ │ │ │\n",
- " │ │ Help me correct this by making it valid JSON. │ │\n",
- " │ │ │ │\n",
- " │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
- " │ │ it into. │ │\n",
- " │ │ │ │\n",
- " │ │ <output> │ │\n",
- " │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\"/> │ │\n",
- " │ │ </output> │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- " │ │ enter `null`. │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Json Output: │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭───────────────────────────────────────────── Instructions ──────────────────────────────────────────────╮ │\n",
- " │ │ │ │\n",
- " │ │ You are a helpful assistant only capable of communicating with valid JSON, and no other text. │ │\n",
- " │ │ │ │\n",
- " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- " │ │ enter `null`. │ │\n",
- " │ │ │ │\n",
- " │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
- " │ │ - `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}` │ │\n",
- " │ │ - `<list name='bar'><string format='upper-case' /></list>` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
- " │ │ etc.]}` │ │\n",
- " │ │ - `<object name='baz'><string name=\"foo\" format=\"capitalize two-words\" /><integer name=\"index\" │ │\n",
- " │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
- " │ │ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
- " │ │ No message history. │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- " │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- " │ │ Power of Impeachment. │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- " │ │ None │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
+ " │ │ │ │\n",
+ " │ │ I was given the following response, which was not parseable as JSON. │ │\n",
+ " │ │ │ │\n",
+ " │ │ \" {\\n \\\"summary\\\": \\\"Summarize the given document faithfully.\\\",\\n \\\"string\\\": │ │\n",
+ " │ │ \\\"Section. 1.All legislative Powers herein granted shall be vested in a Congress of the United States, │ │\n",
+ " │ │ which shall consist of a Senate and House of Representatives.\\\",\\n \\\"format\\\": │ │\n",
+ " │ │ \\\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted shall be │ │\n",
+ " │ │ vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ " │ │ Representatives.',\\n \\\"name\\\": \\\"summary\\\",\\n \\\"threshold\\\": 0.6,\\n \\\"model\\\": │ │\n",
+ " │ │ \\\"all-MiniLM-L6-v2\\\"\\n }\\n\\nJSON Output:\\n\\n {\\n \\\"summary\\\": \\\"Summarize the given │ │\n",
+ " │ │ document faithfully.\\\",\\n \\\"string\\\": \\\"Section. 1.All legislative Powers herein granted shall │ │\n",
+ " │ │ be vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ " │ │ Representatives.\\\",\\n \\\"format\\\": \\\"guardrails/similar_to_document: document='Section. 1.All │ │\n",
+ " │ │ legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
+ " │ │ consist of a Senate and House of Representatives.',\\n \\\"name\\\": \\\"summary\\\",\\n │ │\n",
+ " │ │ \\\"threshold\\\": 0.6,\\n \\\"model\\\": \\\"all-MiniLM-L6-v2\\\"\\n }\\n\\nJSON Output:\\n\\n {\\n │ │\n",
+ " │ │ \\\"summary\\\": \\\"Summarize the given document faithfully.\\\",\\n \\\"string\\\": \\\"Section. 1.All │ │\n",
+ " │ │ legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
+ " │ │ consist of a Senate and House of Representatives.\\\",\\n \\\"format\\\": │ │\n",
+ " │ │ \\\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted shall be │ │\n",
+ " │ │ vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ " │ │ Representatives.',\\n \\\"name\\\": \\\"summary\\\",\\n \\\"threshold\\\": 0.6,\\n \\\"model\\\": │ │\n",
+ " │ │ \\\"all-MiniLM-L6-v2\\\"\\n }\\n\\nJSON Output:\\n\\n {\\n \\\"summary\\\": \\\"Summarize the given │ │\n",
+ " │ │ document faithfully.\\\",\\n \\\"string\\\": \\\"Section. 1.All legislative Powers herein granted shall │ │\n",
+ " │ │ be vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ " │ │ Representatives.\\\",\\n \\\"format\\\": \\\"guardrails/similar_to_document: document='Section. 1.All │ │\n",
+ " │ │ legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
+ " │ │ consist of a Senate and House of Representatives.',\\n \\\"name\\\": \\\"summary\\\",\\n │ │\n",
+ " │ │ \\\"threshold\\\": 0.6,\\n \\\"model\\\": \\\"all-M\" │ │\n",
+ " │ │ │ │\n",
+ " │ │ Help me correct this by making it valid JSON. │ │\n",
+ " │ │ │ │\n",
+ " │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
+ " │ │ it into. │ │\n",
+ " │ │ │ │\n",
+ " │ │ <output> │ │\n",
+ " │ │ <string name=\"summary\" description=\"Summarize the given document faithfully.\" │ │\n",
+ " │ │ format=\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted │ │\n",
+ " │ │ shall be vested in a Congress of the United States, which shall consist of a Senate and House of │ │\n",
+ " │ │ Representatives.Section. 2.The House of Representatives shall be composed of Members chosen every │ │\n",
+ " │ │ second Year by the People of the several States, and the Electors in each State shall have the │ │\n",
+ " │ │ Qualifications requisite for Electors of the most numerous Branch of the State Legislature.No Person │ │\n",
+ " │ │ shall be a Representative who shall not have attained to the Age of twenty five Years, and been seven │ │\n",
+ " │ │ Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State │ │\n",
+ " │ │ in which he shall be chosen.Representatives and direct Taxes shall be apportioned among the several │ │\n",
+ " │ │ States which may be included within this Union, according to their respective Numbers, which shall be │ │\n",
+ " │ │ determined by adding to the whole Number of free Persons, including those bound to Service for a Term │ │\n",
+ " │ │ of Years, and excluding Indians not taxed, three fifths of all other Persons. The actual Enumeration │ │\n",
+ " │ │ shall be made within three Years after the first Meeting of the Congress of the United States, and │ │\n",
+ " │ │ within every subsequent Term of ten Years, in such Manner as they shall by Law direct. The Number of │ │\n",
+ " │ │ Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one │ │\n",
+ " │ │ Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitled │ │\n",
+ " │ │ to chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, │ │\n",
+ " │ │ New-York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North │ │\n",
+ " │ │ Carolina five, South Carolina five, and Georgia three.When vacancies happen in the Representation from │ │\n",
+ " │ │ any State, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.The │ │\n",
+ " │ │ House of Representatives shall chuse their Speaker and other Officers; and shall have the sole Power of │ │\n",
+ " │ │ Impeachment.' threshold=0.6 model=all-MiniLM-L6-v2\"/> │ │\n",
+ " │ │ </output> │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
+ " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
+ " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
+ " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
+ " │ │ enter `null`. │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ │ Json Output: │ │\n",
+ " │ │ │ │\n",
+ " │ │ │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
+ " │ │ No message history. │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
+ " │ │ { │ │\n",
+ " │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ " │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ " │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ " │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ " │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ " │ │ of Representatives.', │ │\n",
+ " │ │ \"name\": \"summary\", │ │\n",
+ " │ │ \"threshold\": 0.6, │ │\n",
+ " │ │ \"model\": \"all-MiniLM-L6-v2\" │ │\n",
+ " │ │ } │ │\n",
+ " │ │ │ │\n",
+ " │ │ JSON Output: │ │\n",
+ " │ │ │ │\n",
+ " │ │ { │ │\n",
+ " │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ " │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ " │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ " │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ " │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ " │ │ of Representatives.', │ │\n",
+ " │ │ \"name\": \"summary\", │ │\n",
+ " │ │ \"threshold\": 0.6, │ │\n",
+ " │ │ \"model\": \"all-MiniLM-L6-v2\" │ │\n",
+ " │ │ } │ │\n",
+ " │ │ │ │\n",
+ " │ │ JSON Output: │ │\n",
+ " │ │ │ │\n",
+ " │ │ { │ │\n",
+ " │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ " │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ " │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ " │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ " │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ " │ │ of Representatives.', │ │\n",
+ " │ │ \"name\": \"summary\", │ │\n",
+ " │ │ \"threshold\": 0.6, │ │\n",
+ " │ │ \"model\": \"all-MiniLM-L6-v2\" │ │\n",
+ " │ │ } │ │\n",
+ " │ │ │ │\n",
+ " │ │ JSON Output: │ │\n",
+ " │ │ │ │\n",
+ " │ │ { │ │\n",
+ " │ │ \"summary\": \"Summarize the given document faithfully.\", │ │\n",
+ " │ │ \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of │ │\n",
+ " │ │ the United States, which shall consist of a Senate and House of Representatives.\", │ │\n",
+ " │ │ \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein │ │\n",
+ " │ │ granted shall be vested in a Congress of the United States, which shall consist of a Senate and House │ │\n",
+ " │ │ of Representatives.', │ │\n",
+ " │ │ \"name\": \"summary\", │ │\n",
+ " │ │ \"threshold\": 0.6, │ │\n",
+ " │ │ \"model\": \"all-M │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
+ " │ │ None │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
"
\n"
],
"text/plain": [
"Logs\n",
"├── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
- "│ │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Summarize the following document: │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Section. 1. │ │\n",
- "│ │ │ All legislative Powers herein granted shall be vested in a Congress of the United States, which shall │ │\n",
- "│ │ │ consist of a Senate and House of Representatives. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Section. 2. │ │\n",
- "│ │ │ The House of Representatives shall be composed of Members chosen every second Year by the People of the │ │\n",
- "│ │ │ several States, and the Electors in each State shall have the Qualifications requisite for Electors of │ │\n",
- "│ │ │ the most numerous Branch of the State Legislature. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and │ │\n",
- "│ │ │ been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of │ │\n",
- "│ │ │ that State in which he shall be chosen. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Representatives and direct Taxes shall be apportioned among the several States which may be included │ │\n",
- "│ │ │ within this Union, according to their respective Numbers, which shall be determined by adding to the │ │\n",
- "│ │ │ whole Number of free Persons, including those bound to Service for a Term of Years, and excluding │ │\n",
- "│ │ │ Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three │ │\n",
- "│ │ │ Years after the first Meeting of the Congress of the United States, and within every subsequent Term of │ │\n",
- "│ │ │ ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed │ │\n",
- "│ │ │ one for every thirty Thousand, but each State shall have at Least one Representative; and until such │ │\n",
- "│ │ │ enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts │ │\n",
- "│ │ │ eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, │ │\n",
- "│ │ │ Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, │ │\n",
- "│ │ │ and Georgia three. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue │ │\n",
- "│ │ │ Writs of Election to fill such Vacancies. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- "│ │ │ Power of Impeachment. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
- "│ │ │ it into. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- "│ │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- "│ │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- "│ │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- "│ │ │ enter `null`. │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
- "│ │ │ - `` => `{'foo': 'example one'}` │ │\n",
- "│ │ │ - `` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
- "│ │ │ etc.]}` │ │\n",
- "│ │ │ - `` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ Json Output: │ │\n",
- "│ │ │ │ │\n",
- "│ │ │ │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- "│ │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
- "│ │ │ ┏━━━━━━┳━━━━━━━━━┓ │ │\n",
- "│ │ │ ┃\u001b[1m \u001b[0m\u001b[1mRole\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mContent\u001b[0m\u001b[1m \u001b[0m┃ │ │\n",
- "│ │ │ ┡━━━━━━╇━━━━━━━━━┩ │ │\n",
- "│ │ │ └──────┴─────────┘ │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- "│ │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- "│ │ │ │ │\n",
- "│ │ │
│ │\n",
- "│ │ │ │ │\n",
- "│ │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- "│ │ │ Power of Impeachment. │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- "│ │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- "│ │ │ None │ │\n",
- "│ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ "│ │ \u001b[48;2;240;248;255m╭─\u001b[0m\u001b[48;2;240;248;255m───────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m Prompt \u001b[0m\u001b[48;2;240;248;255m────────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m─╮\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mSummarize the following document:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mSection. 1.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mAll legislative Powers herein granted shall be vested in a Congress of the United States, which shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mconsist of a Senate and House of Representatives.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mSection. 2.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mThe House of Representatives shall be composed of Members chosen every second Year by the People of the\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mseveral States, and the Electors in each State shall have the Qualifications requisite for Electors of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mthe most numerous Branch of the State Legislature.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mNo Person shall be a Representative who shall not have attained to the Age of twenty five Years, and \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mbeen seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mthat State in which he shall be chosen.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mRepresentatives and direct Taxes shall be apportioned among the several States which may be included \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mwithin this Union, according to their respective Numbers, which shall be determined by adding to the \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mwhole Number of free Persons, including those bound to Service for a Term of Years, and excluding \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mIndians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mYears after the first Meeting of the Congress of the United States, and within every subsequent Term of\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mone for every thirty Thousand, but each State shall have at Least one Representative; and until such \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255menumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255meight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mPennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five,\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mand Georgia three.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mWhen vacancies happen in the Representation from any State, the Executive Authority thereof shall issue\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mWrits of Election to fill such Vacancies.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mThe House of Representatives shall chuse their Speaker and other Officers; and shall have the sole \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mPower of Impeachment.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mGiven below is XML that describes the information to extract from this document and the tags to extract\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mit into.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m`name` attribute of the corresponding XML, and the value is of the type specified by the corresponding \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mXML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mrequests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255menter `null`.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mHere are examples of simple (XML, JSON) pairs that show the expected behavior:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m- `` => `{'foo': 'example one'}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m- `` => `{\"bar\": ['STRING ONE', 'STRING TWO', \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255metc.]}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m- `` => `{'baz': {'foo': 'Some String', 'index': 1}}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mJson Output:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ "│ │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
+ "│ │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-MiniLM-L6-v2\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m }\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mJSON Output:\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-MiniLM-L6-v2\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m }\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mJSON Output:\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-MiniLM-L6-v2\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m }\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mJSON Output:\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-M\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mNone\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ "│ │ \u001b[48;2;240;255;240m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
"│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
"└── ╭────────────────────────────────────────────────── Step 1 ───────────────────────────────────────────────────╮\n",
- " │ ╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮ │\n",
- " │ │ │ │\n",
- " │ │ I was given the following response, which was not parseable as JSON. │ │\n",
- " │ │ │ │\n",
- " │ │ { │ │\n",
- " │ │ \"incorrect_value\": \" \\n\\n\\nThe House of Representatives shall chuse their Speaker and other │ │\n",
- " │ │ Officers; and shall have the sole Power of Impeachment.\", │ │\n",
- " │ │ \"error_messages\": [ │ │\n",
- " │ │ \"Output is not parseable as JSON\" │ │\n",
- " │ │ ] │ │\n",
- " │ │ } │ │\n",
- " │ │ │ │\n",
- " │ │ Help me correct this by making it valid JSON. │ │\n",
- " │ │ │ │\n",
- " │ │ Given below is XML that describes the information to extract from this document and the tags to extract │ │\n",
- " │ │ it into. │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- " │ │ enter `null`. │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Json Output: │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭───────────────────────────────────────────── Instructions ──────────────────────────────────────────────╮ │\n",
- " │ │ │ │\n",
- " │ │ You are a helpful assistant only capable of communicating with valid JSON, and no other text. │ │\n",
- " │ │ │ │\n",
- " │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the │ │\n",
- " │ │ `name` attribute of the corresponding XML, and the value is of the type specified by the corresponding │ │\n",
- " │ │ XML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. │ │\n",
- " │ │ requests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, │ │\n",
- " │ │ enter `null`. │ │\n",
- " │ │ │ │\n",
- " │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │\n",
- " │ │ - `` => `{'foo': 'example one'}` │ │\n",
- " │ │ - `` => `{\"bar\": ['STRING ONE', 'STRING TWO', │ │\n",
- " │ │ etc.]}` │ │\n",
- " │ │ - `` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
- " │ │ │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
- " │ │ No message history. │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- " │ │ The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole │ │\n",
- " │ │ Power of Impeachment. │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
- " │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
- " │ │ None │ │\n",
- " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ \u001b[48;2;240;248;255m╭─\u001b[0m\u001b[48;2;240;248;255m───────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m Prompt \u001b[0m\u001b[48;2;240;248;255m────────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mI was given the following response, which was not parseable as JSON.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\" {\\n \\\"summary\\\": \\\"Summarize the given document faithfully.\\\",\\n \\\"string\\\": \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"Section. 1.All legislative Powers herein granted shall be vested in a Congress of the United States, \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mwhich shall consist of a Senate and House of Representatives.\\\",\\n \\\"format\\\": \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted shall be \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mvested in a Congress of the United States, which shall consist of a Senate and House of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mRepresentatives.',\\n \\\"name\\\": \\\"summary\\\",\\n \\\"threshold\\\": 0.6,\\n \\\"model\\\": \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"all-MiniLM-L6-v2\\\"\\n }\\n\\nJSON Output:\\n\\n {\\n \\\"summary\\\": \\\"Summarize the given \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mdocument faithfully.\\\",\\n \\\"string\\\": \\\"Section. 1.All legislative Powers herein granted shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mbe vested in a Congress of the United States, which shall consist of a Senate and House of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mRepresentatives.\\\",\\n \\\"format\\\": \\\"guardrails/similar_to_document: document='Section. 1.All \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mlegislative Powers herein granted shall be vested in a Congress of the United States, which shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mconsist of a Senate and House of Representatives.',\\n \\\"name\\\": \\\"summary\\\",\\n \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"threshold\\\": 0.6,\\n \\\"model\\\": \\\"all-MiniLM-L6-v2\\\"\\n }\\n\\nJSON Output:\\n\\n {\\n \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"summary\\\": \\\"Summarize the given document faithfully.\\\",\\n \\\"string\\\": \\\"Section. 1.All \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mlegislative Powers herein granted shall be vested in a Congress of the United States, which shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mconsist of a Senate and House of Representatives.\\\",\\n \\\"format\\\": \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein granted shall be \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mvested in a Congress of the United States, which shall consist of a Senate and House of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mRepresentatives.',\\n \\\"name\\\": \\\"summary\\\",\\n \\\"threshold\\\": 0.6,\\n \\\"model\\\": \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"all-MiniLM-L6-v2\\\"\\n }\\n\\nJSON Output:\\n\\n {\\n \\\"summary\\\": \\\"Summarize the given \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mdocument faithfully.\\\",\\n \\\"string\\\": \\\"Section. 1.All legislative Powers herein granted shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mbe vested in a Congress of the United States, which shall consist of a Senate and House of \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mRepresentatives.\\\",\\n \\\"format\\\": \\\"guardrails/similar_to_document: document='Section. 1.All \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mlegislative Powers herein granted shall be vested in a Congress of the United States, which shall \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mconsist of a Senate and House of Representatives.',\\n \\\"name\\\": \\\"summary\\\",\\n \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\\\"threshold\\\": 0.6,\\n \\\"model\\\": \\\"all-M\"\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mHelp me correct this by making it valid JSON.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mGiven below is XML that describes the information to extract from this document and the tags to extract\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mit into.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m`name` attribute of the corresponding XML, and the value is of the type specified by the corresponding \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mXML's tag. The JSON MUST conform to the XML format, including any types and format requests e.g. \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mrequests for lists, objects and specific types. Be correct and concise. If you are unsure anywhere, \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255menter `null`.\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mJson Output:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
+ " │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-MiniLM-L6-v2\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m }\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mJSON Output:\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-MiniLM-L6-v2\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m }\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mJSON Output:\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-MiniLM-L6-v2\"\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m }\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mJSON Output:\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m {\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"summary\": \"Summarize the given document faithfully.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"string\": \"Section. 1.All legislative Powers herein granted shall be vested in a Congress of \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mthe United States, which shall consist of a Senate and House of Representatives.\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"format\": \"guardrails/similar_to_document: document='Section. 1.All legislative Powers herein \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mgranted shall be vested in a Congress of the United States, which shall consist of a Senate and House \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mof Representatives.',\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"name\": \"summary\",\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"threshold\": 0.6,\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \"model\": \"all-M\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mNone\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n"
]
},
@@ -956,7 +1417,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.3"
+ "version": "3.11.9"
},
"orig_nbformat": 4
},
diff --git a/docs/examples/translation_to_specific_language.ipynb b/docs/examples/translation_to_specific_language.ipynb
index 2c03601f8..c8dacdc39 100644
--- a/docs/examples/translation_to_specific_language.ipynb
+++ b/docs/examples/translation_to_specific_language.ipynb
@@ -23,7 +23,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 5,
"metadata": {
"tags": []
},
@@ -32,15 +32,25 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Requirement already satisfied: alt-profanity-check in /home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages (1.3.2)\n",
- "Requirement already satisfied: joblib>=1.3.2 in /home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages (from alt-profanity-check) (1.3.2)\n",
- "Requirement already satisfied: scikit-learn==1.3.2 in /home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages (from alt-profanity-check) (1.3.2)\n",
- "Requirement already satisfied: scipy>=1.5.0 in /home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages (from scikit-learn==1.3.2->alt-profanity-check) (1.9.3)\n",
- "Requirement already satisfied: numpy<2.0,>=1.17.3 in /home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages (from scikit-learn==1.3.2->alt-profanity-check) (1.24.4)\n",
- "Requirement already satisfied: threadpoolctl>=2.0.0 in /home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages (from scikit-learn==1.3.2->alt-profanity-check) (3.2.0)\n",
- "\n",
- "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.1\u001b[0m\n",
- "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
+ "Collecting alt-profanity-check\n",
+ " Downloading alt_profanity_check-1.5.0.tar.gz (758 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m759.0/759.0 kB\u001b[0m \u001b[31m7.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25h Installing build dependencies ... \u001b[?25ldone\n",
+ "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n",
+ "\u001b[?25h Installing backend dependencies ... \u001b[?25ldone\n",
+ "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n",
+ "\u001b[?25hRequirement already satisfied: scikit-learn==1.5.0 in ./.venv/lib/python3.10/site-packages (from alt-profanity-check) (1.5.0)\n",
+ "Requirement already satisfied: joblib>=1.4.0 in ./.venv/lib/python3.10/site-packages (from alt-profanity-check) (1.4.2)\n",
+ "Requirement already satisfied: numpy>=1.19.5 in ./.venv/lib/python3.10/site-packages (from scikit-learn==1.5.0->alt-profanity-check) (1.26.4)\n",
+ "Requirement already satisfied: scipy>=1.6.0 in ./.venv/lib/python3.10/site-packages (from scikit-learn==1.5.0->alt-profanity-check) (1.13.1)\n",
+ "Requirement already satisfied: threadpoolctl>=3.1.0 in ./.venv/lib/python3.10/site-packages (from scikit-learn==1.5.0->alt-profanity-check) (3.5.0)\n",
+ "Building wheels for collected packages: alt-profanity-check\n",
+ " Building wheel for alt-profanity-check (pyproject.toml) ... \u001b[?25ldone\n",
+ "\u001b[?25h Created wheel for alt-profanity-check: filename=alt_profanity_check-1.5.0-py3-none-any.whl size=758311 sha256=e0f54f82189ad2c90aeb27cb9239175c71d38606836be9e4762fb64b2e2de0a0\n",
+ " Stored in directory: /Users/wyatt/Library/Caches/pip/wheels/18/c3/20/637574a9badb43cace85202ca31f49f47e3fe65e076459f3ed\n",
+ "Successfully built alt-profanity-check\n",
+ "Installing collected packages: alt-profanity-check\n",
+ "Successfully installed alt-profanity-check-1.5.0\n"
]
}
],
@@ -70,7 +80,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 6,
"metadata": {
"tags": []
},
@@ -79,14 +89,30 @@
"name": "stderr",
"output_type": "stream",
"text": [
- "/home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages/torch/cuda/__init__.py:611: UserWarning: Can't initialize NVML\n",
- " warnings.warn(\"Can't initialize NVML\")\n"
+ "/Users/wyatt/Projects/guardrails/docs/examples/.venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
+ " from .autonotebook import tqdm as notebook_tqdm\n",
+ "/Users/wyatt/Projects/guardrails/guardrails/validators/__init__.py:51: FutureWarning: \n",
+ " Importing validators from `guardrails.validators` is deprecated.\n",
+ " All validators are now available in the Guardrails Hub. Please install\n",
+ " and import them from the hub instead. All validators will be\n",
+ " removed from this module in the next major release.\n",
+ "\n",
+ " Install with: `guardrails hub install hub:///`\n",
+ " Import as: from guardrails.hub import `ValidatorName`\n",
+ " \n",
+ " warn(\n"
]
}
],
"source": [
"from profanity_check import predict\n",
- "from guardrails.validators import Validator, register_validator, ValidationResult, PassResult, FailResult\n",
+ "from guardrails.validators import (\n",
+ " Validator,\n",
+ " register_validator,\n",
+ " ValidationResult,\n",
+ " PassResult,\n",
+ " FailResult,\n",
+ ")\n",
"\n",
"\n",
"from typing import Dict, Any\n",
@@ -113,7 +139,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 7,
"metadata": {
"tags": []
},
@@ -153,9 +179,23 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 8,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/wyatt/Projects/guardrails/guardrails/validator_base.py:460: FutureWarning: Accessing `IsProfanityFree` using\n",
+ "`from guardrails.validators import IsProfanityFree` is deprecated and\n",
+ "support will be removed after version 0.5.x. Please switch to the Guardrails Hub syntax:\n",
+ "`from guardrails.hub import ProfanityFree` for future updates and support.\n",
+ "For additional details, please visit: https://hub.guardrailsai.com/validator/guardrails/profanity_free.\n",
+ "\n",
+ " warn(\n"
+ ]
+ }
+ ],
"source": [
"from pydantic import BaseModel, Field\n",
"\n",
@@ -167,11 +207,12 @@
"${gr.complete_json_suffix}\n",
"\"\"\"\n",
"\n",
+ "\n",
"class Translation(BaseModel):\n",
" translated_statement: str = Field(\n",
" description=\"Translate the given statement into english language\",\n",
- " validators=[IsProfanityFree(on_fail=\"fix\")]\n",
- " )"
+ " validators=[IsProfanityFree(on_fail=\"fix\")],\n",
+ " )"
]
},
{
@@ -198,7 +239,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@@ -216,11 +257,20 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 10,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/wyatt/Projects/guardrails/guardrails/prompt/base_prompt.py:59: FutureWarning: Prompt Primitives are moving! To keep the same behaviour, switch from `json` constants to `xml` constants. Example: ${gr.complete_json_suffix} -> ${gr.complete_xml_suffix}\n",
+ " warn(\n"
+ ]
+ }
+ ],
"source": [
"guard = gd.Guard.from_rail_string(rail_str)"
]
@@ -234,9 +284,25 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 11,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/wyatt/Projects/guardrails/guardrails/validator_base.py:460: FutureWarning: Accessing `IsProfanityFree` using\n",
+ "`from guardrails.validators import IsProfanityFree` is deprecated and\n",
+ "support will be removed after version 0.5.x. Please switch to the Guardrails Hub syntax:\n",
+ "`from guardrails.hub import ProfanityFree` for future updates and support.\n",
+ "For additional details, please visit: https://hub.guardrailsai.com/validator/guardrails/profanity_free.\n",
+ "\n",
+ " warn(\n",
+ "/Users/wyatt/Projects/guardrails/guardrails/prompt/base_prompt.py:59: FutureWarning: Prompt Primitives are moving! To keep the same behaviour, switch from `json` constants to `xml` constants. Example: ${gr.complete_json_suffix} -> ${gr.complete_xml_suffix}\n",
+ " warn(\n"
+ ]
+ }
+ ],
"source": [
"guard = gd.Guard.from_pydantic(output_class=Translation, prompt=prompt)"
]
@@ -250,11 +316,19 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 12,
"metadata": {
"tags": []
},
"outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/var/folders/8n/8qwytjb11kj_46_w3n2v4jzw0000gn/T/ipykernel_6330/3983563700.py:1: DeprecationWarning: 'Guard.base_prompt' is deprecated and will be removed in versions 0.5.x and beyond. Use 'Guard.history.last.prompt' instead.\n",
+ " print(guard.base_prompt)\n"
+ ]
+ },
{
"data": {
"text/html": [
@@ -350,21 +424,14 @@
"execution_count": 13,
"metadata": {},
"outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "HTTP Request: POST https://api.openai.com/v1/completions \"HTTP/1.1 200 OK\"\n"
- ]
- },
{
"data": {
"text/html": [
- "
\n"
@@ -482,19 +549,19 @@
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mformat=\"1-indexed\" />` => `{'baz': {'foo': 'Some String', 'index': 1}}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mJson Output:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m╭─\u001b[0m\u001b[48;2;255;240;242m────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m Instructions \u001b[0m\u001b[48;2;255;240;242m─────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242mYou are a helpful assistant, able to express yourself purely through JSON, strictly and precisely \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242madhering to the provided XML schemas.\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
- " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m{\"translated_statement\": \"Chicken Quesadilla\"}\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m{\"translated_statement\":\"Chicken quesadilla\"}\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
- " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m{'translated_statement': 'Chicken Quesadilla'}\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
+ " │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m{'translated_statement': 'Chicken quesadilla'}\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
" │ \u001b[48;2;240;255;240m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n"
]
@@ -519,18 +586,11 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 15,
"metadata": {
"tags": []
},
"outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "HTTP Request: POST https://api.openai.com/v1/completions \"HTTP/1.1 200 OK\"\n"
- ]
- },
{
"data": {
"text/html": [
@@ -547,9 +607,9 @@
],
"source": [
"raw_llm_response, validated_response, *rest = guard(\n",
- " openai.completions.create,\n",
+ " openai.chat.completions.create,\n",
" prompt_params={\"statement_to_be_translated\": \"убей себя\"},\n",
- " model=\"text-davinci-003\",\n",
+ " model=\"gpt-3.5-turbo\",\n",
" max_tokens=2048,\n",
" temperature=0,\n",
")\n",
@@ -567,7 +627,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 16,
"metadata": {},
"outputs": [
{
@@ -605,16 +665,16 @@
" │ │ format=\"1-indexed\" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │\n",
" │ │ │ │\n",
" │ │ │ │\n",
- " │ │ │ │\n",
- " │ │ Json Output: │ │\n",
- " │ │ │ │\n",
- " │ │ │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
+ " │ ╭───────────────────────────────────────────── Instructions ──────────────────────────────────────────────╮ │\n",
+ " │ │ You are a helpful assistant, able to express yourself purely through JSON, strictly and precisely │ │\n",
+ " │ │ adhering to the provided XML schemas. │ │\n",
+ " │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" │ ╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮ │\n",
" │ │ No message history. │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
- " │ │ {\"translated_statement\": \"Kill yourself\"} │ │\n",
+ " │ │ {\"translated_statement\":\"Kill yourself\"} │ │\n",
" │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
" │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
" │ │ {'translated_statement': ''} │ │\n",
@@ -655,16 +715,16 @@
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mformat=\"1-indexed\" />` => `{'baz': {'foo': 'Some String', 'index': 1}}`\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mJson Output:\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
- " │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
" │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m╭─\u001b[0m\u001b[48;2;255;240;242m────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m Instructions \u001b[0m\u001b[48;2;255;240;242m─────────────────────────────────────────────\u001b[0m\u001b[48;2;255;240;242m─╮\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242mYou are a helpful assistant, able to express yourself purely through JSON, strictly and precisely \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m│\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242madhering to the provided XML schemas.\u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m \u001b[0m\u001b[48;2;255;240;242m│\u001b[0m │\n",
+ " │ \u001b[48;2;255;240;242m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
" │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
- " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m{\"translated_statement\": \"Kill yourself\"}\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
+ " │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m{\"translated_statement\":\"Kill yourself\"}\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
" │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
" │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
" │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m{'translated_statement': ''}\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
@@ -697,7 +757,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.17"
+ "version": "3.10.3"
}
},
"nbformat": 4,
diff --git a/docs/examples/translation_with_quality_check.ipynb b/docs/examples/translation_with_quality_check.ipynb
index 3429514fb..bc7a69d16 100644
--- a/docs/examples/translation_with_quality_check.ipynb
+++ b/docs/examples/translation_with_quality_check.ipynb
@@ -2,9 +2,42 @@
"cells": [
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 31,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Installing hub:\u001b[35m/\u001b[0m\u001b[35m/brainlogic/\u001b[0m\u001b[95mhigh_quality_translation...\u001b[0m\n",
+ "\u001b[2K\u001b[32m[== ]\u001b[0m Fetching manifestst\n",
+ "\u001b[2K\u001b[32m[= ]\u001b[0m Downloading dependenciespendencies Running command git clone --filter=blob:none --quiet https://github.com/BrainLogicHub/high_quality_translation_validator.git /private/var/folders/c8/jqt82fpx785dpwpp36ljkgm40000gn/T/pip-req-build-cmoa3yt3\n",
+ "\u001b[2K\u001b[32m[ ===]\u001b[0m Downloading dependencies\u001b[33mWARNING: Target directory /Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/guardrails/hub/brainlogic/high_quality_translation/validator already exists. Specify --upgrade to force replacement.\u001b[0m\u001b[33m\n",
+ "\u001b[0m\u001b[33mWARNING: Target directory /Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/guardrails/hub/brainlogic/high_quality_translation/high_quality_translation-0.0.0.dist-info already exists. Specify --upgrade to force replacement.\u001b[0m\u001b[33m\n",
+ "\u001b[2K\u001b[32m[ ==]\u001b[0m Downloading dependencies\n",
+ "\u001b[2K\u001b[32m[ =]\u001b[0m Running post-install setuptall setup/Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/transformers/utils/generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
+ " _torch_pytree._register_pytree_node(\n",
+ "\u001b[2K\u001b[32m[====]\u001b[0m Running post-install setup/Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/transformers/utils/generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
+ " _torch_pytree._register_pytree_node(\n",
+ "\u001b[2K\u001b[32m[=== ]\u001b[0m Running post-install setup/Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/transformers/utils/generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
+ " _torch_pytree._register_pytree_node(\n",
+ "Fetching 5 files: 100%|████████████████████████| 5/5 [00:00<00:00, 92794.34it/s]\n",
+ "\u001b[2K\u001b[32m[====]\u001b[0m Running post-install setupLightning automatically upgraded your loaded checkpoint from v1.8.2 to v2.2.4. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../../../../.cache/huggingface/hub/models--Unbabel--wmt22-cometkiwi-da/snapshots/b3a8aea5a5fc22db68a554b92b3d96eb6ea75cc9/checkpoints/model.ckpt`\n",
+ "\u001b[2K\u001b[32m[ ===]\u001b[0m Running post-install setupEncoder model frozen.\n",
+ "\u001b[2K\u001b[32m[ ]\u001b[0m Running post-install setup/Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/pytorch_lightning/core/saving.py:188: Found keys that are not in the model state dict but in the checkpoint: ['encoder.model.embeddings.position_ids']\n",
+ "\u001b[2K\u001b[32m[ =]\u001b[0m Running post-install setup\n",
+ "\u001b[1A\u001b[2K✅Successfully installed brainlogic/high_quality_translation!\n",
+ "\n",
+ "\n",
+ "\u001b[1mImport validator:\u001b[0m\n",
+ "from guardrails.hub import HighQualityTranslation\n",
+ "\n",
+ "\u001b[1mGet more info:\u001b[0m\n",
+ "\u001b[4;94mhttps://hub.guardrailsai.com/validator/brainlogic/high_quality_translation\u001b[0m\n",
+ "\n"
+ ]
+ }
+ ],
"source": [
"!guardrails hub install hub://brainlogic/high_quality_translation"
]
@@ -37,13 +70,13 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"import openai\n",
"from pydantic import BaseModel, Field\n",
- "import guardrails as gd\n",
+ "from guardrails import Guard\n",
"from rich import print\n",
"from guardrails.hub import HighQualityTranslation"
]
@@ -52,25 +85,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Step 1: Create the RAIL Spec / Pydantic model\n",
+ "## Step 1: Define a Guard that uses the validator\n",
"\n",
- "Ordinarily, we would create an RAIL spec in a separate file. For the purposes of this example, we will create the spec in this notebook as a string following the RAIL syntax. For more information on RAIL, see the [RAIL documentation](/docs/how_to_guides/rail). We will also show the same RAIL spec in a code-first format using a Pydantic model.\n",
+ "This guard will use the HighQualityTranslation validator to validate some string outputs.\n",
"\n",
- "In this RAIL spec, we:\n",
"\n",
- "1. Create an `output` schema that returns a single key-value pair. The key should be 'translated_statement', and the value should be the English translation of the given statement. The translated statement should not have any profanity.\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Our RAIL spec as an XML string:\n"
+ "We define the prompt and the guard."
]
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 33,
"metadata": {
"tags": []
},
@@ -79,223 +104,49 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\n",
- "Downloading the model. This may take a while the 1st time...\n"
+ "Loading the model Unbabel/wmt22-cometkiwi-da...\n"
]
},
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading the model from checkpoint...\n"
- ]
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "87fd6ea1db6d49a0af904871984c3aa6",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Fetching 5 files: 0%| | 0/5 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
- "Lightning automatically upgraded your loaded checkpoint from v1.8.2 to v2.1.2. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../../../../.cache/huggingface/hub/models--Unbabel--wmt22-cometkiwi-da/snapshots/b3a8aea5a5fc22db68a554b92b3d96eb6ea75cc9/checkpoints/model.ckpt`\n",
+ "Lightning automatically upgraded your loaded checkpoint from v1.8.2 to v2.2.4. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../../../../.cache/huggingface/hub/models--Unbabel--wmt22-cometkiwi-da/snapshots/b3a8aea5a5fc22db68a554b92b3d96eb6ea75cc9/checkpoints/model.ckpt`\n",
"Encoder model frozen.\n",
- "/Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.11/site-packages/pytorch_lightning/core/saving.py:177: Found keys that are not in the model state dict but in the checkpoint: ['encoder.model.embeddings.position_ids']\n",
+ "/Users/zaydsimjee/workspace/guardrails/.venv/lib/python3.10/site-packages/pytorch_lightning/core/saving.py:188: Found keys that are not in the model state dict but in the checkpoint: ['encoder.model.embeddings.position_ids']\n",
"\n"
]
}
],
"source": [
- "# rail_str = \"\"\"\n",
- "# \n",
- "\n",
- "# \n",
- "\n",
- "\n",
- "# \n",
- "# Translate the given statement into the English language:\n",
- "\n",
- "# ${statement_to_be_translated}\n",
- "\n",
- "# ${gr.complete_json_suffix}\n",
- "# \n",
- "# \n",
- "# \"\"\"\n",
- "\n",
- "# Or a Pydantic model\n",
"prompt = \"\"\"\n",
"Translate the given statement into English:\n",
"\n",
"${statement_to_be_translated}\n",
- "\n",
- "${gr.complete_json_suffix_v2}\n",
"\"\"\"\n",
"\n",
- "\n",
- "class HighQualityTranslation(BaseModel):\n",
- " translated_statement: str = Field(\n",
- " description=\"Validate the translation quality of the given statement\",\n",
- " validators=[HighQualityTranslation(on_fail=\"fix\")],\n",
- " )"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Step 2: Create a `Guard` object with the RAIL Spec\n",
- "\n",
- "We create a `gd.Guard` object that will check, validate and correct the output of the LLM. This object:\n",
- "\n",
- "1. Enforces the quality criteria specified in the RAIL spec.\n",
- "2. Takes corrective action when the quality criteria are not met.\n",
- "3. Compiles the schema and type info from the RAIL spec and adds it to the prompt.\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "From our RAIL string:\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 12,
- "metadata": {
- "tags": []
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Downloading the model. This may take a while the 1st time...\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading the model from checkpoint...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Lightning automatically upgraded your loaded checkpoint from v1.8.2 to v2.1.2. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../../../../.cache/huggingface/hub/models--Unbabel--wmt22-cometkiwi-da/snapshots/b3a8aea5a5fc22db68a554b92b3d96eb6ea75cc9/checkpoints/model.ckpt`\n",
- "Encoder model frozen.\n"
- ]
- }
- ],
- "source": [
- "# guard = gd.Guard.from_rail_string(rail_str)\n",
- "\n",
- "# Or a Pydantic model\n",
- "guard = gd.Guard.from_pydantic(output_class=HighQualityTranslation, prompt=prompt)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "We see the prompt that will be sent to the LLM:\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 13,
- "metadata": {
- "tags": []
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "Translate the given statement into English:\n",
- "\n",
- "${statement_to_be_translated}\n",
- "\n",
- "\n",
- "Given below is XML that describes the information to extract from this document and the tags to extract it into.\n",
- "\n",
- "<output>\n",
- " <string name=\"translated_statement\"description=\"Validate the translation quality of the given statement\"\n",
- "format=\"is-high-quality-translation\"/>\n",
- "</output>\n",
- "\n",
- "\n",
- "ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the `name` \n",
- "attribute of the corresponding XML, and the value is of the type specified by the corresponding XML's tag. The JSON\n",
- "MUST conform to the XML format, including any types and format requests e.g. requests for lists, objects and \n",
- "specific types. Be correct and concise.\n",
- "\n",
- "Here are examples of simple (XML, JSON) pairs that show the expected behavior:\n",
- "- `<string name='foo'format='two-words lower-case'/>` => `{'foo': 'example one'}`\n",
- "- `<list name='bar'><string format='upper-case'/></list>` => `{\"bar\": ['STRING ONE', 'STRING TWO', etc.]}`\n",
- "- `<object name='baz'><string name=\"foo\"format=\"capitalize two-words\"/><integer name=\"index\"format=\"1-indexed\"\n",
- "/></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}`\n",
- "\n",
- "\n",
- "
\n"
- ],
- "text/plain": [
- "\n",
- "Translate the given statement into English:\n",
- "\n",
- "$\u001b[1m{\u001b[0mstatement_to_be_translated\u001b[1m}\u001b[0m\n",
- "\n",
- "\n",
- "Given below is XML that describes the information to extract from this document and the tags to extract it into.\n",
- "\n",
- "\u001b[1m<\u001b[0m\u001b[1;95moutput\u001b[0m\u001b[39m>\u001b[0m\n",
- "\u001b[39m \u001b[0m\n",
- "\u001b[39m<\u001b[0m\u001b[35m/\u001b[0m\u001b[95moutput\u001b[0m\u001b[39m>\u001b[0m\n",
- "\n",
- "\n",
- "\u001b[39mONLY return a valid JSON object \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mno other text is necessary\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m, where the key of the field in JSON is the `name` \u001b[0m\n",
- "\u001b[39mattribute of the corresponding XML, and the value is of the type specified by the corresponding XML's tag. The JSON\u001b[0m\n",
- "\u001b[39mMUST conform to the XML format, including any types and format requests e.g. requests for lists, objects and \u001b[0m\n",
- "\u001b[39mspecific types. Be correct and concise.\u001b[0m\n",
- "\n",
- "\u001b[39mHere are examples of simple \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mXML, JSON\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m pairs that show the expected behavior:\u001b[0m\n",
- "\u001b[39m- `` => `\u001b[0m\u001b[1;39m{\u001b[0m\u001b[32m'foo'\u001b[0m\u001b[39m: \u001b[0m\u001b[32m'example one'\u001b[0m\u001b[1;39m}\u001b[0m\u001b[39m`\u001b[0m\n",
- "\u001b[39m- `<\u001b[0m\u001b[35m/\u001b[0m\u001b[95mlist\u001b[0m\u001b[39m>` => `\u001b[0m\u001b[1;39m{\u001b[0m\u001b[32m\"bar\"\u001b[0m\u001b[39m: \u001b[0m\u001b[1;39m[\u001b[0m\u001b[32m'STRING ONE'\u001b[0m\u001b[39m, \u001b[0m\u001b[32m'STRING TWO'\u001b[0m\u001b[39m, etc.\u001b[0m\u001b[1;39m]\u001b[0m\u001b[1;39m}\u001b[0m\u001b[39m`\u001b[0m\n",
- "\u001b[39m- `