{ "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": [ "
ValidationOutcome(\n",
       "    call_id='14233082752',\n",
       "    raw_llm_output='In the dynamic realm of finance, several prominent entities have emerged as key players,leaving\n",
       "an indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing with its \n",
       "user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial expertise, offering \n",
       "a wide array of services to clients worldwide. HSBC, with its extensive global network, has become a powerhouse in \n",
       "the banking sector, catering to the needs of millions across different countries. JP Morgan, a venerable \n",
       "institution with a rich history, has established itself as a comprehensive financial powerhouse, providing a \n",
       "diverse range of services from investment banking to asset management. Santander, a Spanish multinational bank, has\n",
       "earned a 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 Santander have \n",
       "redefined the financial landscape, shaping the way we save, invest, and manage our money on a global scale.',\n",
       "    validated_output='In the dynamic realm of finance, several prominent entities have emerged as key \n",
       "players,leaving an indelible mark on the industry.[COMPETITOR], a fintech innovator, has revolutionized saving and \n",
       "investing with its user-friendly app.[COMPETITOR], a multinational investment bank, stands as a pillar of financial\n",
       "expertise, offering a wide array of services to clients worldwide.HSBC, with its extensive global network, has \n",
       "become a powerhouse in the banking sector, catering to the needs of millions across different \n",
       "countries.[COMPETITOR], a venerable institution with a rich history, has established itself as a comprehensive \n",
       "financial powerhouse, providing a diverse range of services from investment banking to asset management.Santander, \n",
       "a Spanish multinational bank, has earned a reputation for its responsible banking practices and customer-centric \n",
       "approach, serving as a trusted financial partner to individuals and businesses alike.Together, [COMPETITOR], \n",
       "[COMPETITOR], HSBC, [COMPETITOR], and Santander have redefined the financial landscape, shaping the way we save, \n",
       "invest, and manage our money on a global scale.',\n",
       "    reask=None,\n",
       "    validation_passed=True,\n",
       "    error=None\n",
       ")\n",
       "
\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": [ "
Logs\n",
       "└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
       "    │ ╭─────────────────────────────────────────────── Messages ────────────────────────────────────────────────╮ │\n",
       "    │ │ No messages.                                                                                            │ │\n",
       "    │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
       "    │ ╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮ │\n",
       "    │ │ In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an      │ │\n",
       "    │ │ indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing    │ │\n",
       "    │ │ with its user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial │ │\n",
       "    │ │ expertise, offering a wide array of services to clients worldwide. HSBC, with its extensive global      │ │\n",
       "    │ │ network, has become a powerhouse in the banking sector, catering to the needs of millions across        │ │\n",
       "    │ │ different countries. JP Morgan, a venerable institution with a rich history, has established itself as  │ │\n",
       "    │ │ a comprehensive financial powerhouse, providing a diverse range of services from investment banking to  │ │\n",
       "    │ │ asset management. Santander, a Spanish multinational bank, has earned a reputation for its responsible  │ │\n",
       "    │ │ banking practices and customer-centric approach, serving as a trusted financial partner to individuals  │ │\n",
       "    │ │ and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have redefined the         │ │\n",
       "    │ │ financial landscape, shaping the way we save, invest, and manage our money on a global scale.           │ │\n",
       "    │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
       "    │ ╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮ │\n",
       "    │ │ 'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an     │ │\n",
       "    │ │ indelible mark on the industry.[COMPETITOR], a fintech innovator, has revolutionized saving and         │ │\n",
       "    │ │ investing with its user-friendly app.[COMPETITOR], a multinational investment bank, stands as a pillar  │ │\n",
       "    │ │ of financial expertise, offering a wide array of services to clients worldwide.HSBC, with its extensive │ │\n",
       "    │ │ global network, has become a powerhouse in the banking sector, catering to the needs of millions across │ │\n",
       "    │ │ different countries.[COMPETITOR], a venerable institution with a rich history, has established itself   │ │\n",
       "    │ │ as a comprehensive financial powerhouse, providing a diverse range of services from investment banking  │ │\n",
       "    │ │ to asset management.Santander, a Spanish multinational bank, has earned a reputation for its            │ │\n",
       "    │ │ responsible banking practices and customer-centric approach, serving as a trusted financial partner to  │ │\n",
       "    │ │ individuals and businesses alike.Together, [COMPETITOR], [COMPETITOR], HSBC, [COMPETITOR], and          │ │\n",
       "    │ │ Santander have redefined the financial landscape, shaping the way we save, invest, and manage our money │ │\n",
       "    │ │ on a global scale.'                                                                                     │ │\n",
       "    │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │\n",
       "    ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "
\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 }