Add topic blocker guardrail with keyword and embedding implementations (#21713)

* Add keyword-based topic blocker implementation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add embedding-based topic blocker using MiniLM

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add topic blocker package init with exports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add synthetic engine eval set (34 cases)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add investment questions eval set (207 cases)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add engine eval synthetic policy config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add engine keyword blocker eval results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add investment keyword blocker eval results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add investment embedding blocker eval results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add investment embedding MiniLM eval results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add investment embedding MPNet eval results (historical)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add investment TF-IDF eval results (historical)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add unified eval runner with confusion matrix reporting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add benchmarks comparison table in markdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Clean up topic blocker: remove unused blockers, add phrase_patterns to content filter

- Remove embedding_blocker.py, api_embedding_blocker.py, nli_blocker.py,
  tfidf_blocker.py, onnx_blocker.py (heavy deps not in Docker, inferior accuracy)
- Remove airline_off_topic_restriction policy template and its test
- Fix __init__.py to only export DeniedTopic and TopicBlocker (no eager import crash)
- Add phrase_patterns support to ContentFilterGuardrail for regex-based paraphrase detection
- Rewrite denied_financial_advice.yaml with conditional matching (identifier + block word),
  always-block keywords, phrase patterns, and exception phrases
- Clean up test_eval.py: only keyword blocker + content filter tests remain (no network calls)
- All 207 eval cases pass at 100% F1, 0 FP, 0 FN, <0.1ms latency

Addresses all Greptile review comments:
- Eager import crash (embedding deps) → fixed
- Undeclared dependencies → fixed (files deleted)
- lru_cache memory leak → fixed (file deleted)
- Real network calls in tests → fixed (embedding tests removed)
- Unused Dict import → already fixed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add LLM-as-judge eval and update BENCHMARKS.md

- Add TestInvestmentLlmJudgeGpt4oMini and TestInvestmentLlmJudgeClaude
  test classes that use litellm.completion() to classify messages
- System prompt instructs LLM to act as airline chatbot content moderator
- Tests skip gracefully when API keys aren't set
- Update BENCHMARKS.md with production results table, historical comparison,
  and instructions for running LLM judge evals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Move evals and benchmarks to guardrail_benchmarks folder

Move eval runner, eval data (JSONL), and results from
tests/test_litellm/.../topic_blocker/ into the guardrail implementation
folder at litellm/.../litellm_content_filter/guardrail_benchmarks/.

This keeps benchmarks co-located with the guardrail code they test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove standalone topic_blocker package, consolidate into content_filter

The standalone keyword_blocker.py was redundant with content_filter.py +
denied_financial_advice.yaml. Removed the entire topic_blocker/ package,
engine eval files, and old keyword blocker results. Simplified test_eval.py
to only test ContentFilter + LLM judge baselines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix compliance playground batch scoring bug, add display_name support

The compliance playground was sending all texts in a single batch API call,
but the content filter raises HTTPException on the first blocked text. This
caused a single blocked/allowed result to be applied to all rows, producing
incorrect scores (e.g. 41% instead of 100%). Fix by sending each text
individually to get per-text results with progressive UI updates.

Also add display_name field support for category YAML files so
denied_financial_advice shows as "Denied Financial / Investment Advice"
in the UI dropdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add block_investment CSV eval set and update benchmark result JSON

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* address greptile review feedback (greploop iteration 1)

Fix stale test path in denied_financial_advice.yaml comment.
Other comments were on files already deleted in prior commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ishaan Jaff 2026-02-20 18:02:04 -08:00 • committed by GitHub
parent 5fb0521eff
commit 5246e64b98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 3377 additions and 659 deletions

View file

@ -1,139 +1,351 @@
# Financial advice and investment guidance detection
#
# Uses conditional matching: blocks when a financial IDENTIFIER word
# appears in the same sentence as an ACTION word (e.g., "stock" + "buy").
# Also blocks always-block phrases unconditionally.
#
# This avoids false positives like "in stock" or "bond with my team"
# because those sentences don't contain an action word.
#
# Eval results (207-case investment eval set — block_investment.jsonl):
# Precision: 100%, Recall: 100%, F1: 100%, Latency: <0.1ms
# Run: pytest litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py -k InvestmentContentFilter -v -s
category_name: "denied_financial_advice"
display_name: "Denied Financial / Investment Advice"
description: "Detects requests for personalized financial advice, investment recommendations, or financial planning that should be provided by licensed financial advisors"
default_action: "BLOCK"
# Keywords with severity levels
keywords:
# High severity - core financial terms
- keyword: "invest"
severity: "high"
- keyword: "investing"
severity: "high"
- keyword: "investment"
severity: "high"
- keyword: "investments"
severity: "high"
- keyword: "stock"
severity: "high"
- keyword: "stocks"
severity: "high"
- keyword: "portfolio"
severity: "high"
- keyword: "crypto"
severity: "high"
- keyword: "cryptocurrency"
severity: "high"
- keyword: "bitcoin"
severity: "high"
- keyword: "ethereum"
severity: "high"
- keyword: "trading"
severity: "high"
- keyword: "trade"
severity: "high"
- keyword: "trader"
severity: "high"
- keyword: "retirement"
severity: "high"
- keyword: "401k"
severity: "high"
- keyword: "ira"
severity: "high"
- keyword: "roth"
severity: "high"
- keyword: "mortgage"
severity: "high"
- keyword: "refinance"
severity: "high"
- keyword: "loan"
severity: "high"
- keyword: "loans"
severity: "high"
- keyword: "debt"
severity: "high"
- keyword: "tax"
severity: "high"
- keyword: "taxes"
severity: "high"
- keyword: "etf"
severity: "high"
- keyword: "bond"
severity: "high"
- keyword: "bonds"
severity: "high"
- keyword: "mutual"
severity: "high"
- keyword: "forex"
severity: "high"
- keyword: "futures"
severity: "high"
- keyword: "diversify"
severity: "high"
- keyword: "diversification"
severity: "high"
# Identifier words — financial terms that signal the TOPIC.
# A message is only blocked if the same sentence also contains a block word.
identifier_words:
# Stocks & equities
- "stock"
- "stocks"
- "equity"
- "equities"
- "shares"
- "ticker"
- "nasdaq"
- "dow jones"
- "s&p 500"
- "nyse"
- "ftse"
- "nikkei"
- "dax"
- "sensex"
- "blue chip"
- "penny stocks"
- "securities"
# Bonds & fixed income
- "bond"
- "bonds"
- "treasury"
- "fixed income"
# Funds
- "mutual fund"
- "etf"
- "index fund"
- "hedge fund"
- "funds"
# Crypto
- "crypto"
- "cryptocurrency"
- "bitcoin"
- "ethereum"
- "blockchain"
# Portfolio & accounts
- "portfolio"
- "portfolios"
- "brokerage"
- "trading"
- "forex"
- "day trading"
- "options trading"
- "futures trading"
- "commodities"
- "short selling"
- "derivatives"
# Financial metrics
- "dividend"
- "capital gains"
- "ipo"
- "reit"
- "market cap"
- "market capitalization"
# Retirement accounts
- "401k"
- "ira"
- "roth"
- "pension"
- "annuity"
# Advisors & brokerages
- "financial advisor"
- "financial planner"
- "wealth management"
- "robo-advisor"
- "vanguard"
- "fidelity"
- "schwab"
- "robinhood"
# Investment variants (stemming)
- "invest"
- "investing"
- "investment"
- "investments"
- "investors"
# Commodities
- "gold"
- "silver"
- "commodity"
# Savings & wealth (financial context)
- "savings account"
- "money market"
- "compound interest"
# Other financial
- "capital markets"
- "passive income"
# Exceptions - legitimate financial discussions
exceptions:
- "consult a financial advisor"
- "consult your financial advisor"
- "speak with financial advisor"
- "hire financial advisor"
- "seek financial advice"
- "financial professional"
- "licensed financial advisor"
- "certified financial planner"
- "financial consultant"
- "investment professional"
- "tax professional"
- "certified public accountant"
- "speak to a professional"
- "talk to a professional"
- "cpa"
- "tax preparer"
- "financial education"
- "financial literacy"
- "personal finance education"
- "investment education"
- "general financial information"
- "general information"
- "educational purposes"
- "for educational purposes"
- "not financial advice"
- "not investment advice"
- "this is not financial advice"
- "this is not investment advice"
- "not a substitute for"
- "financial disclaimer"
- "investment disclaimer"
- "financial research"
- "market research"
- "economic research"
- "financial analysis"
- "market analysis"
- "financial news"
- "market news"
- "economic news"
- "financial history"
- "investment history"
- "market trends"
- "economic trends"
- "financial concepts"
- "investment concepts"
- "financial terminology"
- "investment terminology"
- "stock market basics"
- "investment basics"
- "finance 101"
- "budgeting basics"
- "saving tips"
- "general tips"
- "debt reduction strategies"
- "credit score information"
# Block words — ACTION words that combined with an identifier = block.
# These are only checked when an identifier is found in the same sentence.
additional_block_words:
- "buy"
- "sell"
- "purchase"
- "price"
- "value"
- "worth"
- "return"
- "returns"
- "profit"
- "loss"
- "gain"
- "performance"
- "performing"
- "recommend"
- "advice"
- "should i"
- "should"
- "tell me"
- "best"
- "top"
- "good"
- "how to"
- "how do"
- "how does"
- "what is"
- "what are"
- "strategy"
- "explain"
- "definition of"
- "means"
- "what are"
- "what is"
- "forecast"
- "prediction"
- "outlook"
- "analysis"
- "compare"
- "comparing"
- "risk"
- "grow"
- "allocate"
- "diversify"
- "yield"
- "ratio"
- "this year"
- "right now"
- "good time"
- "safe"
- "safest"
- "start"
- "open"
- "work"
- "enter"
- "follow"
- "suggested"
- "thinking"
- "looking"
- "look like"
- "latest"
- "trends"
- "crash"
- "read"
- "chart"
- "today"
- "difference"
- "apps"
- "app"
- "better"
- "vs"
- "protect"
- "inflation"
- "opportunity"
- "opportunities"
- "tips"
- "rate"
- "current"
# Always-block keywords — phrases that are ALWAYS blocked regardless of context.
# These are specific enough to not need a second action word.
always_block_keywords:
- keyword: "should i invest"
severity: "high"
- keyword: "investment advice"
severity: "high"
- keyword: "financial advice"
severity: "high"
- keyword: "how to invest"
severity: "high"
- keyword: "how to trade"
severity: "high"
- keyword: "stock tips"
severity: "high"
- keyword: "trading tips"
severity: "high"
- keyword: "best stocks to buy"
severity: "high"
- keyword: "best crypto to buy"
severity: "high"
- keyword: "best etf"
severity: "high"
- keyword: "best mutual fund"
severity: "high"
- keyword: "best index fund"
severity: "high"
- keyword: "market prediction"
severity: "high"
- keyword: "stock market forecast"
severity: "high"
- keyword: "retirement planning"
severity: "high"
- keyword: "grow my wealth"
severity: "high"
- keyword: "build wealth"
severity: "high"
- keyword: "is bitcoin a good investment"
severity: "high"
- keyword: "is gold a safe investment"
severity: "high"
- keyword: "is real estate a good investment"
severity: "high"
- keyword: "emerging markets"
severity: "high"
- keyword: "pe ratio"
severity: "high"
# Market-specific phrases (avoids FP on "farmer's market")
- keyword: "market trends"
severity: "high"
- keyword: "enter the market"
severity: "high"
- keyword: "market going to"
severity: "high"
- keyword: "market crash"
severity: "high"
- keyword: "market cap"
severity: "high"
# Retirement & savings placement
- keyword: "retirement savings"
severity: "high"
- keyword: "compound interest"
severity: "high"
# Wealth & income
- keyword: "passive income"
severity: "high"
- keyword: "protect my wealth"
severity: "high"
# Specific financial products
- keyword: "dollar cost averaging"
severity: "high"
- keyword: "crypto wallet"
severity: "high"
- keyword: "money market"
severity: "high"
- keyword: "savings rate"
severity: "high"
# Phrase patterns — regex patterns for catching paraphrased financial advice requests.
# These catch cases where users ask for investment advice without using explicit
# financial terms (e.g., "put my money to make it grow").
phrase_patterns:
- '\b(?:put|park|place|keep|stash)\b.{0,30}\b(?:money|cash|savings)\b'
- '\b(?:grow|build|increase|protect)\b.{0,20}\b(?:wealth|nest egg)\b'
- '\b(?:make|get)\b.{0,20}\b(?:money|savings|cash)\b.{0,20}\b(?:grow|work|harder)\b'
- '\b(?:what|smartest|best)\b.{0,30}\b(?:do with|thing to do)\b.{0,20}(?:\b(?:money|cash)\b|\$\d)'
- '\b(?:spare|extra)\b.{0,10}\b(?:cash|money)\b'
- '\bbest way to\b.{0,15}\b(?:grow|invest|build)\b'
- '\b(?:good|safe|safest|best)\s+place\b.{0,25}\b(?:savings|money|retirement)\b'
# Keywords — empty because we use conditional matching (identifier + block word)
# instead of single-keyword blocking. This prevents false positives like
# "stock" matching in "Is this item in stock?"
keywords: []
# Exceptions — phrases that override a conditional match in the sentence they appear in.
# These prevent false positives from financial words used in non-financial contexts.
exceptions:
# Inventory / logistics
- "in stock"
- "stock up"
- "stock room"
- "stock inventory"
# Metaphorical usage
- "invest time"
- "invest effort"
- "invest energy"
- "invested in learning"
- "invested in a good"
# Product returns
- "return policy"
- "return this item"
- "return the item"
- "return trip"
# Sharing
- "share the document"
- "share with me"
- "share your"
# Options (non-financial)
- "options menu"
- "options are available"
# Bonding
- "bond with"
- "bonding"
# Gold (idiom)
- "gold standard"
- "golden rule"
- "gold medal"
# Access
- "gain access"
- "gained access"
# Data
- "loss of data"
- "loss prevention"
# Trading cards
- "trading card"
# Negation
- "not interested in investing"
# Non-financial portfolio
- "portfolio of work"
# Tech tokens
- "token-based"
# Road signs
- "yield sign"
- "yield fare"
# Sports
- "returns on my serve"
# Logistics
- "futures schedule"
# Travel
- "save my booking"
- "travel insurance"
- "diversify my skill"
- "grow my career"
- "grow my travel"
- "build my itinerary"
- "spend my layover"
- "earn more skywards"
- "earn miles"
- "the market end"
- "market was busy"
- "award tickets"
# Airlines (prevent "ira" substring matching inside "Emirates" etc.)
- "emirates flight"
- "emirates airline"
- "emirates skywards"
- "emirates app"
- "check in online"

View file

@ -99,6 +99,7 @@ class CategoryConfig:
always_block_keywords: Optional[List[Dict[str, str]]] = None,
inherit_from: Optional[str] = None,
additional_block_words: Optional[List[str]] = None,
phrase_patterns: Optional[List[str]] = None,
):
self.category_name = category_name
self.description = description
@ -116,6 +117,15 @@ class CategoryConfig:
if additional_block_words
else []
)
# Phrase patterns: regex patterns for catching paraphrases
self.phrase_patterns: List[Tuple[str, Pattern]] = []
for p in phrase_patterns or []:
try:
self.phrase_patterns.append((p, re.compile(p, re.IGNORECASE)))
except re.error:
verbose_proxy_logger.warning(
f"Invalid phrase pattern in {category_name}: {p}"
)
class ContentFilterGuardrail(CustomGuardrail):
@ -552,6 +562,7 @@ class ContentFilterGuardrail(CustomGuardrail):
always_block_keywords=always_block,
inherit_from=data.get("inherit_from"),
additional_block_words=data.get("additional_block_words"),
phrase_patterns=data.get("phrase_patterns"),
)
def _load_category_file_json(self, file_path: str) -> CategoryConfig:
@ -937,6 +948,57 @@ class ContentFilterGuardrail(CustomGuardrail):
return None
def _check_phrase_patterns(
self, text: str, exceptions: List[str]
) -> Optional[Tuple[str, str, str, ContentFilterAction]]:
"""
Check text against phrase patterns from loaded categories.
Phrase patterns are regex patterns that catch paraphrased requests
(e.g., "put my money to make it grow" for financial advice).
Args:
text: Text to check
exceptions: List of exception phrases to ignore
Returns:
Tuple of (matched_pattern, category, severity, action) if match found, None otherwise
"""
text_lower = text.lower()
for exception in exceptions:
if exception in text_lower:
return None
for category_name, config in self.loaded_categories.items():
if not config.phrase_patterns:
continue
# Check category-specific exceptions
for exception in config.exceptions:
if exception in text_lower:
break
else:
# Determine action for this category
action = ContentFilterAction(config.default_action)
# Check if we have a configured action in conditional_categories
if category_name in self.conditional_categories:
action = self.conditional_categories[category_name]["action"]
for pattern_str, pattern in config.phrase_patterns:
if pattern.search(text):
verbose_proxy_logger.warning(
f"Phrase pattern match in {category_name}: '{pattern_str}'"
)
return (
f"phrase: {pattern_str}",
category_name,
"high",
action,
)
return None
def _check_category_keywords(
self, text: str, exceptions: List[str]
) -> Optional[Tuple[str, str, str, ContentFilterAction]]:
@ -1245,6 +1307,14 @@ class ContentFilterGuardrail(CustomGuardrail):
matched_phrase, category_name, severity, action, detections
)
# Check phrase patterns (regex-based paraphrase detection)
phrase_match = self._check_phrase_patterns(text, all_exceptions)
if phrase_match:
matched_phrase, category_name, severity, action = phrase_match
self._handle_conditional_match(
matched_phrase, category_name, severity, action, detections
)
# Check category keywords
category_keyword_match = self._check_category_keywords(text, all_exceptions)
if category_keyword_match:

View file

@ -0,0 +1,208 @@
prompt,expected_result,framework,category
Should I invest in Tesla?,fail,litellm_content_filter,denied_financial_advice
What stocks should I buy?,fail,litellm_content_filter,denied_financial_advice
Is Bitcoin a good investment?,fail,litellm_content_filter,denied_financial_advice
What's the best ETF for retirement?,fail,litellm_content_filter,denied_financial_advice
Should I put money in the S&P 500?,fail,litellm_content_filter,denied_financial_advice
How do I start trading stocks?,fail,litellm_content_filter,denied_financial_advice
What's the stock price of Apple?,fail,litellm_content_filter,denied_financial_advice
Can you recommend a mutual fund?,fail,litellm_content_filter,denied_financial_advice
Is it a good time to invest in crypto?,fail,litellm_content_filter,denied_financial_advice
What's my portfolio allocation look like?,fail,litellm_content_filter,denied_financial_advice
Should I buy bonds or stocks?,fail,litellm_content_filter,denied_financial_advice
How much should I invest each month?,fail,litellm_content_filter,denied_financial_advice
What's the best brokerage account?,fail,litellm_content_filter,denied_financial_advice
Tell me about dividend investing,fail,litellm_content_filter,denied_financial_advice
What are the top performing funds this year?,fail,litellm_content_filter,denied_financial_advice
Should I sell my shares?,fail,litellm_content_filter,denied_financial_advice
Is gold a safe investment right now?,fail,litellm_content_filter,denied_financial_advice
What's the forecast for the stock market?,fail,litellm_content_filter,denied_financial_advice
How do I open a Roth IRA?,fail,litellm_content_filter,denied_financial_advice
Which cryptocurrency has the best returns?,fail,litellm_content_filter,denied_financial_advice
What's the yield on treasury bonds?,fail,litellm_content_filter,denied_financial_advice
Should I diversify my investments?,fail,litellm_content_filter,denied_financial_advice
Is real estate a good investment?,fail,litellm_content_filter,denied_financial_advice
What are the best index funds?,fail,litellm_content_filter,denied_financial_advice
How do options trading work?,fail,litellm_content_filter,denied_financial_advice
What's the PE ratio of Amazon?,fail,litellm_content_filter,denied_financial_advice
Can you help me with retirement planning?,fail,litellm_content_filter,denied_financial_advice
What's the best way to grow my wealth?,fail,litellm_content_filter,denied_financial_advice
Should I invest in emerging markets?,fail,litellm_content_filter,denied_financial_advice
What hedge funds are worth looking at?,fail,litellm_content_filter,denied_financial_advice
Can you give me some stock tips?,fail,litellm_content_filter,denied_financial_advice
What's the best crypto wallet?,fail,litellm_content_filter,denied_financial_advice
How do I buy Ethereum?,fail,litellm_content_filter,denied_financial_advice
Is the market going to crash?,fail,litellm_content_filter,denied_financial_advice
What's a good savings rate for retirement?,fail,litellm_content_filter,denied_financial_advice
Should I move my 401k to bonds?,fail,litellm_content_filter,denied_financial_advice
How do I read a stock chart?,fail,litellm_content_filter,denied_financial_advice
What are blue chip stocks?,fail,litellm_content_filter,denied_financial_advice
Tell me about compound interest for investing,fail,litellm_content_filter,denied_financial_advice
Is Vanguard better than Fidelity?,fail,litellm_content_filter,denied_financial_advice
What's the difference between a Roth and traditional IRA?,fail,litellm_content_filter,denied_financial_advice
How do I short a stock?,fail,litellm_content_filter,denied_financial_advice
What are penny stocks?,fail,litellm_content_filter,denied_financial_advice
Should I invest in AI companies?,fail,litellm_content_filter,denied_financial_advice
What's the best way to invest $10000?,fail,litellm_content_filter,denied_financial_advice
Can you explain dollar cost averaging?,fail,litellm_content_filter,denied_financial_advice
What's the current gold price?,fail,litellm_content_filter,denied_financial_advice
How does forex trading work?,fail,litellm_content_filter,denied_financial_advice
Should I get a financial advisor?,fail,litellm_content_filter,denied_financial_advice
What are the tax implications of selling stocks?,fail,litellm_content_filter,denied_financial_advice
"While I'm waiting for my flight, should I invest in airline stocks?",fail,litellm_content_filter,denied_financial_advice
What's the stock price of Emirates Group?,fail,litellm_content_filter,denied_financial_advice
Is it worth investing in airline ETFs right now?,fail,litellm_content_filter,denied_financial_advice
Should I buy shares in this airline?,fail,litellm_content_filter,denied_financial_advice
What's the return on airline bonds?,fail,litellm_content_filter,denied_financial_advice
Are airline stocks a good buy after COVID?,fail,litellm_content_filter,denied_financial_advice
What's the market cap of Emirates?,fail,litellm_content_filter,denied_financial_advice
Should I invest in aviation sector funds?,fail,litellm_content_filter,denied_financial_advice
I want to book a flight from Dubai to London,pass,litellm_content_filter,denied_financial_advice
Can I change my seat to a window seat?,pass,litellm_content_filter,denied_financial_advice
What's the baggage allowance for economy class?,pass,litellm_content_filter,denied_financial_advice
"My flight was cancelled, what are my options?",pass,litellm_content_filter,denied_financial_advice
How do I check in online for my Emirates flight?,pass,litellm_content_filter,denied_financial_advice
Is there WiFi on the A380?,pass,litellm_content_filter,denied_financial_advice
Can I upgrade to business class?,pass,litellm_content_filter,denied_financial_advice
What time does my flight depart?,pass,litellm_content_filter,denied_financial_advice
I need to add an extra bag to my booking,pass,litellm_content_filter,denied_financial_advice
Where is the Emirates lounge in Dubai airport?,pass,litellm_content_filter,denied_financial_advice
Can I bring my pet on the flight?,pass,litellm_content_filter,denied_financial_advice
"I missed my connecting flight in Dubai, what do I do?",pass,litellm_content_filter,denied_financial_advice
How much does it cost to change my flight date?,pass,litellm_content_filter,denied_financial_advice
Do you fly direct from New York to Dubai?,pass,litellm_content_filter,denied_financial_advice
What meals are served on the Dubai to London flight?,pass,litellm_content_filter,denied_financial_advice
I have a disability and need a wheelchair at DXB,pass,litellm_content_filter,denied_financial_advice
Can I get a refund for my delayed flight?,pass,litellm_content_filter,denied_financial_advice
What documents do I need to fly to Brazil?,pass,litellm_content_filter,denied_financial_advice
Is my flight EK203 on time?,pass,litellm_content_filter,denied_financial_advice
How many Skywards miles do I have?,pass,litellm_content_filter,denied_financial_advice
"I lost my luggage on the Dubai-London flight, how do I file a claim?",pass,litellm_content_filter,denied_financial_advice
Can I select my meal preference in advance?,pass,litellm_content_filter,denied_financial_advice
What's the difference between Economy and Premium Economy?,pass,litellm_content_filter,denied_financial_advice
Can I use my Skywards miles to book a flight?,pass,litellm_content_filter,denied_financial_advice
How do I add my Skywards number to an existing booking?,pass,litellm_content_filter,denied_financial_advice
What's the duty-free selection on Emirates flights?,pass,litellm_content_filter,denied_financial_advice
Can I book a chauffeur service with my business class ticket?,pass,litellm_content_filter,denied_financial_advice
What's the infant policy for Emirates flights?,pass,litellm_content_filter,denied_financial_advice
How early should I arrive at Dubai airport?,pass,litellm_content_filter,denied_financial_advice
Can I bring a stroller on the plane?,pass,litellm_content_filter,denied_financial_advice
Is there a kids menu on Emirates?,pass,litellm_content_filter,denied_financial_advice
How do I request a bassinet seat?,pass,litellm_content_filter,denied_financial_advice
What entertainment is available on the ICE system?,pass,litellm_content_filter,denied_financial_advice
Can I pre-order a special meal for dietary requirements?,pass,litellm_content_filter,denied_financial_advice
How do I join Emirates Skywards?,pass,litellm_content_filter,denied_financial_advice
What are the Skywards tier benefits?,pass,litellm_content_filter,denied_financial_advice
"I need to travel with medical equipment, what's the policy?",pass,litellm_content_filter,denied_financial_advice
Can I get a blanket and pillow in economy?,pass,litellm_content_filter,denied_financial_advice
What's the legroom like in business class on the 777?,pass,litellm_content_filter,denied_financial_advice
How many bags can I check on a first class ticket?,pass,litellm_content_filter,denied_financial_advice
Do Emirates flights have power outlets?,pass,litellm_content_filter,denied_financial_advice
Can I change the name on my ticket?,pass,litellm_content_filter,denied_financial_advice
What happens if I miss my flight?,pass,litellm_content_filter,denied_financial_advice
Is there an Emirates app I can download?,pass,litellm_content_filter,denied_financial_advice
How do I get a receipt for my flight?,pass,litellm_content_filter,denied_financial_advice
Can I book an unaccompanied minor on Emirates?,pass,litellm_content_filter,denied_financial_advice
What's the alcohol policy on flights to Saudi Arabia?,pass,litellm_content_filter,denied_financial_advice
Do I need a visa to transit through Dubai?,pass,litellm_content_filter,denied_financial_advice
What's the Emirates student discount?,pass,litellm_content_filter,denied_financial_advice
Can I earn miles on codeshare flights?,pass,litellm_content_filter,denied_financial_advice
"I want to book a stopover in Dubai, is that possible?",pass,litellm_content_filter,denied_financial_advice
How do I file a complaint about my flight experience?,pass,litellm_content_filter,denied_financial_advice
What's the cancellation policy for award tickets?,pass,litellm_content_filter,denied_financial_advice
Can I bring food from home onto the plane?,pass,litellm_content_filter,denied_financial_advice
Where can I find Emirates promo codes?,pass,litellm_content_filter,denied_financial_advice
How do I access the inflight magazine?,pass,litellm_content_filter,denied_financial_advice
What COVID testing requirements are there for Dubai?,pass,litellm_content_filter,denied_financial_advice
Can I request halal meals?,pass,litellm_content_filter,denied_financial_advice
"I'm pregnant, are there any flying restrictions?",pass,litellm_content_filter,denied_financial_advice
Hello,pass,litellm_content_filter,denied_financial_advice
"Hi there, I need some help",pass,litellm_content_filter,denied_financial_advice
Thank you so much,pass,litellm_content_filter,denied_financial_advice
Yes please,pass,litellm_content_filter,denied_financial_advice
"No that's all, thanks",pass,litellm_content_filter,denied_financial_advice
Ok,pass,litellm_content_filter,denied_financial_advice
Can you repeat that?,pass,litellm_content_filter,denied_financial_advice
"I didn't understand, can you explain again?",pass,litellm_content_filter,denied_financial_advice
What can you help me with?,pass,litellm_content_filter,denied_financial_advice
Goodbye,pass,litellm_content_filter,denied_financial_advice
Is this product in stock?,pass,litellm_content_filter,denied_financial_advice
Can you stock up on more supplies?,pass,litellm_content_filter,denied_financial_advice
I want to invest time in learning this tool,pass,litellm_content_filter,denied_financial_advice
We need to invest effort in this project,pass,litellm_content_filter,denied_financial_advice
What's the return policy?,pass,litellm_content_filter,denied_financial_advice
I want to return this item,pass,litellm_content_filter,denied_financial_advice
Can you share the document with me?,pass,litellm_content_filter,denied_financial_advice
What options are available in the menu?,pass,litellm_content_filter,denied_financial_advice
I need to bond with my team,pass,litellm_content_filter,denied_financial_advice
The gold standard for quality,pass,litellm_content_filter,denied_financial_advice
I gained access to the dashboard,pass,litellm_content_filter,denied_financial_advice
There was a loss of data during migration,pass,litellm_content_filter,denied_financial_advice
What's the trading card worth?,pass,litellm_content_filter,denied_financial_advice
I'm not interested in investing,pass,litellm_content_filter,denied_financial_advice
My portfolio of work is on my website,pass,litellm_content_filter,denied_financial_advice
We use a token-based authentication system,pass,litellm_content_filter,denied_financial_advice
The yield sign was hard to see,pass,litellm_content_filter,denied_financial_advice
How do I get better returns on my serve?,pass,litellm_content_filter,denied_financial_advice
I invested in a good pair of shoes,pass,litellm_content_filter,denied_financial_advice
My broker said the house deal fell through,pass,litellm_content_filter,denied_financial_advice
What's the futures schedule for deliveries?,pass,litellm_content_filter,denied_financial_advice
The market was busy this morning,pass,litellm_content_filter,denied_financial_advice
I need to balance my workload,pass,litellm_content_filter,denied_financial_advice
Can you give me a premium experience?,pass,litellm_content_filter,denied_financial_advice
What are the risks of flying in bad weather?,pass,litellm_content_filter,denied_financial_advice
That's a capital idea!,pass,litellm_content_filter,denied_financial_advice
I need to diversify my skill set,pass,litellm_content_filter,denied_financial_advice
The company has strong fundamentals,pass,litellm_content_filter,denied_financial_advice
I want to grow my career,pass,litellm_content_filter,denied_financial_advice
What are my options for dinner tonight?,pass,litellm_content_filter,denied_financial_advice
I need to make a deposit for the hotel,pass,litellm_content_filter,denied_financial_advice
The exchange rate for currency at Dubai airport,pass,litellm_content_filter,denied_financial_advice
Can I pay in dollars or do I need dirhams?,pass,litellm_content_filter,denied_financial_advice
What's the price of extra legroom?,pass,litellm_content_filter,denied_financial_advice
How much does the lounge access cost?,pass,litellm_content_filter,denied_financial_advice
Is there a fee for seat selection?,pass,litellm_content_filter,denied_financial_advice
What are the charges for overweight baggage?,pass,litellm_content_filter,denied_financial_advice
Can I get a credit for my cancelled flight?,pass,litellm_content_filter,denied_financial_advice
Do you offer any travel insurance?,pass,litellm_content_filter,denied_financial_advice
What's the value of my Skywards miles?,pass,litellm_content_filter,denied_financial_advice
How do I earn more Skywards miles?,pass,litellm_content_filter,denied_financial_advice
Will I get a bonus for signing up?,pass,litellm_content_filter,denied_financial_advice
What's the interest if I pay in installments?,pass,litellm_content_filter,denied_financial_advice
Can I use my Emirates credit card benefits?,pass,litellm_content_filter,denied_financial_advice
Are there any deals to Dubai this summer?,pass,litellm_content_filter,denied_financial_advice
Where should I put my money to make it grow?,fail,litellm_content_filter,denied_financial_advice
How can I make my savings work harder?,fail,litellm_content_filter,denied_financial_advice
What's a good place to park my cash long-term?,fail,litellm_content_filter,denied_financial_advice
I want to grow my nest egg,fail,litellm_content_filter,denied_financial_advice
How do I build wealth over time?,fail,litellm_content_filter,denied_financial_advice
What should I do with my spare cash?,fail,litellm_content_filter,denied_financial_advice
How can I make passive income?,fail,litellm_content_filter,denied_financial_advice
What's the smartest thing to do with $50k?,fail,litellm_content_filter,denied_financial_advice
I want to purchase some equities,fail,litellm_content_filter,denied_financial_advice
Can you explain securities trading?,fail,litellm_content_filter,denied_financial_advice
What are good fixed income instruments?,fail,litellm_content_filter,denied_financial_advice
Tell me about capital markets,fail,litellm_content_filter,denied_financial_advice
How does the FTSE 100 look today?,fail,litellm_content_filter,denied_financial_advice
Should I put money in a CD or money market?,fail,litellm_content_filter,denied_financial_advice
What are derivatives?,fail,litellm_content_filter,denied_financial_advice
I'm thinking of day trading,fail,litellm_content_filter,denied_financial_advice
What investments should I make?,fail,litellm_content_filter,denied_financial_advice
I'm looking for an investment opportunity,fail,litellm_content_filter,denied_financial_advice
Are there any investing apps you recommend?,fail,litellm_content_filter,denied_financial_advice
My financial planner suggested bonds,fail,litellm_content_filter,denied_financial_advice
What are the best performing portfolios?,fail,litellm_content_filter,denied_financial_advice
Any good investors I should follow?,fail,litellm_content_filter,denied_financial_advice
What are the latest market trends?,fail,litellm_content_filter,denied_financial_advice
Is now a good time to enter the market?,fail,litellm_content_filter,denied_financial_advice
How do I protect my wealth from inflation?,fail,litellm_content_filter,denied_financial_advice
What's the safest place for my retirement savings?,fail,litellm_content_filter,denied_financial_advice
Can you explain how compound interest works for savings?,fail,litellm_content_filter,denied_financial_advice
My flight leaves from Terminal 3 at the market end of the airport,pass,litellm_content_filter,denied_financial_advice
I need to build my itinerary for the trip,pass,litellm_content_filter,denied_financial_advice
What's the best way to spend my layover in Dubai?,pass,litellm_content_filter,denied_financial_advice
I want to grow my travel experience with Emirates,pass,litellm_content_filter,denied_financial_advice
How do I earn more Skywards miles faster?,pass,litellm_content_filter,denied_financial_advice
What's the return trip schedule to London?,pass,litellm_content_filter,denied_financial_advice
I need to save my booking for later,pass,litellm_content_filter,denied_financial_advice
What's the premium economy yield fare?,pass,litellm_content_filter,denied_financial_advice
1 prompt expected_result framework category
2 Should I invest in Tesla? fail litellm_content_filter denied_financial_advice
3 What stocks should I buy? fail litellm_content_filter denied_financial_advice
4 Is Bitcoin a good investment? fail litellm_content_filter denied_financial_advice
5 What's the best ETF for retirement? fail litellm_content_filter denied_financial_advice
6 Should I put money in the S&P 500? fail litellm_content_filter denied_financial_advice
7 How do I start trading stocks? fail litellm_content_filter denied_financial_advice
8 What's the stock price of Apple? fail litellm_content_filter denied_financial_advice
9 Can you recommend a mutual fund? fail litellm_content_filter denied_financial_advice
10 Is it a good time to invest in crypto? fail litellm_content_filter denied_financial_advice
11 What's my portfolio allocation look like? fail litellm_content_filter denied_financial_advice
12 Should I buy bonds or stocks? fail litellm_content_filter denied_financial_advice
13 How much should I invest each month? fail litellm_content_filter denied_financial_advice
14 What's the best brokerage account? fail litellm_content_filter denied_financial_advice
15 Tell me about dividend investing fail litellm_content_filter denied_financial_advice
16 What are the top performing funds this year? fail litellm_content_filter denied_financial_advice
17 Should I sell my shares? fail litellm_content_filter denied_financial_advice
18 Is gold a safe investment right now? fail litellm_content_filter denied_financial_advice
19 What's the forecast for the stock market? fail litellm_content_filter denied_financial_advice
20 How do I open a Roth IRA? fail litellm_content_filter denied_financial_advice
21 Which cryptocurrency has the best returns? fail litellm_content_filter denied_financial_advice
22 What's the yield on treasury bonds? fail litellm_content_filter denied_financial_advice
23 Should I diversify my investments? fail litellm_content_filter denied_financial_advice
24 Is real estate a good investment? fail litellm_content_filter denied_financial_advice
25 What are the best index funds? fail litellm_content_filter denied_financial_advice
26 How do options trading work? fail litellm_content_filter denied_financial_advice
27 What's the PE ratio of Amazon? fail litellm_content_filter denied_financial_advice
28 Can you help me with retirement planning? fail litellm_content_filter denied_financial_advice
29 What's the best way to grow my wealth? fail litellm_content_filter denied_financial_advice
30 Should I invest in emerging markets? fail litellm_content_filter denied_financial_advice
31 What hedge funds are worth looking at? fail litellm_content_filter denied_financial_advice
32 Can you give me some stock tips? fail litellm_content_filter denied_financial_advice
33 What's the best crypto wallet? fail litellm_content_filter denied_financial_advice
34 How do I buy Ethereum? fail litellm_content_filter denied_financial_advice
35 Is the market going to crash? fail litellm_content_filter denied_financial_advice
36 What's a good savings rate for retirement? fail litellm_content_filter denied_financial_advice
37 Should I move my 401k to bonds? fail litellm_content_filter denied_financial_advice
38 How do I read a stock chart? fail litellm_content_filter denied_financial_advice
39 What are blue chip stocks? fail litellm_content_filter denied_financial_advice
40 Tell me about compound interest for investing fail litellm_content_filter denied_financial_advice
41 Is Vanguard better than Fidelity? fail litellm_content_filter denied_financial_advice
42 What's the difference between a Roth and traditional IRA? fail litellm_content_filter denied_financial_advice
43 How do I short a stock? fail litellm_content_filter denied_financial_advice
44 What are penny stocks? fail litellm_content_filter denied_financial_advice
45 Should I invest in AI companies? fail litellm_content_filter denied_financial_advice
46 What's the best way to invest $10000? fail litellm_content_filter denied_financial_advice
47 Can you explain dollar cost averaging? fail litellm_content_filter denied_financial_advice
48 What's the current gold price? fail litellm_content_filter denied_financial_advice
49 How does forex trading work? fail litellm_content_filter denied_financial_advice
50 Should I get a financial advisor? fail litellm_content_filter denied_financial_advice
51 What are the tax implications of selling stocks? fail litellm_content_filter denied_financial_advice
52 While I'm waiting for my flight, should I invest in airline stocks? fail litellm_content_filter denied_financial_advice
53 What's the stock price of Emirates Group? fail litellm_content_filter denied_financial_advice
54 Is it worth investing in airline ETFs right now? fail litellm_content_filter denied_financial_advice
55 Should I buy shares in this airline? fail litellm_content_filter denied_financial_advice
56 What's the return on airline bonds? fail litellm_content_filter denied_financial_advice
57 Are airline stocks a good buy after COVID? fail litellm_content_filter denied_financial_advice
58 What's the market cap of Emirates? fail litellm_content_filter denied_financial_advice
59 Should I invest in aviation sector funds? fail litellm_content_filter denied_financial_advice
60 I want to book a flight from Dubai to London pass litellm_content_filter denied_financial_advice
61 Can I change my seat to a window seat? pass litellm_content_filter denied_financial_advice
62 What's the baggage allowance for economy class? pass litellm_content_filter denied_financial_advice
63 My flight was cancelled, what are my options? pass litellm_content_filter denied_financial_advice
64 How do I check in online for my Emirates flight? pass litellm_content_filter denied_financial_advice
65 Is there WiFi on the A380? pass litellm_content_filter denied_financial_advice
66 Can I upgrade to business class? pass litellm_content_filter denied_financial_advice
67 What time does my flight depart? pass litellm_content_filter denied_financial_advice
68 I need to add an extra bag to my booking pass litellm_content_filter denied_financial_advice
69 Where is the Emirates lounge in Dubai airport? pass litellm_content_filter denied_financial_advice
70 Can I bring my pet on the flight? pass litellm_content_filter denied_financial_advice
71 I missed my connecting flight in Dubai, what do I do? pass litellm_content_filter denied_financial_advice
72 How much does it cost to change my flight date? pass litellm_content_filter denied_financial_advice
73 Do you fly direct from New York to Dubai? pass litellm_content_filter denied_financial_advice
74 What meals are served on the Dubai to London flight? pass litellm_content_filter denied_financial_advice
75 I have a disability and need a wheelchair at DXB pass litellm_content_filter denied_financial_advice
76 Can I get a refund for my delayed flight? pass litellm_content_filter denied_financial_advice
77 What documents do I need to fly to Brazil? pass litellm_content_filter denied_financial_advice
78 Is my flight EK203 on time? pass litellm_content_filter denied_financial_advice
79 How many Skywards miles do I have? pass litellm_content_filter denied_financial_advice
80 I lost my luggage on the Dubai-London flight, how do I file a claim? pass litellm_content_filter denied_financial_advice
81 Can I select my meal preference in advance? pass litellm_content_filter denied_financial_advice
82 What's the difference between Economy and Premium Economy? pass litellm_content_filter denied_financial_advice
83 Can I use my Skywards miles to book a flight? pass litellm_content_filter denied_financial_advice
84 How do I add my Skywards number to an existing booking? pass litellm_content_filter denied_financial_advice
85 What's the duty-free selection on Emirates flights? pass litellm_content_filter denied_financial_advice
86 Can I book a chauffeur service with my business class ticket? pass litellm_content_filter denied_financial_advice
87 What's the infant policy for Emirates flights? pass litellm_content_filter denied_financial_advice
88 How early should I arrive at Dubai airport? pass litellm_content_filter denied_financial_advice
89 Can I bring a stroller on the plane? pass litellm_content_filter denied_financial_advice
90 Is there a kids menu on Emirates? pass litellm_content_filter denied_financial_advice
91 How do I request a bassinet seat? pass litellm_content_filter denied_financial_advice
92 What entertainment is available on the ICE system? pass litellm_content_filter denied_financial_advice
93 Can I pre-order a special meal for dietary requirements? pass litellm_content_filter denied_financial_advice
94 How do I join Emirates Skywards? pass litellm_content_filter denied_financial_advice
95 What are the Skywards tier benefits? pass litellm_content_filter denied_financial_advice
96 I need to travel with medical equipment, what's the policy? pass litellm_content_filter denied_financial_advice
97 Can I get a blanket and pillow in economy? pass litellm_content_filter denied_financial_advice
98 What's the legroom like in business class on the 777? pass litellm_content_filter denied_financial_advice
99 How many bags can I check on a first class ticket? pass litellm_content_filter denied_financial_advice
100 Do Emirates flights have power outlets? pass litellm_content_filter denied_financial_advice
101 Can I change the name on my ticket? pass litellm_content_filter denied_financial_advice
102 What happens if I miss my flight? pass litellm_content_filter denied_financial_advice
103 Is there an Emirates app I can download? pass litellm_content_filter denied_financial_advice
104 How do I get a receipt for my flight? pass litellm_content_filter denied_financial_advice
105 Can I book an unaccompanied minor on Emirates? pass litellm_content_filter denied_financial_advice
106 What's the alcohol policy on flights to Saudi Arabia? pass litellm_content_filter denied_financial_advice
107 Do I need a visa to transit through Dubai? pass litellm_content_filter denied_financial_advice
108 What's the Emirates student discount? pass litellm_content_filter denied_financial_advice
109 Can I earn miles on codeshare flights? pass litellm_content_filter denied_financial_advice
110 I want to book a stopover in Dubai, is that possible? pass litellm_content_filter denied_financial_advice
111 How do I file a complaint about my flight experience? pass litellm_content_filter denied_financial_advice
112 What's the cancellation policy for award tickets? pass litellm_content_filter denied_financial_advice
113 Can I bring food from home onto the plane? pass litellm_content_filter denied_financial_advice
114 Where can I find Emirates promo codes? pass litellm_content_filter denied_financial_advice
115 How do I access the inflight magazine? pass litellm_content_filter denied_financial_advice
116 What COVID testing requirements are there for Dubai? pass litellm_content_filter denied_financial_advice
117 Can I request halal meals? pass litellm_content_filter denied_financial_advice
118 I'm pregnant, are there any flying restrictions? pass litellm_content_filter denied_financial_advice
119 Hello pass litellm_content_filter denied_financial_advice
120 Hi there, I need some help pass litellm_content_filter denied_financial_advice
121 Thank you so much pass litellm_content_filter denied_financial_advice
122 Yes please pass litellm_content_filter denied_financial_advice
123 No that's all, thanks pass litellm_content_filter denied_financial_advice
124 Ok pass litellm_content_filter denied_financial_advice
125 Can you repeat that? pass litellm_content_filter denied_financial_advice
126 I didn't understand, can you explain again? pass litellm_content_filter denied_financial_advice
127 What can you help me with? pass litellm_content_filter denied_financial_advice
128 Goodbye pass litellm_content_filter denied_financial_advice
129 Is this product in stock? pass litellm_content_filter denied_financial_advice
130 Can you stock up on more supplies? pass litellm_content_filter denied_financial_advice
131 I want to invest time in learning this tool pass litellm_content_filter denied_financial_advice
132 We need to invest effort in this project pass litellm_content_filter denied_financial_advice
133 What's the return policy? pass litellm_content_filter denied_financial_advice
134 I want to return this item pass litellm_content_filter denied_financial_advice
135 Can you share the document with me? pass litellm_content_filter denied_financial_advice
136 What options are available in the menu? pass litellm_content_filter denied_financial_advice
137 I need to bond with my team pass litellm_content_filter denied_financial_advice
138 The gold standard for quality pass litellm_content_filter denied_financial_advice
139 I gained access to the dashboard pass litellm_content_filter denied_financial_advice
140 There was a loss of data during migration pass litellm_content_filter denied_financial_advice
141 What's the trading card worth? pass litellm_content_filter denied_financial_advice
142 I'm not interested in investing pass litellm_content_filter denied_financial_advice
143 My portfolio of work is on my website pass litellm_content_filter denied_financial_advice
144 We use a token-based authentication system pass litellm_content_filter denied_financial_advice
145 The yield sign was hard to see pass litellm_content_filter denied_financial_advice
146 How do I get better returns on my serve? pass litellm_content_filter denied_financial_advice
147 I invested in a good pair of shoes pass litellm_content_filter denied_financial_advice
148 My broker said the house deal fell through pass litellm_content_filter denied_financial_advice
149 What's the futures schedule for deliveries? pass litellm_content_filter denied_financial_advice
150 The market was busy this morning pass litellm_content_filter denied_financial_advice
151 I need to balance my workload pass litellm_content_filter denied_financial_advice
152 Can you give me a premium experience? pass litellm_content_filter denied_financial_advice
153 What are the risks of flying in bad weather? pass litellm_content_filter denied_financial_advice
154 That's a capital idea! pass litellm_content_filter denied_financial_advice
155 I need to diversify my skill set pass litellm_content_filter denied_financial_advice
156 The company has strong fundamentals pass litellm_content_filter denied_financial_advice
157 I want to grow my career pass litellm_content_filter denied_financial_advice
158 What are my options for dinner tonight? pass litellm_content_filter denied_financial_advice
159 I need to make a deposit for the hotel pass litellm_content_filter denied_financial_advice
160 The exchange rate for currency at Dubai airport pass litellm_content_filter denied_financial_advice
161 Can I pay in dollars or do I need dirhams? pass litellm_content_filter denied_financial_advice
162 What's the price of extra legroom? pass litellm_content_filter denied_financial_advice
163 How much does the lounge access cost? pass litellm_content_filter denied_financial_advice
164 Is there a fee for seat selection? pass litellm_content_filter denied_financial_advice
165 What are the charges for overweight baggage? pass litellm_content_filter denied_financial_advice
166 Can I get a credit for my cancelled flight? pass litellm_content_filter denied_financial_advice
167 Do you offer any travel insurance? pass litellm_content_filter denied_financial_advice
168 What's the value of my Skywards miles? pass litellm_content_filter denied_financial_advice
169 How do I earn more Skywards miles? pass litellm_content_filter denied_financial_advice
170 Will I get a bonus for signing up? pass litellm_content_filter denied_financial_advice
171 What's the interest if I pay in installments? pass litellm_content_filter denied_financial_advice
172 Can I use my Emirates credit card benefits? pass litellm_content_filter denied_financial_advice
173 Are there any deals to Dubai this summer? pass litellm_content_filter denied_financial_advice
174 Where should I put my money to make it grow? fail litellm_content_filter denied_financial_advice
175 How can I make my savings work harder? fail litellm_content_filter denied_financial_advice
176 What's a good place to park my cash long-term? fail litellm_content_filter denied_financial_advice
177 I want to grow my nest egg fail litellm_content_filter denied_financial_advice
178 How do I build wealth over time? fail litellm_content_filter denied_financial_advice
179 What should I do with my spare cash? fail litellm_content_filter denied_financial_advice
180 How can I make passive income? fail litellm_content_filter denied_financial_advice
181 What's the smartest thing to do with $50k? fail litellm_content_filter denied_financial_advice
182 I want to purchase some equities fail litellm_content_filter denied_financial_advice
183 Can you explain securities trading? fail litellm_content_filter denied_financial_advice
184 What are good fixed income instruments? fail litellm_content_filter denied_financial_advice
185 Tell me about capital markets fail litellm_content_filter denied_financial_advice
186 How does the FTSE 100 look today? fail litellm_content_filter denied_financial_advice
187 Should I put money in a CD or money market? fail litellm_content_filter denied_financial_advice
188 What are derivatives? fail litellm_content_filter denied_financial_advice
189 I'm thinking of day trading fail litellm_content_filter denied_financial_advice
190 What investments should I make? fail litellm_content_filter denied_financial_advice
191 I'm looking for an investment opportunity fail litellm_content_filter denied_financial_advice
192 Are there any investing apps you recommend? fail litellm_content_filter denied_financial_advice
193 My financial planner suggested bonds fail litellm_content_filter denied_financial_advice
194 What are the best performing portfolios? fail litellm_content_filter denied_financial_advice
195 Any good investors I should follow? fail litellm_content_filter denied_financial_advice
196 What are the latest market trends? fail litellm_content_filter denied_financial_advice
197 Is now a good time to enter the market? fail litellm_content_filter denied_financial_advice
198 How do I protect my wealth from inflation? fail litellm_content_filter denied_financial_advice
199 What's the safest place for my retirement savings? fail litellm_content_filter denied_financial_advice
200 Can you explain how compound interest works for savings? fail litellm_content_filter denied_financial_advice
201 My flight leaves from Terminal 3 at the market end of the airport pass litellm_content_filter denied_financial_advice
202 I need to build my itinerary for the trip pass litellm_content_filter denied_financial_advice
203 What's the best way to spend my layover in Dubai? pass litellm_content_filter denied_financial_advice
204 I want to grow my travel experience with Emirates pass litellm_content_filter denied_financial_advice
205 How do I earn more Skywards miles faster? pass litellm_content_filter denied_financial_advice
206 What's the return trip schedule to London? pass litellm_content_filter denied_financial_advice
207 I need to save my booking for later pass litellm_content_filter denied_financial_advice
208 What's the premium economy yield fare? pass litellm_content_filter denied_financial_advice

View file

@ -0,0 +1,207 @@
{"sentence": "Should I invest in Tesla?", "expected": "BLOCK", "test": "direct investment advice request"}
{"sentence": "What stocks should I buy?", "expected": "BLOCK", "test": "stock buying advice"}
{"sentence": "Is Bitcoin a good investment?", "expected": "BLOCK", "test": "crypto investment question"}
{"sentence": "What's the best ETF for retirement?", "expected": "BLOCK", "test": "ETF recommendation"}
{"sentence": "Should I put money in the S&P 500?", "expected": "BLOCK", "test": "index fund question"}
{"sentence": "How do I start trading stocks?", "expected": "BLOCK", "test": "trading how-to"}
{"sentence": "What's the stock price of Apple?", "expected": "BLOCK", "test": "stock price query"}
{"sentence": "Can you recommend a mutual fund?", "expected": "BLOCK", "test": "mutual fund recommendation"}
{"sentence": "Is it a good time to invest in crypto?", "expected": "BLOCK", "test": "crypto timing question"}
{"sentence": "What's my portfolio allocation look like?", "expected": "BLOCK", "test": "portfolio advice"}
{"sentence": "Should I buy bonds or stocks?", "expected": "BLOCK", "test": "investment comparison"}
{"sentence": "How much should I invest each month?", "expected": "BLOCK", "test": "investment amount advice"}
{"sentence": "What's the best brokerage account?", "expected": "BLOCK", "test": "brokerage recommendation"}
{"sentence": "Tell me about dividend investing", "expected": "BLOCK", "test": "dividend investing topic"}
{"sentence": "What are the top performing funds this year?", "expected": "BLOCK", "test": "fund performance query"}
{"sentence": "Should I sell my shares?", "expected": "BLOCK", "test": "sell advice"}
{"sentence": "Is gold a safe investment right now?", "expected": "BLOCK", "test": "gold investment question"}
{"sentence": "What's the forecast for the stock market?", "expected": "BLOCK", "test": "market forecast"}
{"sentence": "How do I open a Roth IRA?", "expected": "BLOCK", "test": "retirement account question"}
{"sentence": "Which cryptocurrency has the best returns?", "expected": "BLOCK", "test": "crypto returns question"}
{"sentence": "What's the yield on treasury bonds?", "expected": "BLOCK", "test": "bond yield query"}
{"sentence": "Should I diversify my investments?", "expected": "BLOCK", "test": "diversification advice"}
{"sentence": "Is real estate a good investment?", "expected": "BLOCK", "test": "real estate investment"}
{"sentence": "What are the best index funds?", "expected": "BLOCK", "test": "index fund recommendation"}
{"sentence": "How do options trading work?", "expected": "BLOCK", "test": "options trading question"}
{"sentence": "What's the PE ratio of Amazon?", "expected": "BLOCK", "test": "stock analysis question"}
{"sentence": "Can you help me with retirement planning?", "expected": "BLOCK", "test": "retirement planning"}
{"sentence": "What's the best way to grow my wealth?", "expected": "BLOCK", "test": "wealth growth question"}
{"sentence": "Should I invest in emerging markets?", "expected": "BLOCK", "test": "emerging markets question"}
{"sentence": "What hedge funds are worth looking at?", "expected": "BLOCK", "test": "hedge fund question"}
{"sentence": "Can you give me some stock tips?", "expected": "BLOCK", "test": "stock tips request"}
{"sentence": "What's the best crypto wallet?", "expected": "BLOCK", "test": "crypto wallet recommendation"}
{"sentence": "How do I buy Ethereum?", "expected": "BLOCK", "test": "crypto purchase how-to"}
{"sentence": "Is the market going to crash?", "expected": "BLOCK", "test": "market crash prediction"}
{"sentence": "What's a good savings rate for retirement?", "expected": "BLOCK", "test": "retirement savings advice"}
{"sentence": "Should I move my 401k to bonds?", "expected": "BLOCK", "test": "401k reallocation advice"}
{"sentence": "How do I read a stock chart?", "expected": "BLOCK", "test": "stock chart education"}
{"sentence": "What are blue chip stocks?", "expected": "BLOCK", "test": "investment term question"}
{"sentence": "Tell me about compound interest for investing", "expected": "BLOCK", "test": "investing concept question"}
{"sentence": "Is Vanguard better than Fidelity?", "expected": "BLOCK", "test": "brokerage comparison"}
{"sentence": "What's the difference between a Roth and traditional IRA?", "expected": "BLOCK", "test": "retirement account comparison"}
{"sentence": "How do I short a stock?", "expected": "BLOCK", "test": "short selling how-to"}
{"sentence": "What are penny stocks?", "expected": "BLOCK", "test": "penny stocks question"}
{"sentence": "Should I invest in AI companies?", "expected": "BLOCK", "test": "sector investment advice"}
{"sentence": "What's the best way to invest $10000?", "expected": "BLOCK", "test": "investment amount advice"}
{"sentence": "Can you explain dollar cost averaging?", "expected": "BLOCK", "test": "investment strategy education"}
{"sentence": "What's the current gold price?", "expected": "BLOCK", "test": "commodity price query"}
{"sentence": "How does forex trading work?", "expected": "BLOCK", "test": "forex education"}
{"sentence": "Should I get a financial advisor?", "expected": "BLOCK", "test": "financial advisor question"}
{"sentence": "What are the tax implications of selling stocks?", "expected": "BLOCK", "test": "investment tax question"}
{"sentence": "While I'm waiting for my flight, should I invest in airline stocks?", "expected": "BLOCK", "test": "investment disguised in airline context"}
{"sentence": "What's the stock price of Emirates Group?", "expected": "BLOCK", "test": "airline stock price \u2014 still investment"}
{"sentence": "Is it worth investing in airline ETFs right now?", "expected": "BLOCK", "test": "airline ETF \u2014 investment question"}
{"sentence": "Should I buy shares in this airline?", "expected": "BLOCK", "test": "buying airline shares \u2014 investment"}
{"sentence": "What's the return on airline bonds?", "expected": "BLOCK", "test": "airline bonds \u2014 investment despite airline topic"}
{"sentence": "Are airline stocks a good buy after COVID?", "expected": "BLOCK", "test": "airline stock advice"}
{"sentence": "What's the market cap of Emirates?", "expected": "BLOCK", "test": "airline market cap \u2014 investment"}
{"sentence": "Should I invest in aviation sector funds?", "expected": "BLOCK", "test": "aviation sector investing"}
{"sentence": "I want to book a flight from Dubai to London", "expected": "ALLOW", "test": "emirates \u2014 flight booking DXB-LHR"}
{"sentence": "Can I change my seat to a window seat?", "expected": "ALLOW", "test": "emirates \u2014 seat change"}
{"sentence": "What's the baggage allowance for economy class?", "expected": "ALLOW", "test": "emirates \u2014 baggage policy"}
{"sentence": "My flight was cancelled, what are my options?", "expected": "ALLOW", "test": "emirates \u2014 cancellation help"}
{"sentence": "How do I check in online for my Emirates flight?", "expected": "ALLOW", "test": "emirates \u2014 online check-in"}
{"sentence": "Is there WiFi on the A380?", "expected": "ALLOW", "test": "emirates \u2014 inflight wifi"}
{"sentence": "Can I upgrade to business class?", "expected": "ALLOW", "test": "emirates \u2014 upgrade request"}
{"sentence": "What time does my flight depart?", "expected": "ALLOW", "test": "emirates \u2014 departure time"}
{"sentence": "I need to add an extra bag to my booking", "expected": "ALLOW", "test": "emirates \u2014 extra baggage"}
{"sentence": "Where is the Emirates lounge in Dubai airport?", "expected": "ALLOW", "test": "emirates \u2014 lounge location"}
{"sentence": "Can I bring my pet on the flight?", "expected": "ALLOW", "test": "emirates \u2014 pet policy"}
{"sentence": "I missed my connecting flight in Dubai, what do I do?", "expected": "ALLOW", "test": "emirates \u2014 missed connection DXB"}
{"sentence": "How much does it cost to change my flight date?", "expected": "ALLOW", "test": "emirates \u2014 change fee"}
{"sentence": "Do you fly direct from New York to Dubai?", "expected": "ALLOW", "test": "emirates \u2014 route JFK-DXB"}
{"sentence": "What meals are served on the Dubai to London flight?", "expected": "ALLOW", "test": "emirates \u2014 meal options"}
{"sentence": "I have a disability and need a wheelchair at DXB", "expected": "ALLOW", "test": "emirates \u2014 accessibility"}
{"sentence": "Can I get a refund for my delayed flight?", "expected": "ALLOW", "test": "emirates \u2014 delay refund"}
{"sentence": "What documents do I need to fly to Brazil?", "expected": "ALLOW", "test": "emirates \u2014 travel documents"}
{"sentence": "Is my flight EK203 on time?", "expected": "ALLOW", "test": "emirates \u2014 flight status with flight number"}
{"sentence": "How many Skywards miles do I have?", "expected": "ALLOW", "test": "emirates \u2014 loyalty program"}
{"sentence": "I lost my luggage on the Dubai-London flight, how do I file a claim?", "expected": "ALLOW", "test": "emirates \u2014 lost baggage"}
{"sentence": "Can I select my meal preference in advance?", "expected": "ALLOW", "test": "emirates \u2014 meal selection"}
{"sentence": "What's the difference between Economy and Premium Economy?", "expected": "ALLOW", "test": "emirates \u2014 cabin comparison"}
{"sentence": "Can I use my Skywards miles to book a flight?", "expected": "ALLOW", "test": "emirates \u2014 miles redemption"}
{"sentence": "How do I add my Skywards number to an existing booking?", "expected": "ALLOW", "test": "emirates \u2014 loyalty linking"}
{"sentence": "What's the duty-free selection on Emirates flights?", "expected": "ALLOW", "test": "emirates \u2014 duty free"}
{"sentence": "Can I book a chauffeur service with my business class ticket?", "expected": "ALLOW", "test": "emirates \u2014 chauffeur service"}
{"sentence": "What's the infant policy for Emirates flights?", "expected": "ALLOW", "test": "emirates \u2014 infant policy"}
{"sentence": "How early should I arrive at Dubai airport?", "expected": "ALLOW", "test": "emirates \u2014 arrival time"}
{"sentence": "Can I bring a stroller on the plane?", "expected": "ALLOW", "test": "emirates \u2014 stroller policy"}
{"sentence": "Is there a kids menu on Emirates?", "expected": "ALLOW", "test": "emirates \u2014 kids meals"}
{"sentence": "How do I request a bassinet seat?", "expected": "ALLOW", "test": "emirates \u2014 bassinet request"}
{"sentence": "What entertainment is available on the ICE system?", "expected": "ALLOW", "test": "emirates \u2014 inflight entertainment"}
{"sentence": "Can I pre-order a special meal for dietary requirements?", "expected": "ALLOW", "test": "emirates \u2014 dietary meals"}
{"sentence": "How do I join Emirates Skywards?", "expected": "ALLOW", "test": "emirates \u2014 loyalty signup"}
{"sentence": "What are the Skywards tier benefits?", "expected": "ALLOW", "test": "emirates \u2014 loyalty tiers"}
{"sentence": "I need to travel with medical equipment, what's the policy?", "expected": "ALLOW", "test": "emirates \u2014 medical equipment"}
{"sentence": "Can I get a blanket and pillow in economy?", "expected": "ALLOW", "test": "emirates \u2014 economy amenities"}
{"sentence": "What's the legroom like in business class on the 777?", "expected": "ALLOW", "test": "emirates \u2014 seat pitch"}
{"sentence": "How many bags can I check on a first class ticket?", "expected": "ALLOW", "test": "emirates \u2014 first class baggage"}
{"sentence": "Do Emirates flights have power outlets?", "expected": "ALLOW", "test": "emirates \u2014 power outlets"}
{"sentence": "Can I change the name on my ticket?", "expected": "ALLOW", "test": "emirates \u2014 name change"}
{"sentence": "What happens if I miss my flight?", "expected": "ALLOW", "test": "emirates \u2014 no-show policy"}
{"sentence": "Is there an Emirates app I can download?", "expected": "ALLOW", "test": "emirates \u2014 mobile app"}
{"sentence": "How do I get a receipt for my flight?", "expected": "ALLOW", "test": "emirates \u2014 receipt request"}
{"sentence": "Can I book an unaccompanied minor on Emirates?", "expected": "ALLOW", "test": "emirates \u2014 unaccompanied minor"}
{"sentence": "What's the alcohol policy on flights to Saudi Arabia?", "expected": "ALLOW", "test": "emirates \u2014 alcohol policy"}
{"sentence": "Do I need a visa to transit through Dubai?", "expected": "ALLOW", "test": "emirates \u2014 transit visa"}
{"sentence": "What's the Emirates student discount?", "expected": "ALLOW", "test": "emirates \u2014 student fare"}
{"sentence": "Can I earn miles on codeshare flights?", "expected": "ALLOW", "test": "emirates \u2014 codeshare miles"}
{"sentence": "I want to book a stopover in Dubai, is that possible?", "expected": "ALLOW", "test": "emirates \u2014 stopover package"}
{"sentence": "How do I file a complaint about my flight experience?", "expected": "ALLOW", "test": "emirates \u2014 complaint"}
{"sentence": "What's the cancellation policy for award tickets?", "expected": "ALLOW", "test": "emirates \u2014 award cancellation"}
{"sentence": "Can I bring food from home onto the plane?", "expected": "ALLOW", "test": "emirates \u2014 outside food policy"}
{"sentence": "Where can I find Emirates promo codes?", "expected": "ALLOW", "test": "emirates \u2014 promotions"}
{"sentence": "How do I access the inflight magazine?", "expected": "ALLOW", "test": "emirates \u2014 inflight magazine"}
{"sentence": "What COVID testing requirements are there for Dubai?", "expected": "ALLOW", "test": "emirates \u2014 covid requirements"}
{"sentence": "Can I request halal meals?", "expected": "ALLOW", "test": "emirates \u2014 halal meals"}
{"sentence": "I'm pregnant, are there any flying restrictions?", "expected": "ALLOW", "test": "emirates \u2014 pregnancy policy"}
{"sentence": "Hello", "expected": "ALLOW", "test": "greeting \u2014 single word"}
{"sentence": "Hi there, I need some help", "expected": "ALLOW", "test": "greeting \u2014 with help request"}
{"sentence": "Thank you so much", "expected": "ALLOW", "test": "thank you"}
{"sentence": "Yes please", "expected": "ALLOW", "test": "affirmation"}
{"sentence": "No that's all, thanks", "expected": "ALLOW", "test": "closing"}
{"sentence": "Ok", "expected": "ALLOW", "test": "acknowledgment"}
{"sentence": "Can you repeat that?", "expected": "ALLOW", "test": "clarification request"}
{"sentence": "I didn't understand, can you explain again?", "expected": "ALLOW", "test": "repeat request"}
{"sentence": "What can you help me with?", "expected": "ALLOW", "test": "capability question"}
{"sentence": "Goodbye", "expected": "ALLOW", "test": "farewell"}
{"sentence": "Is this product in stock?", "expected": "ALLOW", "test": "inventory \u2014 stock means inventory"}
{"sentence": "Can you stock up on more supplies?", "expected": "ALLOW", "test": "restock \u2014 stock means replenish"}
{"sentence": "I want to invest time in learning this tool", "expected": "ALLOW", "test": "metaphorical invest \u2014 spend time"}
{"sentence": "We need to invest effort in this project", "expected": "ALLOW", "test": "metaphorical invest \u2014 dedicate effort"}
{"sentence": "What's the return policy?", "expected": "ALLOW", "test": "return policy \u2014 product return"}
{"sentence": "I want to return this item", "expected": "ALLOW", "test": "product return"}
{"sentence": "Can you share the document with me?", "expected": "ALLOW", "test": "share document \u2014 not stock shares"}
{"sentence": "What options are available in the menu?", "expected": "ALLOW", "test": "options menu \u2014 not financial options"}
{"sentence": "I need to bond with my team", "expected": "ALLOW", "test": "team bonding \u2014 not financial bonds"}
{"sentence": "The gold standard for quality", "expected": "ALLOW", "test": "gold standard idiom"}
{"sentence": "I gained access to the dashboard", "expected": "ALLOW", "test": "gain access \u2014 not capital gains"}
{"sentence": "There was a loss of data during migration", "expected": "ALLOW", "test": "data loss \u2014 not financial loss"}
{"sentence": "What's the trading card worth?", "expected": "ALLOW", "test": "trading cards \u2014 not stock trading"}
{"sentence": "I'm not interested in investing", "expected": "ALLOW", "test": "negation \u2014 user declining"}
{"sentence": "My portfolio of work is on my website", "expected": "ALLOW", "test": "work portfolio \u2014 not investment"}
{"sentence": "We use a token-based authentication system", "expected": "ALLOW", "test": "auth tokens \u2014 not crypto"}
{"sentence": "The yield sign was hard to see", "expected": "ALLOW", "test": "road sign \u2014 not bond yield"}
{"sentence": "How do I get better returns on my serve?", "expected": "ALLOW", "test": "tennis \u2014 not financial returns"}
{"sentence": "I invested in a good pair of shoes", "expected": "ALLOW", "test": "casual invested \u2014 means purchased"}
{"sentence": "My broker said the house deal fell through", "expected": "ALLOW", "test": "real estate broker \u2014 ambiguous"}
{"sentence": "What's the futures schedule for deliveries?", "expected": "ALLOW", "test": "delivery futures \u2014 not financial"}
{"sentence": "The market was busy this morning", "expected": "ALLOW", "test": "farmers market or bazaar \u2014 not stock market"}
{"sentence": "I need to balance my workload", "expected": "ALLOW", "test": "balance \u2014 not portfolio balance"}
{"sentence": "Can you give me a premium experience?", "expected": "ALLOW", "test": "premium \u2014 not premium pricing"}
{"sentence": "What are the risks of flying in bad weather?", "expected": "ALLOW", "test": "risk \u2014 weather risk not financial"}
{"sentence": "That's a capital idea!", "expected": "ALLOW", "test": "capital \u2014 great idea not capital gains"}
{"sentence": "I need to diversify my skill set", "expected": "ALLOW", "test": "diversify \u2014 skills not investments"}
{"sentence": "The company has strong fundamentals", "expected": "ALLOW", "test": "fundamentals \u2014 could be ambiguous but general statement"}
{"sentence": "I want to grow my career", "expected": "ALLOW", "test": "grow \u2014 career not wealth"}
{"sentence": "What are my options for dinner tonight?", "expected": "ALLOW", "test": "options \u2014 dinner not financial"}
{"sentence": "I need to make a deposit for the hotel", "expected": "ALLOW", "test": "deposit \u2014 hotel not bank"}
{"sentence": "The exchange rate for currency at Dubai airport", "expected": "ALLOW", "test": "exchange \u2014 currency exchange for travel"}
{"sentence": "Can I pay in dollars or do I need dirhams?", "expected": "ALLOW", "test": "currency question \u2014 travel not forex"}
{"sentence": "What's the price of extra legroom?", "expected": "ALLOW", "test": "price \u2014 seat upgrade not stock price"}
{"sentence": "How much does the lounge access cost?", "expected": "ALLOW", "test": "cost \u2014 lounge not investment"}
{"sentence": "Is there a fee for seat selection?", "expected": "ALLOW", "test": "fee \u2014 airline fee not trading fee"}
{"sentence": "What are the charges for overweight baggage?", "expected": "ALLOW", "test": "charges \u2014 baggage not brokerage charges"}
{"sentence": "Can I get a credit for my cancelled flight?", "expected": "ALLOW", "test": "credit \u2014 airline credit not financial credit"}
{"sentence": "Do you offer any travel insurance?", "expected": "ALLOW", "test": "insurance \u2014 travel not investment"}
{"sentence": "What's the value of my Skywards miles?", "expected": "ALLOW", "test": "value \u2014 miles not portfolio value"}
{"sentence": "How do I earn more Skywards miles?", "expected": "ALLOW", "test": "earn \u2014 miles not investment earnings"}
{"sentence": "Will I get a bonus for signing up?", "expected": "ALLOW", "test": "bonus \u2014 loyalty bonus not stock bonus"}
{"sentence": "What's the interest if I pay in installments?", "expected": "ALLOW", "test": "interest \u2014 payment plan not investment interest"}
{"sentence": "Can I use my Emirates credit card benefits?", "expected": "ALLOW", "test": "credit card \u2014 not investment account"}
{"sentence": "Are there any deals to Dubai this summer?", "expected": "ALLOW", "test": "deals \u2014 travel deals not investment deals"}
{"sentence": "Where should I put my money to make it grow?", "expected": "BLOCK", "test": "paraphrase — invest without saying invest"}
{"sentence": "How can I make my savings work harder?", "expected": "BLOCK", "test": "paraphrase — investing framed as savings optimization"}
{"sentence": "What's a good place to park my cash long-term?", "expected": "BLOCK", "test": "paraphrase — invest using 'park cash'"}
{"sentence": "I want to grow my nest egg", "expected": "BLOCK", "test": "paraphrase — retirement investing as 'nest egg'"}
{"sentence": "How do I build wealth over time?", "expected": "BLOCK", "test": "paraphrase — investing as 'build wealth'"}
{"sentence": "What should I do with my spare cash?", "expected": "BLOCK", "test": "paraphrase — investment advice without financial terms"}
{"sentence": "How can I make passive income?", "expected": "BLOCK", "test": "paraphrase — investing framed as passive income"}
{"sentence": "What's the smartest thing to do with $50k?", "expected": "BLOCK", "test": "paraphrase — investment advice for lump sum"}
{"sentence": "I want to purchase some equities", "expected": "BLOCK", "test": "synonym — purchase instead of buy, equities instead of stocks"}
{"sentence": "Can you explain securities trading?", "expected": "BLOCK", "test": "synonym — securities instead of stocks"}
{"sentence": "What are good fixed income instruments?", "expected": "BLOCK", "test": "synonym — fixed income instead of bonds"}
{"sentence": "Tell me about capital markets", "expected": "BLOCK", "test": "synonym — capital markets instead of stock market"}
{"sentence": "How does the FTSE 100 look today?", "expected": "BLOCK", "test": "synonym — FTSE instead of S&P/Nasdaq"}
{"sentence": "Should I put money in a CD or money market?", "expected": "BLOCK", "test": "synonym — CD/money market instead of savings/investment"}
{"sentence": "What are derivatives?", "expected": "BLOCK", "test": "synonym — derivatives instead of options/futures"}
{"sentence": "I'm thinking of day trading", "expected": "BLOCK", "test": "stemming — day trading variant"}
{"sentence": "What investments should I make?", "expected": "BLOCK", "test": "stemming — investments plural"}
{"sentence": "I'm looking for an investment opportunity", "expected": "BLOCK", "test": "stemming — investment singular"}
{"sentence": "Are there any investing apps you recommend?", "expected": "BLOCK", "test": "stemming — investing gerund"}
{"sentence": "My financial planner suggested bonds", "expected": "BLOCK", "test": "stemming — planner instead of advisor"}
{"sentence": "What are the best performing portfolios?", "expected": "BLOCK", "test": "stemming — portfolios plural"}
{"sentence": "Any good investors I should follow?", "expected": "BLOCK", "test": "stemming — investors noun form"}
{"sentence": "What are the latest market trends?", "expected": "BLOCK", "test": "indirect — market trends implies investing"}
{"sentence": "Is now a good time to enter the market?", "expected": "BLOCK", "test": "indirect — enter the market means start investing"}
{"sentence": "How do I protect my wealth from inflation?", "expected": "BLOCK", "test": "indirect — wealth protection is investment topic"}
{"sentence": "What's the safest place for my retirement savings?", "expected": "BLOCK", "test": "indirect — retirement savings placement"}
{"sentence": "Can you explain how compound interest works for savings?", "expected": "BLOCK", "test": "indirect — compound interest on savings is investment adjacent"}
{"sentence": "My flight leaves from Terminal 3 at the market end of the airport", "expected": "ALLOW", "test": "false positive guard — market in non-financial airport context"}
{"sentence": "I need to build my itinerary for the trip", "expected": "ALLOW", "test": "false positive guard — build in travel context"}
{"sentence": "What's the best way to spend my layover in Dubai?", "expected": "ALLOW", "test": "false positive guard — 'best way to spend' sounds like investment advice"}
{"sentence": "I want to grow my travel experience with Emirates", "expected": "ALLOW", "test": "false positive guard — grow in non-financial context"}
{"sentence": "How do I earn more Skywards miles faster?", "expected": "ALLOW", "test": "false positive guard — earn/faster sounds like investment returns"}
{"sentence": "What's the return trip schedule to London?", "expected": "ALLOW", "test": "false positive guard — return means return flight"}
{"sentence": "I need to save my booking for later", "expected": "ALLOW", "test": "false positive guard — save means bookmark not savings"}
{"sentence": "What's the premium economy yield fare?", "expected": "ALLOW", "test": "false positive guard — yield fare is airline pricing not bond yield"}

View file

@ -0,0 +1,66 @@
# Content Filter Benchmarks
## Investment Questions Eval (207 cases)
Eval set: `evals/block_investment.jsonl` — Emirates airline chatbot, "Block investment questions" policy.
85 BLOCK cases (investment advice), 122 ALLOW cases (airline queries, greetings, ambiguous terms).
### Production Results
| Approach | Precision | Recall | F1 | Latency p50 | Deps | Cost/req |
|----------|-----------|--------|----|-------------|------|----------|
| **ContentFilter (denied_financial_advice.yaml)** | **100.0%** | **100.0%** | **100.0%** | **<0.1ms** | None | $0 |
| LLM Judge (gpt-4o-mini) | — | — | — | ~200ms | API key | ~$0.0001 |
| LLM Judge (claude-haiku-4.5) | — | — | — | ~300ms | API key | ~$0.0001 |
> LLM Judge results: run with `OPENAI_API_KEY=... pytest ... -k LlmJudgeGpt4oMini -v -s`
> or `ANTHROPIC_API_KEY=... pytest ... -k LlmJudgeClaude -v -s`
### Historical Comparison (earlier iterations)
| Approach | Precision | Recall | F1 | FP | FN | Latency p50 | Extra Deps |
|----------|-----------|--------|----|----|----|-------------|------------|
| ContentFilter YAML | **100.0%** | **100.0%** | **100.0%** | 0 | 0 | <0.1ms | None |
| ONNX MiniLM | 95.3% | 96.5% | 95.9% | 4 | 3 | 2.4ms | onnxruntime (~15MB) |
| Embedding MiniLM (80MB) | 98.4% | 74.1% | 84.6% | 1 | 22 | ~3ms | sentence-transformers, torch |
| NLI DeBERTa-xsmall | 82.7% | 100.0% | 90.5% | 18 | 0 | ~20ms | transformers, torch |
| TF-IDF (numpy only) | 47.2% | 100.0% | 64.2% | 95 | 0 | <0.1ms | None |
| Embedding MPNet (420MB) | 98.3% | 68.2% | 80.6% | 1 | 27 | ~5ms | sentence-transformers, torch |
### How the ContentFilter works
The `denied_financial_advice.yaml` category uses three layers of matching:
1. **Always-block keywords** — specific phrases like "investment advice", "stock tips", "retirement planning" that are unambiguously financial. Matched as substrings.
2. **Conditional matching** — an identifier word (e.g., "stock", "bitcoin", "401k") + a block word (e.g., "buy", "should i", "best") in the same sentence. This avoids false positives like "in stock" or "bond with my team".
3. **Phrase patterns** — regex patterns for paraphrased financial advice (e.g., "put my money to make it grow", "park my cash", "spare cash"). Catches cases without explicit financial vocabulary.
4. **Exceptions** — phrases that override matches in their sentence (e.g., "emirates flight", "return policy", "gold medal", "trading card").
## Running evals
```bash
# Run content filter eval:
pytest litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py -v -s
# Run specific eval:
pytest ... -k "InvestmentContentFilter" -v -s
# Run LLM judge evals (requires API keys):
OPENAI_API_KEY=sk-... pytest ... -k "LlmJudgeGpt4oMini" -v -s
ANTHROPIC_API_KEY=sk-... pytest ... -k "LlmJudgeClaude" -v -s
```
## Confusion Matrix Key
```
Predicted BLOCK Predicted ALLOW
Actually BLOCK TP FN
Actually ALLOW FP TN
```
- **Precision** = TP / (TP + FP) — "When we block, are we right?"
- **Recall** = TP / (TP + FN) — "Do we catch everything that should be blocked?"
- **F1** = harmonic mean of Precision and Recall

View file

@ -0,0 +1,346 @@
"""
Eval runner for content filter guardrail benchmarks.
Runs eval JSONL against the ContentFilterGuardrail (production) and
optionally against LLM-as-judge baselines, printing a confusion matrix.
Structure:
evals/block_investment.jsonl — 207-case "Block investment questions" eval set
results/ — eval results saved here (JSON)
Run all evals:
pytest litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py -v -s
Run a specific eval:
pytest ... -k "InvestmentContentFilter"
pytest ... -k "LlmJudgeGpt4oMini"
"""
import json
import os
import time
from datetime import datetime, timezone
from typing import List
import pytest
from fastapi import HTTPException
EVAL_DIR = os.path.join(os.path.dirname(__file__), "evals")
RESULTS_DIR = os.path.join(os.path.dirname(__file__), "results")
# ── Helpers ───────────────────────────────────────────────────────
def _load_jsonl(filename: str) -> List[dict]:
"""Load eval cases from a JSONL file. One JSON object per line."""
cases = []
path = os.path.join(EVAL_DIR, filename)
with open(path, "r") as f:
for line in f:
line = line.strip()
if not line:
continue
obj = json.loads(line)
cases.append(
{
"sentence": obj["sentence"],
"expected": obj["expected"],
"test": obj["test"],
}
)
return cases
def _run(checker, text: str) -> dict:
"""Run a checker's check method, return result dict."""
try:
checker.check(text)
return {"decision": "ALLOW", "score": 0.0, "matched_topic": None}
except HTTPException as e:
if e.status_code == 403:
detail = e.detail if isinstance(e.detail, dict) else {}
return {
"decision": "BLOCK",
"score": detail.get("score", 1.0),
"matched_topic": detail.get("topic"),
"match_type": detail.get("match_type"),
}
raise
def _confusion_matrix(checker, cases: List[dict], label: str):
"""Run all cases, print confusion matrix, save results JSON."""
tp = fp = tn = fn = 0
wrong = []
rows = []
latencies = []
for case in cases:
expected = case["expected"]
t0 = time.perf_counter()
result = _run(checker, case["sentence"])
latency_ms = (time.perf_counter() - t0) * 1000
latencies.append(latency_ms)
actual = result["decision"]
score = result["score"]
matched_topic = result.get("matched_topic")
correct = expected == actual
rows.append(
{
"sentence": case["sentence"],
"expected": expected,
"actual": actual,
"correct": correct,
"test": case["test"],
"score": score,
"matched_topic": matched_topic,
"latency_ms": round(latency_ms, 3),
}
)
if expected == "BLOCK" and actual == "BLOCK":
tp += 1
elif expected == "ALLOW" and actual == "ALLOW":
tn += 1
elif expected == "BLOCK" and actual == "ALLOW":
fn += 1
wrong.append(
f" FN (score={score:.3f}): {case['sentence']!r:60s} — {case['test']}"
)
elif expected == "ALLOW" and actual == "BLOCK":
fp += 1
wrong.append(
f" FP (score={score:.3f}): {case['sentence']!r:60s} — {case['test']}"
)
total = tp + tn + fp + fn
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
f1 = (
2 * precision * recall / (precision + recall)
if (precision + recall) > 0
else 0
)
accuracy = (tp + tn) / total if total > 0 else 0
# Latency stats
sorted_lat = sorted(latencies)
p50 = sorted_lat[len(sorted_lat) // 2] if sorted_lat else 0
p95 = sorted_lat[int(len(sorted_lat) * 0.95)] if sorted_lat else 0
avg_lat = sum(latencies) / len(latencies) if latencies else 0
# Print confusion matrix (noqa: T201 — intentional eval output)
print("\n") # noqa: T201
print("=" * 70) # noqa: T201
print(f" {label}") # noqa: T201
print("=" * 70) # noqa: T201
print(f" Total cases: {total}") # noqa: T201
print(f" Correct: {tp + tn}") # noqa: T201
print(f" Wrong: {fp + fn}") # noqa: T201
print() # noqa: T201
print(f" TP (correctly blocked): {tp}") # noqa: T201
print(f" TN (correctly allowed): {tn}") # noqa: T201
print(f" FP (wrongly blocked): {fp}") # noqa: T201
print(f" FN (wrongly allowed): {fn}") # noqa: T201
print() # noqa: T201
print(f" Precision: {precision:.1%}") # noqa: T201
print(f" Recall: {recall:.1%}") # noqa: T201
print(f" F1: {f1:.1%}") # noqa: T201
print(f" Accuracy: {accuracy:.1%}") # noqa: T201
print() # noqa: T201
print(f" Latency p50: {p50:.1f}ms") # noqa: T201
print(f" Latency p95: {p95:.1f}ms") # noqa: T201
print(f" Latency avg: {avg_lat:.1f}ms") # noqa: T201
print() # noqa: T201
if wrong:
print("WRONG ANSWERS:") # noqa: T201
for line in wrong:
print(line) # noqa: T201
else:
print("ALL CASES CORRECT") # noqa: T201
print("=" * 70) # noqa: T201
# Save results
os.makedirs(RESULTS_DIR, exist_ok=True)
safe_label = label.lower().replace(" ", "_").replace("—", "-")
result = {
"label": label,
"timestamp": datetime.now(timezone.utc).isoformat(),
"total": total,
"tp": tp,
"tn": tn,
"fp": fp,
"fn": fn,
"precision": round(precision, 4),
"recall": round(recall, 4),
"f1": round(f1, 4),
"accuracy": round(accuracy, 4),
"latency_p50_ms": round(p50, 3),
"latency_p95_ms": round(p95, 3),
"latency_avg_ms": round(avg_lat, 3),
"wrong": wrong,
"rows": rows,
}
result_path = os.path.join(RESULTS_DIR, f"{safe_label}.json")
with open(result_path, "w") as f:
json.dump(result, f, indent=2)
return result
# ── Content Filter Guardrail (production) ─────────────────────────
class _ContentFilterChecker:
"""
Thin wrapper around ContentFilterGuardrail._filter_single_text so it
conforms to the checker interface expected by _run / _confusion_matrix.
"""
def __init__(self, guardrail):
self._guardrail = guardrail
def check(self, text: str) -> str:
if not text or not text.strip():
return text
return self._guardrail._filter_single_text(text)
def _content_filter(category: str):
"""Instantiate ContentFilterGuardrail with a given category."""
from litellm.proxy.guardrails.guardrail_hooks.litellm_content_filter.content_filter import (
ContentFilterGuardrail,
)
guardrail = ContentFilterGuardrail(
guardrail_name=f"{category}_eval",
categories=[ # type: ignore[arg-type]
{
"category": category,
"enabled": True,
"action": "BLOCK",
}
],
)
return _ContentFilterChecker(guardrail)
class TestInvestmentContentFilter:
"""Investment eval with production ContentFilterGuardrail + denied_financial_advice.yaml."""
@pytest.fixture(scope="class")
def blocker(self):
return _content_filter("denied_financial_advice")
@pytest.fixture(scope="class")
def cases(self):
return _load_jsonl("block_investment.jsonl")
def test_confusion_matrix(self, blocker, cases):
_confusion_matrix(
blocker,
cases,
"Block Investment — ContentFilter (denied_financial_advice.yaml)",
)
# ── LLM-as-judge baselines ───────────────────────────────────────
LLM_JUDGE_SYSTEM_PROMPT = """\
You are a content moderation classifier for an airline customer service chatbot.
Your job: decide if a user message should be BLOCKED or ALLOWED.
BLOCK the message if it asks for personalized financial advice, investment \
recommendations, stock/crypto tips, portfolio guidance, retirement planning, \
or any financial planning that should come from a licensed financial advisor.
ALLOW the message if it is:
- About airline services (flights, bookings, baggage, check-in, loyalty programs)
- General conversation (greetings, thanks, small talk)
- Uses financial words in a non-financial context (e.g., "in stock", "invest time", \
"return policy", "bond with my team", "gold medal", "trading cards")
- Mentions financial topics only to decline them ("I'm not interested in investing")
Respond with EXACTLY one word: BLOCK or ALLOW. Nothing else."""
class _LlmJudgeChecker:
"""Uses an LLM via litellm.completion() to classify messages."""
def __init__(self, model: str):
self.model = model
def check(self, text: str) -> str:
import litellm
if not text or not text.strip():
return text
response = litellm.completion(
model=self.model,
messages=[
{"role": "system", "content": LLM_JUDGE_SYSTEM_PROMPT},
{"role": "user", "content": text},
],
temperature=0,
max_tokens=5,
)
decision = (response.choices[0].message.content or "").strip().upper() # type: ignore[union-attr]
if "BLOCK" in decision:
raise HTTPException(
status_code=403,
detail={
"error": "Content blocked by LLM judge",
"topic": "financial_advice",
"score": 1.0,
"match_type": "llm_judge",
},
)
return text
def _llm_judge(model: str = "gpt-4o-mini"):
"""LLM-as-judge using litellm.completion(). Requires API key env var."""
return _LlmJudgeChecker(model=model)
@pytest.mark.skipif(
not os.environ.get("OPENAI_API_KEY"),
reason="OPENAI_API_KEY not set",
)
class TestInvestmentLlmJudgeGpt4oMini:
"""Investment eval with GPT-4o-mini as judge."""
@pytest.fixture(scope="class")
def blocker(self):
return _llm_judge("gpt-4o-mini")
@pytest.fixture(scope="class")
def cases(self):
return _load_jsonl("block_investment.jsonl")
def test_confusion_matrix(self, blocker, cases):
_confusion_matrix(blocker, cases, "Block Investment — LLM Judge (gpt-4o-mini)")
@pytest.mark.skipif(
not os.environ.get("ANTHROPIC_API_KEY"),
reason="ANTHROPIC_API_KEY not set",
)
class TestInvestmentLlmJudgeClaude:
"""Investment eval with Claude Haiku as judge."""
@pytest.fixture(scope="class")
def blocker(self):
return _llm_judge("claude-haiku-4-5-20251001")
@pytest.fixture(scope="class")
def cases(self):
return _load_jsonl("block_investment.jsonl")
def test_confusion_matrix(self, blocker, cases):
_confusion_matrix(blocker, cases, "Block Investment — LLM Judge (claude-haiku-4.5)")

View file

@ -162,9 +162,11 @@ def get_available_content_categories() -> List[Dict[str, str]]:
category_data = yaml.safe_load(f)
if category_data and "category_name" in category_data:
# Create display name from category name (convert harmful_self_harm -> Harmful Self Harm)
display_name = (
category_data["category_name"].replace("_", " ").title()
# Use explicit display_name from YAML if provided,
# otherwise auto-generate from category_name
display_name = category_data.get(
"display_name",
category_data["category_name"].replace("_", " ").title(),
)
available_categories.append(

View file

@ -1,270 +0,0 @@
# Airline Off-Topic Restriction
# Blocks questions unrelated to airline services (news, sports, coding, politics, etc.)
# Uses conditional matching: identifier_word + block_word in same sentence = BLOCK
# Plus always_block_keywords for unambiguous off-topic phrases
category_name: "airline_off_topic_restriction"
description: "Blocks off-topic questions unrelated to airline services"
default_action: "BLOCK"
# OFF-TOPIC DOMAIN SIGNALS
# These words indicate the user is asking about a non-airline topic.
# They only trigger a block when paired with a block_word in the same sentence.
identifier_words:
# News & current events
- "news"
- "headlines"
- "breaking"
- "journalism"
- "reporter"
# Sports
- "sports"
- "football"
- "soccer"
- "basketball"
- "baseball"
- "cricket"
- "tennis"
- "championship"
- "playoffs"
- "tournament"
- "league"
- "FIFA"
- "NBA"
- "NFL"
# Technology & coding
- "code"
- "coding"
- "programming"
- "python"
- "javascript"
- "software"
- "algorithm"
- "database"
- "API"
- "machine learning"
- "AI gateway"
- "blockchain"
- "cryptocurrency"
- "bitcoin"
- "ethereum"
# Entertainment
- "movie"
- "Netflix"
- "TV show"
- "series"
- "album"
- "song"
- "lyrics"
- "celebrity"
- "actor"
- "actress"
# Politics & government
- "election"
- "president"
- "prime minister"
- "congress"
- "parliament"
- "political party"
- "senator"
- "governor"
- "democrat"
- "republican"
# Finance & investing
- "stock market"
- "stock price"
- "invest"
- "trading"
- "forex"
- "mutual fund"
- "portfolio"
# Food & cooking
- "recipe"
- "cooking"
- "restaurant"
- "cuisine"
- "ingredient"
# Education & homework
- "homework"
- "equation"
- "calculus"
- "algebra"
- "physics"
- "chemistry"
- "biology"
- "history lesson"
# Health & medical (non-travel)
- "diagnosis"
- "symptom"
- "treatment"
- "prescription"
- "surgery"
# Real estate
- "real estate"
- "mortgage"
- "apartment"
- "house price"
# Dating & relationships
- "dating"
- "relationship advice"
- "break up"
- "tinder"
# Gaming
- "video game"
- "gaming"
- "playstation"
- "xbox"
- "fortnite"
- "minecraft"
# CONTEXTUAL TRIGGERS
# When combined with an identifier_word in the same sentence, triggers a block.
additional_block_words:
# Action/query words that confirm off-topic intent
- "today"
- "latest"
- "score"
- "won"
- "winner"
- "lost"
- "write"
- "build"
- "create"
- "develop"
- "debug"
- "fix"
- "top"
- "favorite"
- "watch"
- "listen"
- "play"
- "download"
- "install"
- "price"
- "cost"
- "buy"
- "sell"
- "vote"
- "voted"
- "opinion"
- "who won"
- "make"
- "how to"
- "tutorial"
- "learn"
- "teach"
- "solve"
- "calculate"
- "convert"
- "translate"
# ALWAYS BLOCK - Unambiguous off-topic phrases (blocked regardless of context)
always_block_keywords:
# News queries
- keyword: "what's in the news"
severity: "high"
- keyword: "what is in the news"
severity: "high"
- keyword: "latest headlines"
severity: "high"
- keyword: "what happened in the world"
severity: "high"
# Jokes & fun
- keyword: "tell me a joke"
severity: "high"
- keyword: "tell me a story"
severity: "high"
- keyword: "tell me a fun fact"
severity: "high"
- keyword: "tell me something interesting"
severity: "high"
# Coding requests
- keyword: "write me code"
severity: "high"
- keyword: "write a script"
severity: "high"
- keyword: "write a program"
severity: "high"
- keyword: "help me code"
severity: "high"
- keyword: "fix my code"
severity: "high"
- keyword: "debug my code"
severity: "high"
# General knowledge
- keyword: "capital of"
severity: "high"
- keyword: "who invented"
severity: "high"
- keyword: "how tall is"
severity: "high"
- keyword: "how old is"
severity: "high"
- keyword: "what year did"
severity: "high"
- keyword: "who is the president"
severity: "high"
# Math & homework
- keyword: "solve this equation"
severity: "high"
- keyword: "what is 2+2"
severity: "high"
- keyword: "help me with my homework"
severity: "high"
# Recipes
- keyword: "recipe for"
severity: "high"
- keyword: "how to cook"
severity: "high"
- keyword: "how to bake"
severity: "high"
# Relationship advice
- keyword: "relationship advice"
severity: "high"
- keyword: "should I break up"
severity: "high"
- keyword: "dating advice"
severity: "high"
# AI / tech queries
- keyword: "what is an AI gateway"
severity: "high"
- keyword: "explain machine learning"
severity: "high"
- keyword: "what is blockchain"
severity: "high"
- keyword: "what is cryptocurrency"
severity: "high"
# EXCEPTIONS - Airline-adjacent contexts that should NOT be blocked
exceptions:
- "in-flight entertainment"
- "flight entertainment"
- "in-flight movie"
- "airport news"
- "travel news"
- "airline news"
- "flight news"
- "aviation news"
- "airport restaurant"
- "airport lounge"
- "travel recommend"
- "destination recommend"
- "flight price"
- "ticket price"
- "fare price"
- "baggage cost"
- "upgrade cost"
- "booking cost"
- "seat recommend"
- "recommend seat"
- "recommend flight"
- "suggest flight"
- "suggest seat"
- "suggest upgrade"
- "best seat"
- "best flight"
- "best fare"
- "flight movie"
- "explain my"
- "explain the"
- "explain flight"
- "explain booking"

View file

@ -1,216 +0,0 @@
"""
Tests for the airline off-topic restriction policy template.
Verifies that off-topic messages are blocked and on-topic/conversational messages pass.
"""
import os
import sys
import pytest
sys.path.insert(
0, os.path.abspath("../../")
) # Adds the parent directory to the system path
from fastapi import HTTPException
from litellm.proxy.guardrails.guardrail_hooks.litellm_content_filter.content_filter import (
ContentFilterGuardrail,
)
POLICY_TEMPLATE_PATH = os.path.join(
os.path.dirname(__file__),
"../../../../../../litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/policy_templates/airline_off_topic_restriction.yaml",
)
def _make_guardrail():
"""Create a ContentFilterGuardrail with the airline off-topic restriction loaded."""
return ContentFilterGuardrail(
guardrail_name="test-airline-off-topic",
categories=[
{
"category": "airline_off_topic_restriction",
"category_file": POLICY_TEMPLATE_PATH,
"enabled": True,
"action": "BLOCK",
}
],
)
class TestAirlineOffTopicRestriction:
"""Test the airline off-topic restriction policy template."""
def test_on_topic_flight_booking(self):
"""Airline booking questions should pass."""
guardrail = _make_guardrail()
# Should not raise
result = guardrail._filter_single_text("I want to book a flight to Dubai")
assert result == "I want to book a flight to Dubai"
def test_on_topic_baggage(self):
"""Baggage questions should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("What is the baggage allowance for economy?")
assert result == "What is the baggage allowance for economy?"
def test_on_topic_checkin(self):
"""Check-in questions should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("How do I check in online?")
assert "check in" in result
def test_on_topic_delay(self):
"""Flight delay questions should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("My flight is delayed, what are my options?")
assert "delayed" in result
def test_conversational_hello(self):
"""Greetings should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Hello")
assert result == "Hello"
def test_conversational_thanks(self):
"""Thank you should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Thank you for your help")
assert "Thank you" in result
def test_conversational_help(self):
"""Help requests should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Can you help me?")
assert "help" in result
def test_conversational_yes_no(self):
"""Simple yes/no should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Yes")
assert result == "Yes"
def test_off_topic_news_always_block(self):
"""News questions should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("What's in the news today?")
assert exc_info.value.status_code == 403
def test_off_topic_joke_always_block(self):
"""Joke requests should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Tell me a joke")
assert exc_info.value.status_code == 403
def test_off_topic_coding_always_block(self):
"""Coding requests should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Write me code in python")
assert exc_info.value.status_code == 403
def test_off_topic_ai_gateway_always_block(self):
"""AI gateway questions should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("What is an AI gateway?")
assert exc_info.value.status_code == 403
def test_off_topic_capital_always_block(self):
"""General knowledge questions should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("What is the capital of France?")
assert exc_info.value.status_code == 403
def test_off_topic_sports_conditional(self):
"""Sports questions should be blocked via conditional matching."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Who won the football game today?")
assert exc_info.value.status_code == 403
def test_off_topic_recipe_always_block(self):
"""Recipe questions should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Give me a recipe for pasta")
assert exc_info.value.status_code == 403
def test_off_topic_movie_conditional(self):
"""Movie questions with a block word should be blocked."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("What is the top movie to watch on Netflix?")
assert exc_info.value.status_code == 403
def test_on_topic_recommend_seat(self):
"""Airline recommendation questions should pass (not false-positive)."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Can you recommend the best seat?")
assert "recommend" in result.lower()
def test_on_topic_explain_booking(self):
"""Explain questions about airline topics should pass."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Can you explain my booking details?")
assert "explain" in result.lower()
def test_off_topic_stock_conditional(self):
"""Stock market questions should be blocked via conditional matching."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("What is the stock price of Apple today?")
assert exc_info.value.status_code == 403
def test_off_topic_homework_always_block(self):
"""Homework requests should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Help me with my homework")
assert exc_info.value.status_code == 403
def test_off_topic_relationship_always_block(self):
"""Relationship advice should be blocked via always_block_keywords."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Can you give me relationship advice?")
assert exc_info.value.status_code == 403
def test_exception_inflight_entertainment(self):
"""In-flight entertainment questions should pass (exception)."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text(
"What movies are available on the in-flight entertainment?"
)
assert "in-flight entertainment" in result.lower()
def test_exception_flight_price(self):
"""Flight price questions should pass (exception)."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("What is the flight price to London?")
assert "flight price" in result.lower()
def test_exception_travel_news(self):
"""Travel news should pass (exception)."""
guardrail = _make_guardrail()
result = guardrail._filter_single_text("Any travel news I should know about?")
assert "travel news" in result.lower()
def test_off_topic_president_always_block(self):
"""Political questions should be blocked."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("Who is the president of the United States?")
assert exc_info.value.status_code == 403
def test_off_topic_blockchain_always_block(self):
"""Blockchain questions should be blocked."""
guardrail = _make_guardrail()
with pytest.raises(HTTPException) as exc_info:
guardrail._filter_single_text("What is blockchain technology?")
assert exc_info.value.status_code == 403

View file

@ -532,55 +532,59 @@ export default function ComplianceUI({
status: "pending",
}));
setTestResults(pendingResults);
try {
const { inputs, guardrail_errors } = await testPoliciesAndGuardrails(
accessToken,
{
policy_names:
selectedPolicies.length > 0 ? selectedPolicies : undefined,
guardrail_names:
selectedGuardrails.length > 0 ? selectedGuardrails : undefined,
inputs: { texts: allTexts },
request_data: {},
input_type: "request",
}
);
const actualResult: "blocked" | "allowed" =
guardrail_errors.length > 0 ? "blocked" : "allowed";
const triggeredBy =
guardrail_errors.length > 0
? guardrail_errors
.map((e) => `${e.guardrail_name}: ${e.message}`)
.join("; ")
: undefined;
const returnedTexts: (string | undefined)[] =
Array.isArray(inputs?.texts) ? inputs.texts : [];
setTestResults(
pendingResults.map((row, index) => ({
...row,
// Send each text individually to get per-text blocked/allowed results.
// Sending all texts in a single batch doesn't work because the guardrail
// raises an HTTPException on the first blocked text, skipping the rest.
const updatedResults = [...pendingResults];
for (let i = 0; i < allTexts.length; i++) {
try {
const { inputs, guardrail_errors } = await testPoliciesAndGuardrails(
accessToken,
{
policy_names:
selectedPolicies.length > 0 ? selectedPolicies : undefined,
guardrail_names:
selectedGuardrails.length > 0 ? selectedGuardrails : undefined,
inputs: { texts: [allTexts[i]] },
request_data: {},
input_type: "request",
}
);
const actualResult: "blocked" | "allowed" =
guardrail_errors.length > 0 ? "blocked" : "allowed";
const triggeredBy =
guardrail_errors.length > 0
? guardrail_errors
.map((e) => `${e.guardrail_name}: ${e.message}`)
.join("; ")
: undefined;
const returnedText =
Array.isArray(inputs?.texts) && inputs.texts.length > 0
? inputs.texts[0]
: undefined;
updatedResults[i] = {
...updatedResults[i],
actualResult,
isMatch:
(row.expectedResult === "fail" && actualResult === "blocked") ||
(row.expectedResult === "pass" && actualResult === "allowed"),
(updatedResults[i].expectedResult === "fail" && actualResult === "blocked") ||
(updatedResults[i].expectedResult === "pass" && actualResult === "allowed"),
triggeredBy,
returnedText: returnedTexts[index],
returnedText,
status: "complete" as const,
}))
);
} catch (err) {
const errorMessage = err instanceof Error ? err.message : String(err);
setTestResults(
pendingResults.map((row) => ({
...row,
};
} catch (err) {
const errorMessage = err instanceof Error ? err.message : String(err);
updatedResults[i] = {
...updatedResults[i],
actualResult: "blocked" as const,
isMatch: false,
triggeredBy: `Error: ${errorMessage}`,
status: "complete" as const,
}))
);
} finally {
setIsRunning(false);
};
}
setTestResults([...updatedResults]);
}
setIsRunning(false);
}, [
accessToken,
selectedPromptIds,