340 lines
33 KiB
Plaintext
340 lines
33 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Check if a competitor is named\n",
|
|
"\n",
|
|
"!!! note\n",
|
|
"To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/competitors_check.ipynb).\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We first need to install the ```CompetitorCheck``` validator from Guardrails Hub: \n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Installing hub:\u001b[35m/\u001b[0m\u001b[35m/guardrails/\u001b[0m\u001b[95mcompetitor_check...\u001b[0m\n",
|
|
"✅Successfully installed guardrails/competitor_check!\n",
|
|
"\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"! pip install nltk --quiet\n",
|
|
"! guardrails hub install hub://guardrails/competitor_check --quiet"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from guardrails.hub import CompetitorCheck\n",
|
|
"import guardrails as gd\n",
|
|
"from rich import print"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Using competitor check validator\n",
|
|
"\n",
|
|
"This validator checks LLM output to flag sentences naming one of your competitors and removes those sentences from the final output. When setting on-fail to 'fix' this validator will remove the flagged sentences from the output. You need to provide an extensive list of your competitors' names including all common variations (e.g. JP Morgan, JP Morgan Chase, etc.) the compilation of this list will have an impact on the ultimate outcome of the validation.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Set up a competitors list\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Generate competitors list\n",
|
|
"competitors_list = [\n",
|
|
" \"Acorns\",\n",
|
|
" \"Citigroup\",\n",
|
|
" \"Citi\",\n",
|
|
" \"Fidelity Investments\",\n",
|
|
" \"Fidelity\",\n",
|
|
" \"JP Morgan Chase and company\",\n",
|
|
" \"JP Morgan\",\n",
|
|
" \"JP Morgan Chase\",\n",
|
|
" \"JPMorgan Chase\",\n",
|
|
" \"ChaseM1 Finance\",\n",
|
|
" \"Stash Financial Incorporated\",\n",
|
|
" \"Stash\",\n",
|
|
" \"Tastytrade Incorporated\",\n",
|
|
" \"Tastytrade\",\n",
|
|
" \"ZacksTrade\",\n",
|
|
" \"Zacks Trade\",\n",
|
|
"]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Set up example text to test the validator\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Define some text to test the validator\n",
|
|
"text = \"\"\"\\\n",
|
|
"In the dynamic realm of finance, several prominent entities have emerged as key players,\\\n",
|
|
"leaving an indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving \\\n",
|
|
"and investing with its user-friendly app. Citigroup, a multinational investment bank, stands as a \\\n",
|
|
"pillar of financial expertise, offering a wide array of services to clients worldwide. HSBC, with \\\n",
|
|
"its extensive global network, has become a powerhouse in the banking sector, catering to the needs \\\n",
|
|
"of millions across different countries. JP Morgan, a venerable institution with a rich history, has \\\n",
|
|
"established itself as a comprehensive financial powerhouse, providing a diverse range of services \\\n",
|
|
"from investment banking to asset management. Santander, a Spanish multinational bank, has earned a \\\n",
|
|
"reputation for its responsible banking practices and customer-centric approach, serving as a trusted \\\n",
|
|
"financial partner to individuals and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and \\\n",
|
|
"Santander have redefined the financial landscape, shaping the way we save, invest, and manage our \\\n",
|
|
"money on a global scale.\\\n",
|
|
"\"\"\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Test the validator\n",
|
|
"\n",
|
|
"Here, we use the text we defined above as an example llm output (`llm_output`).\n",
|
|
"\n",
|
|
"We also set the on_fail behavior to 'fix' so that the validator will remove the sentences that mention competitors from the output.\n",
|
|
"We can adjust this behavior by changing it to 'reask' or 'throw'.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"/Users/dtam/dev/guardrails/guardrails/validator_service/__init__.py:85: UserWarning: Could not obtain an event loop. Falling back to synchronous validation.\n",
|
|
" warnings.warn(\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ValidationOutcome</span><span style=\"font-weight: bold\">(</span>\n",
|
|
" <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'14233082752'</span>,\n",
|
|
" <span style=\"color: #808000; text-decoration-color: #808000\">raw_llm_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving</span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">an indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing with its </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial expertise, offering </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">a wide array of services to clients worldwide. HSBC, with its extensive global network, has become a powerhouse in </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">the banking sector, catering to the needs of millions across different countries. JP Morgan, a venerable </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">institution with a rich history, has established itself as a comprehensive financial powerhouse, providing a </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">diverse range of services from investment banking to asset management. Santander, a Spanish multinational bank, has</span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">earned a reputation for its responsible banking practices and customer-centric approach, serving as a trusted </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">financial partner to individuals and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">redefined the financial landscape, shaping the way we save, invest, and manage our money on a global scale.'</span>,\n",
|
|
" <span style=\"color: #808000; text-decoration-color: #808000\">validated_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'In the dynamic realm of finance, several prominent entities have emerged as key </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">players,leaving an indelible mark on the industry.[COMPETITOR], a fintech innovator, has revolutionized saving and </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">investing with its user-friendly app.[COMPETITOR], a multinational investment bank, stands as a pillar of financial</span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">expertise, offering a wide array of services to clients worldwide.HSBC, with its extensive global network, has </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">become a powerhouse in the banking sector, catering to the needs of millions across different </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">countries.[COMPETITOR], a venerable institution with a rich history, has established itself as a comprehensive </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">financial powerhouse, providing a diverse range of services from investment banking to asset management.Santander, </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">a Spanish multinational bank, has earned a reputation for its responsible banking practices and customer-centric </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">approach, serving as a trusted financial partner to individuals and businesses alike.Together, [COMPETITOR], </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">[COMPETITOR], HSBC, [COMPETITOR], and Santander have redefined the financial landscape, shaping the way we save, </span>\n",
|
|
"<span style=\"color: #008000; text-decoration-color: #008000\">invest, and manage our money on a global scale.'</span>,\n",
|
|
" <span style=\"color: #808000; text-decoration-color: #808000\">reask</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n",
|
|
" <span style=\"color: #808000; text-decoration-color: #808000\">validation_passed</span>=<span style=\"color: #00ff00; text-decoration-color: #00ff00; font-style: italic\">True</span>,\n",
|
|
" <span style=\"color: #808000; text-decoration-color: #808000\">error</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>\n",
|
|
"<span style=\"font-weight: bold\">)</span>\n",
|
|
"</pre>\n"
|
|
],
|
|
"text/plain": [
|
|
"\u001b[1;35mValidationOutcome\u001b[0m\u001b[1m(\u001b[0m\n",
|
|
" \u001b[33mcall_id\u001b[0m=\u001b[32m'14233082752'\u001b[0m,\n",
|
|
" \u001b[33mraw_llm_output\u001b[0m=\u001b[32m'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving\u001b[0m\n",
|
|
"\u001b[32man indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing with its \u001b[0m\n",
|
|
"\u001b[32muser-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial expertise, offering \u001b[0m\n",
|
|
"\u001b[32ma wide array of services to clients worldwide. HSBC, with its extensive global network, has become a powerhouse in \u001b[0m\n",
|
|
"\u001b[32mthe banking sector, catering to the needs of millions across different countries. JP Morgan, a venerable \u001b[0m\n",
|
|
"\u001b[32minstitution with a rich history, has established itself as a comprehensive financial powerhouse, providing a \u001b[0m\n",
|
|
"\u001b[32mdiverse range of services from investment banking to asset management. Santander, a Spanish multinational bank, has\u001b[0m\n",
|
|
"\u001b[32mearned a reputation for its responsible banking practices and customer-centric approach, serving as a trusted \u001b[0m\n",
|
|
"\u001b[32mfinancial partner to individuals and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have \u001b[0m\n",
|
|
"\u001b[32mredefined the financial landscape, shaping the way we save, invest, and manage our money on a global scale.'\u001b[0m,\n",
|
|
" \u001b[33mvalidated_output\u001b[0m=\u001b[32m'In the dynamic realm of finance, several prominent entities have emerged as key \u001b[0m\n",
|
|
"\u001b[32mplayers,leaving an indelible mark on the industry.\u001b[0m\u001b[32m[\u001b[0m\u001b[32mCOMPETITOR\u001b[0m\u001b[32m]\u001b[0m\u001b[32m, a fintech innovator, has revolutionized saving and \u001b[0m\n",
|
|
"\u001b[32minvesting with its user-friendly app.\u001b[0m\u001b[32m[\u001b[0m\u001b[32mCOMPETITOR\u001b[0m\u001b[32m]\u001b[0m\u001b[32m, a multinational investment bank, stands as a pillar of financial\u001b[0m\n",
|
|
"\u001b[32mexpertise, offering a wide array of services to clients worldwide.HSBC, with its extensive global network, has \u001b[0m\n",
|
|
"\u001b[32mbecome a powerhouse in the banking sector, catering to the needs of millions across different \u001b[0m\n",
|
|
"\u001b[32mcountries.\u001b[0m\u001b[32m[\u001b[0m\u001b[32mCOMPETITOR\u001b[0m\u001b[32m]\u001b[0m\u001b[32m, a venerable institution with a rich history, has established itself as a comprehensive \u001b[0m\n",
|
|
"\u001b[32mfinancial powerhouse, providing a diverse range of services from investment banking to asset management.Santander, \u001b[0m\n",
|
|
"\u001b[32ma Spanish multinational bank, has earned a reputation for its responsible banking practices and customer-centric \u001b[0m\n",
|
|
"\u001b[32mapproach, serving as a trusted financial partner to individuals and businesses alike.Together, \u001b[0m\u001b[32m[\u001b[0m\u001b[32mCOMPETITOR\u001b[0m\u001b[32m]\u001b[0m\u001b[32m, \u001b[0m\n",
|
|
"\u001b[32m[\u001b[0m\u001b[32mCOMPETITOR\u001b[0m\u001b[32m]\u001b[0m\u001b[32m, HSBC, \u001b[0m\u001b[32m[\u001b[0m\u001b[32mCOMPETITOR\u001b[0m\u001b[32m]\u001b[0m\u001b[32m, and Santander have redefined the financial landscape, shaping the way we save, \u001b[0m\n",
|
|
"\u001b[32minvest, and manage our money on a global scale.'\u001b[0m,\n",
|
|
" \u001b[33mreask\u001b[0m=\u001b[3;35mNone\u001b[0m,\n",
|
|
" \u001b[33mvalidation_passed\u001b[0m=\u001b[3;92mTrue\u001b[0m,\n",
|
|
" \u001b[33merror\u001b[0m=\u001b[3;35mNone\u001b[0m\n",
|
|
"\u001b[1m)\u001b[0m\n"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Create the Guard with the CompetitorCheck Validator\n",
|
|
"guard = gd.Guard().use(CompetitorCheck(competitors=competitors_list, on_fail=\"fix\"))\n",
|
|
"\n",
|
|
"# Test with a given text\n",
|
|
"output = guard.parse(\n",
|
|
" llm_output=text,\n",
|
|
" metadata={},\n",
|
|
")\n",
|
|
"\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Logs\n",
|
|
"└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
|
|
" │ <span style=\"background-color: #e7dfeb\">╭─────────────────────────────────────────────── Messages ────────────────────────────────────────────────╮</span> │\n",
|
|
" │ <span style=\"background-color: #e7dfeb\">│ No messages. │</span> │\n",
|
|
" │ <span style=\"background-color: #e7dfeb\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ with its user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ expertise, offering a wide array of services to clients worldwide. HSBC, with its extensive global │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ network, has become a powerhouse in the banking sector, catering to the needs of millions across │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ different countries. JP Morgan, a venerable institution with a rich history, has established itself as │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ a comprehensive financial powerhouse, providing a diverse range of services from investment banking to │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ asset management. Santander, a Spanish multinational bank, has earned a reputation for its responsible │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ banking practices and customer-centric approach, serving as a trusted financial partner to individuals │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have redefined the │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">│ financial landscape, shaping the way we save, invest, and manage our money on a global scale. │</span> │\n",
|
|
" │ <span style=\"background-color: #f5f5dc\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ 'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ indelible mark on the industry.[COMPETITOR], a fintech innovator, has revolutionized saving and │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ investing with its user-friendly app.[COMPETITOR], a multinational investment bank, stands as a pillar │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ of financial expertise, offering a wide array of services to clients worldwide.HSBC, with its extensive │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ global network, has become a powerhouse in the banking sector, catering to the needs of millions across │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ different countries.[COMPETITOR], a venerable institution with a rich history, has established itself │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ as a comprehensive financial powerhouse, providing a diverse range of services from investment banking │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ to asset management.Santander, a Spanish multinational bank, has earned a reputation for its │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ responsible banking practices and customer-centric approach, serving as a trusted financial partner to │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ individuals and businesses alike.Together, [COMPETITOR], [COMPETITOR], HSBC, [COMPETITOR], and │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ Santander have redefined the financial landscape, shaping the way we save, invest, and manage our money │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">│ on a global scale.' │</span> │\n",
|
|
" │ <span style=\"background-color: #f0fff0\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
|
|
" ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
|
|
"</pre>\n"
|
|
],
|
|
"text/plain": [
|
|
"Logs\n",
|
|
"└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
|
|
" │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m──────────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Messages \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 messages.\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;220mIn the dynamic realm of finance, several prominent entities have emerged as key players,leaving an \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;220mindelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing \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;220mwith its user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial\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;220mexpertise, offering a wide array of services to clients worldwide. HSBC, with its extensive global \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;220mnetwork, has become a powerhouse in the banking sector, catering to the needs of millions across \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;220mdifferent countries. JP Morgan, a venerable institution with a rich history, has established itself as \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;220ma comprehensive financial powerhouse, providing a diverse range of services from investment banking to \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;220masset management. Santander, a Spanish multinational bank, has earned a reputation for its responsible \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;220mbanking practices and customer-centric approach, serving as a trusted financial partner to individuals \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;220mand businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have redefined 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;220mfinancial landscape, shaping the way we save, invest, and manage our money on a global scale.\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'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an \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;240mindelible mark on the industry.[COMPETITOR], a fintech innovator, has revolutionized saving 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;240minvesting with its user-friendly app.[COMPETITOR], a multinational investment bank, stands as a pillar \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 financial expertise, offering a wide array of services to clients worldwide.HSBC, with its extensive\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;240mglobal network, has become a powerhouse in the banking sector, catering to the needs of millions across\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;240mdifferent countries.[COMPETITOR], a venerable institution with a rich history, has established itself \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;240mas a comprehensive financial powerhouse, providing a diverse range of services from investment banking \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;240mto asset management.Santander, a Spanish multinational bank, has earned a reputation for its \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;240mresponsible banking practices and customer-centric approach, serving as a trusted financial partner to \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;240mindividuals and businesses alike.Together, [COMPETITOR], [COMPETITOR], HSBC, [COMPETITOR], 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;240mSantander have redefined the financial landscape, shaping the way we save, invest, and manage our money\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;240mon a global scale.'\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"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"# See guard history\n",
|
|
"print(guard.history.last.tree)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "litellm",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|