File size: 46,836 Bytes
ee74471 c7afca9 8e73b66 5ebb309 c7afca9 4664994 c7afca9 f269105 b06e07d 1587277 781f0d3 e76ce07 1587277 f4f1a71 ee74471 f4f1a71 8e73b66 f4f1a71 ee74471 1587277 f4f1a71 a855427 5ebb309 ee74471 5ebb309 a855427 1587277 ab83b05 ee74471 c7afca9 ee74471 c7afca9 ee74471 8d7a1e9 c09f094 5ebb309 2379f57 5ebb309 8d7a1e9 5ebb309 8d7a1e9 5ebb309 8d7a1e9 5ebb309 8d7a1e9 f269105 f2c5257 f269105 3a7bff7 f269105 e79f773 f1d5962 e79f773 f269105 e79f773 f269105 e79f773 f269105 e79f773 f269105 e79f773 f269105 e79f773 f269105 e79f773 3a7bff7 e79f773 f269105 e79f773 f269105 e79f773 f269105 e79f773 f269105 2379f57 be39efb 5ebb309 a855427 1587277 be39efb e5d2671 be39efb 086cf42 cdb090f e5d2671 086cf42 6068049 be39efb 086cf42 be39efb 3fe7352 ee74471 8d7a1e9 f1d5962 8d7a1e9 ee74471 2379f57 6093500 5ebb309 8e73b66 ab83b05 6093500 4a1341d 6093500 5ebb309 c7afca9 6093500 5ebb309 73b7507 6093500 8d7a1e9 c09f094 5ebb309 2b6273e 5ebb309 fa93fef 8d7a1e9 1587277 ab83b05 8d7a1e9 5ebb309 8d7a1e9 8e73b66 ab83b05 8d7a1e9 c16e9f5 8e73b66 8d7a1e9 c7afca9 8d7a1e9 8e73b66 8d7a1e9 9bac96a 8d7a1e9 5ebb309 2379f57 5ebb309 2379f57 5ebb309 c7afca9 5ebb309 d026c09 2b6273e 5ebb309 fa93fef 2379f57 fa93fef 5ebb309 2379f57 5ebb309 2379f57 5ebb309 4664994 ab83b05 4664994 c7afca9 4664994 2379f57 4664994 2379f57 4664994 fb4a6dc c09f094 fb4a6dc c09f094 c7afca9 fb4a6dc c7afca9 4c3d0df b06e07d c7afca9 b06e07d c7afca9 b06e07d c7afca9 b06e07d c7afca9 b06e07d c09f094 b06e07d 4c3d0df c7afca9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
import gradio as gr
from classify import judge
from entity import resolve
from graphrag import marketingPlan
from human import email, feedback
from knowledge import graph
from pii import derisk
from rag import rbc_product
from tool import rival_product
from multi import bestPractice
import os
os.system("pip freeze | tee requirements_log.txt")
# Define the Google Analytics script
head = """
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SRX9LDVBCW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-SRX9LDVBCW');
</script>
<!-- Default Statcounter code for kevinhug/ai
https://huggingface.co/spaces/kevinhug/ai -->
<script type="text/javascript">
var sc_project=13123186;
var sc_invisible=1;
var sc_security="c78c54ad";
</script>
<script type="text/javascript"
src="https://www.statcounter.com/counter/counter.js"
async></script>
<noscript><div class="statcounter"><a title="Web Analytics"
href="https://statcounter.com/" target="_blank"><img
class="statcounter"
src="https://c.statcounter.com/13123186/0/c78c54ad/1/"
alt="Web Analytics"
referrerPolicy="no-referrer-when-downgrade"></a></div></noscript>
<!-- End of Statcounter Code -->
<div id="sfclluw49qah2u3f45m49z5c2k3x3h8p458"></div><script type="text/javascript" src="https://counter2.optistats.ovh/private/counter.js?c=lluw49qah2u3f45m49z5c2k3x3h8p458&down=async" async></script><br><a href="https://www.freecounterstat.com">web page counter code</a><noscript><a href="https://www.freecounterstat.com" title="web page counter code"><img src="https://counter2.optistats.ovh/private/freecounterstat.php?c=lluw49qah2u3f45m49z5c2k3x3h8p458" border="0" title="web page counter code" alt="web page counter code"></a></noscript>
<!-- End of https://www.freecounterstat.com/geozoom.php?c=lluw49qah2u3f45m49z5c2k3x3h8p458&base=counter2 Code -->
<script>
fetch('https://ipapi.co/json/')
.then(response => response.json())
.then(data => {
if (data.country_code === 'IN') {
document.body.innerHTML = "<h1>Server Denied</h1><p>Sorry, Server Error.</p>";
}
})
.catch(error => {
console.error('GeoIP lookup failed:', error);
});
</script>
"""
with gr.Blocks(head=head) as demo:
with gr.Tab("Intro"):
gr.Markdown("""
If you're experiencing declining market share, inefficiencies in your operations, here's how I can help:
==============
Marketing & Client Experience
------------
- GraphRAG: Models customer-product relationship networks for next-best-action predictions
- DSPy: Optimizes cross-sell/upsell prompt variations through A/B testing
Risk & Audit
------------
- GraphRAG: Maps transactional relationships into dynamic knowledge graphs to detect multi-layered fraud patterns
- Tool Use: Integrates fraud detection APIs, anomaly scoring models, and regulatory compliance checkers
- DSPy: Optimizes fraud explanation prompts for regulatory reporting
- Explainable AI: Intuitive visualization to help stakeholder understand model risk and flaw
Other Links:
------------
- https://huggingface.co/spaces/kevinhug/clientX
- https://kevinwkc.github.io/davinci/
""")
with gr.Tab("Tool Use Competitive Research"):
gr.Markdown("""
Objective: Persona-Driven Financial Product Recommendations: Unlock Competitive Advantage & Feature Innovation
================================================
- Retrieval: Public Product Data using Tavily Search
- Recommend: Competition Product
### benefits
- remove friction in research, saving labour time
- improve insight quality by identify competitor
""")
in_verbatim = gr.Textbox(label="Verbatim")
out_product = gr.Textbox(label="Product")
gr.Examples(
[
[
"Low APR and great customer service. I would highly recommend if you’re looking for a great credit card company and looking to rebuild your credit. I have had my credit limit increased annually and the annual fee is very low."]
],
[in_verbatim]
)
btn_recommend = gr.Button("Recommend")
btn_recommend.click(fn=rival_product, inputs=in_verbatim, outputs=out_product)
gr.Markdown("""
Example Output
==========
The U.S. Bank Cash+ Visa Secured Card, Capital One Quicksilver Secured Cash Rewards Credit Card, and Bank of America Customized Cash Rewards Secured Credit
Card are all options that may meet the customer's requirements.
Companies in competitive industries are constantly under pressure to innovate—but often face the same challenge:
==================
### 📉 Pain points:
- Unable to identify gaps or opportunities in competitor products in real-time.
- Lack of insight into customer feedback on competitor features.
- Difficulty in predicting how new features will be received in the market.
## 🧩 The real question:
How can your product stay ahead of the competition without a clear understanding of what features your competitors are developing, and how they’re performing with customers?
### 🎯 The customer need:
What businesses really need is a data-driven approach to **competitor product research**, one that can identify trends, uncover feature gaps, and provide actionable insights to drive innovation in product development.
## ✅ Solution: **Competitor Product Research for Feature Development**
By leveraging AI, market intelligence, and competitive analysis tools, you can track competitor launches, analyze user sentiment, and evaluate feature performance across the board. This insight helps shape strategic product decisions—ensuring your team isn't building in the dark.
### 📌 Real-world use cases:
- **Spotify** tracks competitor music features, leveraging insights from users and music trends to introduce features like playlist sharing and collaborative playlists—leading to increased user engagement.
- **Apple** regularly conducts competitor analysis to anticipate and outpace trends, such as implementing health tracking features before they became mainstream in wearables.
- **Slack** uses competitor research to build features that cater to the evolving needs of remote teams, like advanced search functionality and integrations with other tools.
### 💡 Business benefits:
- **Informed product decisions**: Develop features that fill gaps and add value in ways competitors aren’t addressing.
- **Faster time-to-market**: Avoid reinventing the wheel by learning from competitors’ successes and mistakes.
- **Market positioning**: Stay one step ahead of competitors, ensuring your product remains the best solution for your target audience.
With the right competitive research, you don’t just react to the market—you anticipate it.
""")
with gr.Tab("Multi Agent"):
in_verbatim = gr.Textbox(label="Application Security Best Practice on Topic")
out_product = gr.Textbox(label="Best Practice")
gr.Examples(
[
"Docker Containers", "REST API", "Python"
],
[in_verbatim]
)
btn_recommend = gr.Button("Research (Diabled used up all the token for LLM quota)", interactive=False)
btn_recommend.click(fn=bestPractice, inputs=in_verbatim, outputs=out_product)
gr.Markdown("""
Example Output
=============
Based on the provided information from both researchers and security experts, we now have a comprehensive guide on understanding and effectively using Dock
er containers in modern software development. Here's a summary:
### Understanding Docker Containers
- **Overview**: Docker containers provide an efficient way to package applications along with their dependencies into lightweight, portable units.
- **Components**:
- **Architecture**: Docker containers leverage the host system’s kernel, allowing for resource isolation and minimal overhead.
- **Features**: Supports microservices architecture, CI/CD pipelines, development environment consistency, and more.
### Best Practices
1. **Use Official Images**
- Use official images from trusted sources like Docker Hub to minimize security risks.
2. **Keep Your Containers Up-to-Date**
- Regularly update your container images to include the latest security patches and bug fixes.
3. **Limit Privileges**
- Run containers with minimal privileges to reduce potential damage in case of a compromise.
4. **Use Volumes Wisely**
- Be cautious when using volumes, especially for sensitive data.
5. **Secure Network Access**
- Configure network settings carefully to prevent unauthorized access.
6. **Implement Logging and Monitoring**
- Set up logging and monitoring to detect unusual activity early.
7. **Regularly Test Your Containers**
- Periodically test your containerized applications using security scans.
### Common Pitfalls
1. **Using Untrusted Images**
- Only use official or trusted images and verify their integrity.
2. **Running Containers as Root**
- Avoid running containers with root privileges to limit potential risks.
3. **Exposing Sensitive Data Through Volumes**
- Properly manage data volumes to ensure sensitive information is not exposed.
4. **Poor Network Configuration**
- Use Docker networks and firewalls to restrict network traffic.
5. **Lack of Logging and Monitoring**
- Implement robust logging strategies using tools like `docker logs` or centralized log management systems.
### Conclusion
By adhering to these best practices and being aware of common pitfalls, you can significantly enhance the security and efficiency of your Docker container
deployments. This guide should serve as a comprehensive reference for both new and experienced users looking to leverage Docker effectively in their projec
ts.
If there are any specific aspects or components you'd like further details on, feel free to ask!
The faster we build, the higher the risk of introducing vulnerabilities—especially in applications tied to personal banking workflows, where financial fraud can directly impact customer trust.
=====================
Yet most security tools today are reactive, slow, and generic—they don't reflect specific infrastructure, threat profile, or code patterns.
So here’s the core question we should be asking:
How can we turn application security from a bottleneck into a competitive advantage—one that provides developers with fast, context-aware, and proactive feedback tailored to unique environment?
### ✅ Reframed Customer Need
- Developers want actionable feedback during the build process—not after deployment.
- Security teams need to detect and explain vulnerabilities in specific patterns—across containers, APIs, and legacy integrations.
Product & revenue teams need confidence that customer-facing banking apps will not just ship fast—but also protect users and unlock new monetization opportunities.
### 💡 Proposed Solution
Agent Design Pattern: https://x.com/i/status/1940342200216482211
General System Design: https://pbs.twimg.com/media/FuKyiRIaAAEbC5B?format=jpg&name=900x900
A multi-agent GenAI system trained on RBC’s codebase, policy docs, and threat data—
that provides real-time, localized security feedback, explains why something’s a risk, and suggests secure-by-default alternatives.
Agents include:
- Code risk explainer agent: Detects common security flaws (e.g., insecure API calls) and provides context-specific impact analysis.
- Infrastructure policy checker agent: Validates use of containers and deployment patterns against RBC’s internal compliance standards.
- Refactor assistant agent: Suggests how to fix the issue, with references to existing secure modules.
""")
with gr.Tab("Graphrag Marketing"):
gr.Markdown("""
Objective: Develop a Targeted Marketing Plan Aligned with Customer Personas
=======================
- Reasoning from context, answering the question
""")
marketing = """
A business model is not merely a static description but a dynamic ecosystem defined by five interdependent pillars:
Value Creation (What you sell): The core offering must solve a critical pain point or unlock untapped demand. This is the foundation of your value proposition—quantifiable (e.g., cost efficiency) or qualitative (e.g., exceptional user experience)—that differentiates you in the market.
Delivery Infrastructure (How you deliver): Channels and partnerships must align to ensure seamless access to your offering. For instance, a SaaS company might leverage cloud platforms for instant scalability, while a luxury brand prioritizes exclusive retail partnerships.
Customer Lifecycle Dynamics:
Acquisition: How do users discover you? Channels like organic search (SEO), targeted ads, or influencer partnerships must map to your customer segments’ behaviors.
Activation: Do first-time users experience immediate value? A fitness app, for example, might use onboarding tutorials to convert sign-ups into active users.
Retention: Is engagement sustained? Metrics like churn rate and CLV reveal whether your model fosters loyalty through features like personalized content or subscription perks.
Referral: Do users become advocates? Incentivize sharing through referral programs or viral loops (e.g., Dropbox’s storage rewards).
Revenue Architecture (How you monetize): Align pricing models (subscriptions, freemium tiers) with customer willingness-to-pay. For instance, a niche market might sustain premium pricing, while a mass-market product prioritizes volume.
Cost Symmetry: Every activity—from R&D to customer support—must balance against revenue streams. A low-cost airline, for example, optimizes for operational efficiency to maintain profitability.
Strategic Imperatives for Modern Business Models
Systemic Integration: Ohmae’s “3C’s” (Customer, Competitor, Company) remind us that acquisition channels and value propositions must adapt to shifting market realities. For instance, a retailer might pivot from brick-and-mortar to hybrid models post-pandemic.
Data-Driven Iteration: Use AARRR metrics to identify leaks in the funnel. If activation rates lag, refine onboarding; if referrals stagnate, enhance shareability.
Scalability through Partnerships: Key partners (e.g., tech vendors, logistics providers) can reduce overhead while expanding reach—critical for transitioning from niche to mass markets.
By framing each component as a strategic variable rather than a fixed element, businesses can continuously adapt to disruptions—a necessity in Ohmae’s vision of fluid, customer-first strategy.
"""
in_verbatim = gr.Textbox(label="Context", value=marketing, visible=False)
in_question = gr.Textbox(label="Persona")
out_product = gr.Textbox(label="Plan")
gr.Examples(
[
[
"""
Low APR and great customer service. I would highly recommend if you’re looking for a great credit card company and looking to rebuild your credit. I have had my credit limit increased annually and the annual fee is very low.
"""]
],
[in_question]
)
btn_recommend = gr.Button("Reasoning")
btn_recommend.click(fn=marketingPlan, inputs=[in_verbatim, in_question], outputs=out_product)
gr.Markdown("""
Example Output
==============
To create a marketing campaign that improves customer acquisition, activation, retention, and referral for the given persona, I'll outline a strategy based on the provided information.
**Campaign Name:** "Rebuild with Confidence"
**Objective:** To attract individuals looking to rebuild their credit, provide excellent customer service, and offer competitive APRs, ultimately increasing customer loyalty and referrals.
**Target Audience:** Individuals with poor or fair credit scores, seeking to rebuild their credit and enjoy low APRs and great customer service.
**Customer Acquisition:**
1. **Social Media Campaigns:** Utilize platforms like Facebook, Instagram, and Twitter to target individuals with poor or fair credit scores. Create engaging ads highlighting the benefits of rebuilding credit with our credit card company.
2. **Influencer Partnerships:** Collaborate with personal finance influencers and bloggers to promote our credit card company as a reliable option for credit rebuilding.
3. **Online Advertising:** Run targeted Google Ads and sponsored content on websites focused on personal finance, credit repair, and rebuilding credit.
**Customer Activation:**
1. **Welcome Package:** Send a personalized welcome package to new customers, including a comprehensive guide to rebuilding credit, a credit score tracker, and a dedicated customer service contact.
2. **Onboarding Process:** Implement a seamless onboarding process, ensuring new customers can easily activate their credit card and start using it to rebuild their credit.
3. **Education and Resources:** Provide access to educational resources, such as webinars, videos, and blog posts, to help customers understand credit rebuilding strategies and best practices.
**Customer Retention:**
1. **Regular Communication:** Send regular updates on customers' credit score progress, highlighting their achievements and offering tips for continued improvement.
2. **Annual Credit Limit Increases:** Continue to increase customers' credit limits annually, as mentioned in the persona's review, to demonstrate our commitment to their credit rebuilding journey.
3. **Exclusive Offers:** Provide exclusive offers and promotions to loyal customers, such as reduced APRs or special rewards programs.
**Customer Referral:**
1. **Referral Program:** Launch a referral program that rewards customers for referring friends and family who successfully rebuild their credit with our credit card company.
2. **Social Proof:** Encourage satisfied customers to share their positive experiences on social media, using a branded hashtag to track and showcase their success stories.
3. **Incentives:** Offer incentives, such as cash rewards or premium benefits, to customers who refer multiple friends and family members who successfully rebuild their credit.
**Budget Allocation:**
1. **Social Media and Influencer Marketing:** 30%
2. **Online Advertising:** 25%
3. **Welcome Package and Onboarding Process:** 15%
4. **Education and Resources:** 10%
5. **Referral Program and Incentives:** 10%
**Timeline:**
1. **Month 1-3:** Launch social media campaigns, influencer partnerships, and online advertising.
2. **Month 4-6:** Implement welcome package and onboarding process, and begin providing education and resources.
3. **Month 7-9:** Launch referral program and incentives.
4. **Month 10-12:** Analyze results, adjust strategies, and plan for future campaigns.
By following this campaign strategy, we can effectively attract and retain customers who are looking to rebuild their credit, while also encouraging referrals and promoting our credit card company as a trusted and reliable option.
Benefits of a Marketing Campaign Generator
===============
- Accelerated Campaign Launches
Quickly generates tailored campaigns, reducing go-to-market time from weeks to hours.
- Improved Targeting & Personalization
Uses customer data and behavior to craft messages that resonate with specific segments.
""")
with gr.Tab("Personalized KG"):
gr.Markdown("""
Objective: Transform Personal Pain Points into Actionable Insights with a Dynamic Knowledge Graph Framework
=====================================
- Identify what channel customer prefer
""")
in_verbatim = gr.Textbox(label="Question")
out_product = gr.JSON(label="Knowledge Graph")
gr.Examples(
[
[
"""
Representative: "Thank you for calling Goldman Sachs Credit Card Services. My name is Sarah. May I have your full name and the last 4 digits of your card number for verification?"
Customer: "This is Michael Chen, card ending 5402."
Representative: "Thank you, Mr. Chen. I show you have an Apple Card account opened in 2023. How can I assist you today?" (Reference: Search Result Apple Card context)
Customer: "I'm disputing a $329 charge from TechElectronics from March 15th. I never received the item."
Representative: "I understand your concern. Let me initiate a dispute investigation. Per our process (Search Result BBB complaint handling):
We'll apply a temporary credit within 24 hours
Our team will contact the merchant
You'll receive email updates at michael.chen@email.com
Final resolution within 60 days
Would you like me to proceed?"
Customer: "Yes, but what if they fight it?"
Representative: "If the merchant disputes your claim, we'll:
Review all evidence using our 3-phase verification system (Search Result multi-stage investigation)
Consider your purchase protection benefits
Escalate to senior specialists if needed
For security, never share your CVV (339) or full card number with callers. Always call back using the number on your physical card (Search Result scam warning)."
Customer: "Can I make a partial payment on my balance while this is pending?"
Representative: "Absolutely. We offer:
"minimum_payment": "$35 due April 25",
"hardship_program": "0% APR for 6 months",
"custom_plan": "Split $600 balance over 3 months"
Would you like to enroll in any of these?"
Customer: "The 3-month plan, please."
Representative: "Confirmed. Your next payment of $200 will process May 1st. A confirmation email with dispute case #GS-2025-0422-8830 is being sent now. Is there anything else?"
Customer: "No, thank you."
"""
]
],
[in_verbatim]
)
btn_recommend = gr.Button("Graph It!")
btn_clear = gr.ClearButton(components=[out_product])
btn_recommend.click(fn=graph, inputs=[in_verbatim, out_product], outputs=out_product)
gr.Markdown("""
Example Output
==============
```
{'edges': [{'color': 'black', 'label': 'hasAccount', 'source': 1, 'target': 2},
{'color': 'black',
'label': 'disputeCaseIsFor',
'source': 1,
'target': 5},
{'color': 'black', 'label': 'causedBy', 'source': 3, 'target': 4},
{'color': 'black',
'label': 'hasChargeDispute',
'source': 2,
'target': 4}],
'nodes': [{'color': 'orange',
'id': 4,
'label': '$329 Charge Dispute',
'record_date': datetime.date(2023, 3, 15)},
{'color': 'orange',
'id': 2,
'label': 'Apple Card',
'record_date': datetime.date(2023, 4, 5)},
{'color': 'orange',
'id': 5,
'label': 'GS-2025-0422-8830',
'record_date': datetime.date(2023, 4, 5)},
{'color': 'orange',
'id': 3,
'label': 'TechElectronics',
'record_date': datetime.date(2023, 3, 15)},
{'color': 'orange',
'id': 1,
'label': 'Michael Chen',
'record_date': datetime.date(2023, 4, 5)}]}
```
Example of Customer Profile in Graph
=================






#### Customer Needs and Pain Points
https://i.postimg.cc/D03Sstqd/knowledge-graph1.png
#### Accumulated Interaction for the same Customer Needs and Pain Points
https://i.postimg.cc/9ffZQ5pD/knowledge-graph2.png
Benefits of a Knowledge Graph
============
- Smarter Data Relationships
Connects siloed data across domains to create a holistic, contextual view.
- Improved Search & Discovery
Enables semantic search—understanding meaning, not just keywords.
- Enhanced Decision-Making
Surfaces hidden patterns and relationships for better analytics and insights.
- Data Reusability
Once created, knowledge graphs can be repurposed across multiple use cases (e.g., search, recommendation, fraud detection).
""")
with gr.Tab("Segmentation"):
gr.Markdown("""
Objective: Streamline Customer Insights: Auto-Classify Feedback for Product Optimization
================================================
- multi class classification, could have multiple label for 1 feedback
- fix classification in this use case: online banking, card, auto finance, mortgage, insurance
- LLM Judge to evaluate relevancy
Business use case: customer segmentation for ab testing
------------------------------------------------
- Acquisition: Behavior cluster, we can predict not only who is likely to click—but who is likely to retain
- Activation: segmenting users based on behavioral signals—like browsing activity, time since last engagement, or declining open/click rates.
""")
in_verbatim = gr.Textbox(label="Customer Feedback separate by ;")
out_product = gr.Textbox(label="Classification & Evaluation")
gr.Examples(
[
[
"""
"The online portal makes managing my mortgage payments so convenient.";
"RBC offer great mortgage for my home with competitive rate thank you";
"Low interest rate compared to other cards I’ve used. Highly recommend for responsible spenders.";
"The mobile check deposit feature saves me so much time. Banking made easy!";
"Affordable premiums with great coverage. Switched from my old provider and saved!"
"""
]
],
[in_verbatim]
)
btn_recommend = gr.Button("Classify & Evaluation")
btn_recommend.click(fn=judge, inputs=in_verbatim, outputs=out_product)
gr.Markdown("""
Example Output
===========
```
{
"texts": [
"\"The online portal makes managing my mortgage payments so convenient.\"",
"\"RBC offer great mortgage for my home with competitive rate thank you\"",
"\"Low interest rate compared to other cards I’ve used. Highly recommend for responsible spenders.\"",
"\"The mobile check deposit feature saves me so much time. Banking made easy!\"",
"\"Affordable premiums with great coverage. Switched from my old provider and saved!\""
],
"predictions": [
[
{
"chain_of_thought": [
"The customer mentions managing mortgage payments online, which directly relates to the 'online' tag.",
"There is no mention or implication of card, cars, insurance, or any other tags in the text."
],
"name": "online",
"id": 0,
"confidence": 1.0
}
],
[
{
"chain_of_thought": [
"The customer explicitly mentions 'mortgage for my home', which directly corresponds to the tag name 'mortgage'.",
"There is no mention of online, card, cars, or insurance in the text.",
"Therefore, we can confidently apply the mortgage tag."
],
"name": "mortgage",
"id": 3,
"confidence": 1.0
}
],
[
{
"chain_of_thought": [
"The customer mentions a low interest rate and compares it to other cards they have used. This indicates the text is related to a card product.",
"There is no mention of online services, cars, mortgage, or insurance in the text."
],
"name": "card",
"id": 1,
"confidence": 0.9
}
],
[
{
"chain_of_thought": [
"The customer explicitly mentions the mobile check deposit feature which is related to online banking services.",
"There is a Tag with id 0 named 'online' that matches the content of the text."
],
"name": "online",
"id": 0,
"confidence": 1.0
}
],
[
{
"chain_of_thought": [
"The customer mentions 'premiums' and 'coverage', which are related to insurance products. There is a tag named 'insurance' with id 4, so we can
tag this text with 'insurance'.",
"There's no mention of online services, cards, cars, or mortgages in the text."
],
"name": "insurance",
"id": 4,
"confidence": 0.9
}
]
],
"judgment": [
[
{
"thought": "The reasoning states that the customer mentioned managing mortgage payments online. The answer provided is 'online'. Since the context
explicitly stated that the topic was about online management, it logically follows that 'online' would be the correct and relevant response.",
"justification": "The reasoning directly connects the mention of 'managing mortgage payments online' to the answer 'online', making the logic sound
. There are no other tags or concepts mentioned that could have influenced this answer, so the connection is clear and valid.",
"logical": true
}
],
[
{
"thought": "<thought>Given that the reasoning explicitly states 'mortgage for my home' and directly corresponds to the tag name 'mortgage', and the
re's no mention of other financial products like online, card, cars, or insurance, it is logical to conclude that the answer 'mortgage' is correct. The con
text provided supports this by not contradicting the reasoning.</thought>",
"justification": "<justification>The reasoning clearly states a direct match between the customer's statement and the tag name 'mortgage'. There ar
e no conflicting elements in the text, making the connection sound and valid. Therefore, it is logical that the answer 'mortgage' is relevant to the given
context.</justification>",
"logical": true
}
],
[
{
"thought": "<thought>Given that the reasoning states there's a low interest rate mentioned and comparison to other cards, it logically follows that
'card' would be an appropriate answer. The context, although incomplete, aligns with the reasoning as it pertains to card products.</thought>",
"justification": "<justification>The reasoning correctly identifies the topic of discussion (cards) based on key phrases like 'low interest rate' a
nd 'comparison to other cards'. Since the answer provided is 'card', which directly corresponds to this context, the logical connection between the reasoni
ng and the answer is valid.</justification>",
"logical": true
}
],
[
{
"thought": "The reasoning states that the customer mentioned the mobile check deposit feature, which is related to online banking services. The con
text provided a tag with id '0' named 'online', and the answer given is 'online'. This directly matches the content of the text, making it relevant.",
"justification": "Since the context provides a clear connection between the customer's mention of mobile check deposit (related to online banking)
and the tag 'online', the answer 'online' is logically derived from this reasoning. The direct match in terms of content makes the logical link valid and s
ound.",
"logical": true
}
],
[
{
"thought": "<thought> The reasoning states that the context mentions 'premiums' and 'coverage', which are related to insurance. It also notes the p
resence of an 'insurance' tag with id 4, suggesting this should be tagged as such. The answer provided is 'insurance', directly matching the reasoning's co
nclusion. There is no mention in the text or reasoning that contradicts this.</thought>",
"justification": "<justification> The reasoning and the answer are logically consistent because they both point to the same key term, 'insurance'.
The presence of relevant terms like 'premiums' and 'coverage', along with the explicit tag reference, support a logical connection between the context and
the answer. There is no indication that any other services or products mentioned in the reasoning (like online services, cards, cars, or mortgages) are pre
sent in the text.</justification>",
"logical": true
}
]
]
}
```
Benefits of Multi Class Classification
==================
- Precision Decision-Making
Automates complex categorization tasks (e.g., loan risk tiers, transaction types) with >90% accuracy, reducing human bias.
- Operational Efficiency
Processes 10,000+ transactions/cases per minute vs. hours manually (e.g., JP Morgan’s COiN platform reduced 360k loan doc hours to seconds).
- Risk Mitigation
Proactively flags 5+ fraud types (identity theft, money laundering) with 40% fewer false positives than rule-based systems.
- Regulatory Compliance
Auto-classifies documents for FINRA/SEC audits (e.g., Morgan Stanley uses NLP to categorize 3M+ annual communications into 50+ compliance buckets).
""")
with gr.Tab("Call Resolution"):
gr.Markdown("""
Objective: Proactive Entity Mapping: Clarifying Critical Elements in Complex Call Analysis for Strategic Insight
================================================
- Graph relationship between entity
- summary of the interaction
""")
in_verbatim = gr.Textbox(label="Content")
out_product = gr.Textbox(label="Entity Resolution")
gr.Examples(
[
["""
Representative: "Thank you for calling Goldman Sachs Credit Card Services. My name is Sarah. May I have your full name and the last 4 digits of your card number for verification?"
Customer: "This is Michael Chen, card ending 5402."
Representative: "Thank you, Mr. Chen. I show you have an Apple Card account opened in 2023. How can I assist you today?" (Reference: Search Result Apple Card context)
Customer: "I'm disputing a $329 charge from TechElectronics from March 15th. I never received the item."
Representative: "I understand your concern. Let me initiate a dispute investigation. Per our process (Search Result BBB complaint handling):
We'll apply a temporary credit within 24 hours
Our team will contact the merchant
You'll receive email updates at michael.chen@email.com
Final resolution within 60 days
Would you like me to proceed?"
Customer: "Yes, but what if they fight it?"
Representative: "If the merchant disputes your claim, we'll:
Review all evidence using our 3-phase verification system (Search Result multi-stage investigation)
Consider your purchase protection benefits
Escalate to senior specialists if needed
For security, never share your CVV (339) or full card number with callers. Always call back using the number on your physical card (Search Result scam warning)."
Customer: "Can I make a partial payment on my balance while this is pending?"
Representative: "Absolutely. We offer:
"minimum_payment": "$35 due April 25",
"hardship_program": "0% APR for 6 months",
"custom_plan": "Split $600 balance over 3 months"
Would you like to enroll in any of these?"
Customer: "The 3-month plan, please."
Representative: "Confirmed. Your next payment of $200 will process May 1st. A confirmation email with dispute case #GS-2025-0422-8830 is being sent now. Is there anything else?"
Customer: "No, thank you."
"""]
],
[in_verbatim]
)
btn_recommend = gr.Button("Resolve")
btn_recommend.click(fn=resolve, inputs=in_verbatim, outputs=out_product)
gr.Markdown("""
Example of Call Resolution
===============



Resolution for Clear Picture about Customer Issue
https://i.postimg.cc/J4qsDYtZ/entity.png
Companies like RBC, Comcast, or BMO often face a recurring challenge: long, complex customer service calls filled with vague product references, overlapping account details, and unstructured issue descriptions. This makes it difficult for support teams and analytics engines to extract clear insights or resolve recurring pain points across accounts and products.
#### How can teams automatically stitch together fragmented mentions of the same customer, product, or issue—across call transcripts, CRM records, and support tickets—to form a unified view of the actual problem?
That's where Entity Resolution comes in. By linking related entities hidden across data silos and messy text (like "my internet box" = "ARRIS TG1682G" or "John Smith, J. Smith, and js456@gmail.com"), teams gain a clearer, contextual understanding of customer frustration in real-time.
For example, Comcast reduced repeat service calls by 17% after deploying entity resolution models on long call transcripts—turning messy feedback into actionable product insights and faster resolutions.
### The result? Less agent time lost, higher customer satisfaction, and data pipelines that actually speak human.
""")
with gr.Tab("Human Feedback Content"):
gr.Markdown("""
Objective: Leveraging Human Feedback to Deliver Personalized Content that Proactively Solves Customer Pain Points
================================================
- replace human with reward/penalty function, you will get RLHF by ranking the solutions
""")
in_verbatim = gr.Textbox(label="Persona")
in_campaign = gr.Textbox(label="campaign")
out_product = gr.Textbox(label="Your Personalized Email Campaign Bot")
gr.Examples(
[
[
"""My mortgage was assumed by Bank of America when Countrywide mortgages ceased to do business. My mortgage increased without any explanation. When I inquired, they stumbled and gave me the run around. I’d NEVER do business with Bank of America again""",
"MORT"],
["my credit card limit is too low, I need a card with bigger limit and low fee", "CARD"]
],
[in_verbatim, in_campaign]
)
btn_recommend = gr.Button("Personalized Email")
btn_recommend.click(fn=email, inputs=[in_verbatim, in_campaign, out_product], outputs=out_product)
h_feedback = gr.Radio(['approved', 'rejected'], label="Human Feedback", info="Which campaign you want to approve?")
h_campaign = gr.Textbox(label="campaign")
btn_deliver = gr.Button("Deliver?")
btn_deliver.click(fn=feedback, inputs=[h_feedback, h_campaign, out_product], outputs=out_product)
gr.Markdown("""
Human Feedback for Personalized Content enables brands like Mr. Cooper to analyze customer preferences and pain points, then deliver tailored solutions. By embedding real-time feedback loops, they created personalized mortgage-refinancing videos showcasing individual home equity data and financial goals, resulting in 18% higher engagement and 12% lower churn.
#### Outcome:
- Dynamic content adaptation based on behavioral data (e.g., Hilton Honors’ app reduced booking friction by 40% via predictive analytics)
- Proactive problem-solving (e.g., Orangetheory Fitness used workout metrics to boost class attendance to 97%)
- 52% faster ROI through AI-driven personalization scaling
### Ready to turn customer frustrations into loyalty drivers with content that feels personally crafted?
This approach aligns with best-in-class use cases where feedback-driven personalization drives measurable business growth
""")
with gr.Tab("RAG Recommender"):
gr.Markdown("""
Objective: Dynamic RBC Product Recommender: Personalize Offers Using Customer Persona Insights
================================================
- Retrieval: Public RBC Product Data, other massive dataset: customers data
- Recommend: RBC Product
##### __free tier hosting system limitation for this use case__
- cannot use any workable embedding model due to big size
- this is not functioning correctly since I just replace embedding with a random matrix.
- it will work under normal environment.
##### Potential Optimization
BM25 reranking using keyword
""")
in_verbatim = gr.Textbox(label="Verbatim")
out_product = gr.Textbox(label="Product")
gr.Examples(
[
[
"Low APR and great customer service. I would highly recommend if you’re looking for a great credit card company and looking to rebuild your credit. I have had my credit limit increased annually and the annual fee is very low."]
],
[in_verbatim]
)
btn_recommend = gr.Button("Recommend (disabled due to embedding too big for download in huggingface)", interactive=False)
btn_recommend.click(fn=rbc_product, inputs=in_verbatim, outputs=out_product)
gr.Markdown("""
Example Output
===========
RBC Newcomer Mortgage
Companies pour millions into product catalogs, marketing funnels, and user acquisition—yet many still face the same challenge:
==================
### 📉 Pain points:
- High bounce rates and low conversion despite heavy traffic
- Customers struggle to find relevant products on their own
- One-size-fits-all promotions result in wasted ad spend and poor ROI
### 🧩 The real question:
What if your product catalog could *adapt itself* to each user in real time—just like your best salesperson would?
### 🎯 The customer need:
Businesses need a way to dynamically personalize product discovery, so every customer sees the most relevant items—without manually configuring hundreds of rules.
## ✅ Enter: Product Recommender Systems
By analyzing behavioral data, preferences, and historical purchases, a recommender engine surfaces what each user is most likely to want—boosting engagement and revenue.
### 📌 Real-world use cases:
- **Amazon** attributes up to 35% of its revenue to its recommender system, which tailors the home page, emails, and checkout cross-sells per user.
- **Netflix** leverages personalized content recommendations to reduce churn and increase watch time—saving the company over $1B annually in retention value.
- **Stitch Fix** uses machine learning-powered recommendations to curate clothing boxes tailored to individual style profiles—scaling personal styling.
### 💡 Business benefits:
- Higher conversion rates through relevant discovery
- Increased average order value (AOV) via cross-sell and upsell
- Improved retention and lower customer acquisition cost (CAC)
If your product discovery experience isn’t working as hard as your marketing budget, it’s time to make your catalog intelligent—with recommendations that convert.
""")
with gr.Tab("Eval"):
gr.Markdown("""
🏦 LLM Eval for Application Security in Personal Banking
====================
What happens when your generative AI exposes customer data before you even launch?
The push toward personalized digital experiences is powered by generative AI. But with that innovation comes a hidden risk: insecure prompt logic, hallucinated outputs, and untested model behavior can expose sensitive financial information—undermining customer trust and inviting regulatory scrutiny.
### 🔒 LLM evaluations aren’t just a technical safeguard—they're a business enabler. By proactively identifying vulnerabilities in AI-generated content and application logic, LLM evals help teams launch secure, compliant personal banking apps.
#### ✅ Outcome: At one Tier-1 Canadian bank, I built a cross-functional model risk pipeline that automated LLM testing—catching data leaks and unsafe outputs before deployment. The result: fewer post-launch incidents, smoother audits, and accelerated go-to-market timelines.
https://postimg.cc/3WtG4ZK2
### Whether the goal is to reduce fraud, streamline compliance reviews, or optimize AI-generated product recommendations—LLM evals give business, risk, and engineering teams a shared lens on safety, explainability, and performance.
How confident are you that your generative AI app won’t hallucinate its way into a privacy breach?
""")
with gr.Tab("PII Guardrail"):
gr.Markdown("""
Objective: Automated PII Data Removal: Proactive Compliance & Risk Mitigation
================================================
""")
in_verbatim = gr.Textbox(label="Peronal Info")
out_product = gr.Textbox(label="PII")
gr.Examples(
[
[
"""
He Hua (Hua Hua) Director
hehua@chengdu.com
+86-28-83505513
Alternative Address Format:
Xiongmao Ave West Section, Jinniu District (listed in some records as 610016 postcode)
"""
]
],
[in_verbatim]
)
btn_recommend = gr.Button("Mask PII")
btn_recommend.click(fn=derisk, inputs=in_verbatim, outputs=out_product)
gr.Markdown("""
Example Output
=========
GUARDRAILED:
He Hua (<PERSON>) Director
hehua@chengdu.com
<PHONE_NUMBER>
Alternative Address Format:
Xiongmao Ave West Section, Jinniu District (listed in some records as 610016 postcode)
Best Viewing: Before 9:00 AM during summer hours (7:30 AM-5:00 PM)
Caretaker: <Caretaker_0>"Grandpa <PERSON>")
Additional Contacts
Charitable Donations: <PHONE_NUMBER>
Dining Reservations: <PHONE_NUMBER>
"Is your personal banking AI trained on customer conversations—or customer identities?"
===========
At RBC, generative AI is transforming personal banking—from real-time support to automated financial advice. But the same customer data powering these insights can expose the bank to regulatory violations, data breaches, and biased models—especially when names, emails, and phone numbers slip through into training or inference pipelines.
### 🔍 Entity removal solves this by automatically detecting and anonymizing personal identifiers before data is used for training, fine-tuning, or analysis.
#### ✅ Outcome: In one internal audit scenario, a Tier-1 bank uncovered PII exposure in over 12% of its chatbot training data. By integrating entity removal, the bank reduced privacy risk, aligned with GDPR and CPPA compliance—and increased the usable volume of safe, structured text by 35%.
### The benefits go beyond compliance:
- Reduce financial crime by safely leveraging more chat logs and support tickets to train fraud detection systems without compromising privacy.
- Optimize internal processes by focusing NLP models on customer intent rather than noisy identifiers.
- Boost revenue by extracting clean, actionable signals from anonymized product inquiries and complaints—fueling more accurate product recommendations.
Are your AI systems learning from customer insights—or leaking customer identities in the process?
""")
demo.launch(allowed_paths=["."])
|