File size: 21,523 Bytes
ee74471
 
 
9ef3b6b
6093500
1587277
8e73b66
5ebb309
1587277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4f1a71
ee74471
f4f1a71
 
8e73b66
f4f1a71
 
 
 
 
 
 
 
 
 
 
 
ee74471
1587277
 
f4f1a71
a855427
5ebb309
ee74471
5ebb309
a855427
1587277
 
8361559
 
 
 
ee74471
 
 
 
 
 
 
 
 
 
 
 
 
 
1587277
5ebb309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d7a1e9
5ebb309
 
 
 
8d7a1e9
5ebb309
 
 
 
8d7a1e9
5ebb309
1587277
 
5ebb309
ee74471
5ebb309
a855427
1587277
 
ee74471
 
 
 
 
 
 
 
 
 
 
 
 
8d7a1e9
5ebb309
 
 
 
 
 
 
 
 
 
 
 
 
 
8d7a1e9
5ebb309
8d7a1e9
5ebb309
 
 
 
8d7a1e9
5ebb309
 
 
 
 
 
8d7a1e9
5ebb309
be39efb
5ebb309
a855427
1587277
be39efb
e5d2671
 
be39efb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
086cf42
cdb090f
e5d2671
086cf42
6068049
be39efb
 
 
086cf42
be39efb
 
 
 
 
 
3fe7352
ee74471
8d7a1e9
 
 
 
 
 
 
 
 
ee74471
5ebb309
6093500
5ebb309
8e73b66
6093500
 
4a1341d
6093500
 
 
 
5ebb309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6093500
 
 
 
 
5ebb309
73b7507
6093500
5ebb309
8d7a1e9
5ebb309
 
2b6273e
 
5ebb309
8d7a1e9
 
 
 
 
 
 
 
 
 
 
 
 
 
1587277
5ebb309
1587277
5ebb309
1587277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d7a1e9
 
 
 
 
 
 
 
 
 
 
 
1587277
8d7a1e9
5ebb309
8d7a1e9
5ebb309
8d7a1e9
8e73b66
 
 
8d7a1e9
c16e9f5
8e73b66
8d7a1e9
 
 
 
 
8e73b66
 
8d7a1e9
 
 
 
 
 
 
 
8e73b66
 
8d7a1e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ebb309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d026c09
2b6273e
5ebb309
 
 
 
 
 
 
 
 
 
 
6093500
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
import gradio as gr
from rag import rbc_product
from tool import rival_product
from graphrag import marketingPlan
from knowledge import graph
from pii import derisk
from classify import judge
from entity import resolve

# 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>
"""

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("RAG Recommender"):
    gr.Markdown("""
    Objective: Dynamic RBC Product Recommender: Personalize Offers Using Customer Persona Insights
    ================================================
    - Retrieval: Public RBC Product Data
    - Recommend: RBC Product 
    
    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")
    btn_recommend.click(fn=rbc_product, inputs=in_verbatim, outputs=out_product)

    gr.Markdown("""
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("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 
    """)
    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("""
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("Graphrag Marketing Plan"):
    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("""
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 Knowledge Graph"):
    gr.Markdown("""
Objective: Transform Personal Pain Points into Actionable Insights with a Dynamic Knowledge Graph Framework
=====================================
    """)
    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 [email protected]

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 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("PII Audit"):
    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
        [email protected]
        +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("""
Benefits of Entity Removal
==================
- Data Privacy & Compliance
Ensures sensitive information (names, emails, phone numbers, etc.) is anonymized to comply with GDPR, HIPAA, or other regulations.

- Improved Data Quality
Removes noise (e.g., irrelevant names or addresses) to make datasets cleaner and more usable for modeling or analysis.

- Enhanced Focus for NLP Models
Allows downstream tasks (like sentiment analysis or topic modeling) to focus on content rather than personal identifiers.
    """)


  with gr.Tab("Classify & Guardrail"):
    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
    """)
    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("""
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("Resolution for Call Center"):
    gr.Markdown("""
    Objective: Proactive Entity Mapping: Clarifying Critical Elements in Complex Call Analysis for Strategic Insight
    ================================================
    """)
    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 [email protected]

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 [email protected]"), 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.
    """)
demo.launch(allowed_paths=["./"])