ग्राहक संदर्भ और इतिहास प्रबंधन
पिछली खरीदारी, टिकटों और प्राथमिकताओं के आधार पर वैयक्तिकृत उत्तर।
ग्राहक संदर्भ और इतिहास प्रबंधन, CoddyKit पर AI एजेंट का एक निःशुल्क पाठ है। यह 4 में से 4वाँ पाठ है। आप नीचे पूरा पाठ निःशुल्क पढ़ सकते हैं—फिर अंतर्निहित कोड संपादक और 24/7 एआई ट्यूटर के साथ ब्राउज़र में इसका व्यावहारिक अभ्यास कर सकते हैं। यह AI एजेंट सीखने के मार्ग का हिस्सा है और आपकी प्रगति वेब तथा CoddyKit ऐप पर सिंक होती रहती है। AI एजेंट पाठ्यक्रम में कुल 4 पाठ शामिल हैं।
संदर्भ एजेंटों को मानवीय क्यों महसूस कराता है
साधारण और उत्कृष्ट ग्राहक सेवा एजेंट के बीच अंतर संदर्भ का होता है। जब कोई एजेंट कहता है, 'मैं देख रहा हूँ कि आपकी सदस्यता अगले सप्ताह नवीनीकृत होगी — क्या आप उससे पहले इसे रोकना चाहेंगे?', तो ग्राहक को लगता है कि उसे पहचाना और समझा गया है, न कि केवल प्रक्रिया से गुज़ारा गया है।
इस पाठ में आपके एजेंटों के लिए एक समृद्ध ग्राहक संदर्भ परत बनाने का तरीका बताया गया है।
ग्राहक प्रोफ़ाइल का ढाँचा
एक मानक ग्राहक प्रोफ़ाइल परिभाषित करें, जो कई स्रोतों से डेटा एकत्र करती हो। हर बातचीत की शुरुआत में एजेंट को यह डिक्शनरी प्राप्त होती है।
from dataclasses import dataclass, field
from datetime import date
@dataclass
class CustomerProfile:
customer_id: str
name: str
email: str
join_date: date
subscription_tier: str # 'free', 'pro', 'enterprise'
account_age_days: int
lifetime_value_usd: float
previous_tickets: list[dict] = field(default_factory=list)
recent_purchases: list[dict] = field(default_factory=list)
preferences: dict = field(default_factory=dict)
@property
def is_long_term_customer(self) -> bool:
return self.account_age_days > 365
if __name__ == '__main__':
from datetime import date
profile = CustomerProfile(
customer_id='cust_1', name='Jane Doe', email='jane@example.com',
join_date=date(2023, 1, 15), subscription_tier='pro',
account_age_days=400, lifetime_value_usd=1250.50,
)
print(f'{profile.name} ({profile.subscription_tier}) - long-term customer: {profile.is_long_term_customer}')
खरीदारी इतिहास प्राप्त करना
अपने ई-कॉमर्स बैकएंड से पिछले N ऑर्डर प्राप्त करें। ऑर्डर की तारीख, आइटम, कुल राशि और स्थिति शामिल करें। इससे एजेंट को पता चलता है कि ग्राहक ने क्या खरीदा है और क्या हाल के ऑर्डर में कोई समस्या है।
import requests
SHOP_API = 'https://api.yourshop.com'
SHOP_KEY = 'YOUR_SHOP_API_KEY'
def get_purchase_history(customer_id: str, limit: int = 10) -> list[dict]:
resp = requests.get(
f'{SHOP_API}/customers/{customer_id}/orders',
headers={'Authorization': f'Bearer {SHOP_KEY}'},
params={'limit': limit, 'sort': '-created_at'}
)
resp.raise_for_status()
orders = resp.json()['orders']
return [
{
'order_id': o['id'],
'date': o['created_at'][:10],
'total_usd': o['total'],
'status': o['status'],
'items': [i['name'] for i in o['line_items']]
}
for o in orders
]पिछले सहायता टिकट प्राप्त करना
बार-बार होने वाली समस्याओं को समझने के लिए पिछले N सहायता टिकट प्राप्त करें। यदि ग्राहक की एक ही समस्या तीन बार हल की जा चुकी है, तो यह उत्पाद की समस्या है—इसे उचित रूप से उच्च स्तर पर भेजें और संकेतित करें।
def get_support_history(customer_id: str, limit: int = 5) -> list[dict]:
resp = requests.get(
f'{SHOP_API}/customers/{customer_id}/tickets',
headers={'Authorization': f'Bearer {SHOP_KEY}'},
params={'limit': limit, 'sort': '-created_at'}
)
resp.raise_for_status()
tickets = resp.json()['tickets']
return [
{
'ticket_id': t['id'],
'subject': t['subject'],
'status': t['status'],
'resolved': t.get('resolved_at', ''),
'category': t.get('category', 'general')
}
for t in tickets
]
def has_recurring_issue(tickets: list[dict], category: str) -> bool:
return sum(1 for t in tickets if t['category'] == category) >= 3सदस्यता स्तर और स्थिति पढ़ना
सदस्यता स्तर यह निर्धारित करता है कि ग्राहक किन सुविधाओं का हकदार है। अपने प्लान में अनुपलब्ध सुविधा के बारे में पूछने वाले प्रो ग्राहक को उसी प्रश्न वाले एंटरप्राइज़ ग्राहक से अलग उत्तर की आवश्यकता होती है।
def get_subscription_info(customer_id: str) -> dict:
resp = requests.get(
f'{SHOP_API}/customers/{customer_id}/subscription',
headers={'Authorization': f'Bearer {SHOP_KEY}'}
)
if resp.status_code == 404:
return {'tier': 'free', 'status': 'active', 'renewal_date': None}
resp.raise_for_status()
sub = resp.json()
return {
'tier': sub['plan'],
'status': sub['status'], # active / past_due / canceled
'renewal_date': sub.get('current_period_end', '')[:10],
'cancel_at': sub.get('cancel_at_period_end', False)
}खाते की आयु की गणना करना
खाते की आयु ग्राहक की निष्ठा का संकेत देती है। 2021 से आपके साथ जुड़े ग्राहक के साथ कल साइन अप करने वाले व्यक्ति से अलग व्यवहार किया जाना चाहिए। संबंध बेहतर बनाने के लिए उचित अवसर पर ग्राहक के साथ बिताए समय का उल्लेख करें।
from datetime import datetime, timezone
def calculate_account_age(join_date_str: str) -> dict:
join = datetime.fromisoformat(join_date_str.replace('Z', '+00:00'))
now = datetime.now(timezone.utc)
delta = now - join
years = delta.days // 365
months = (delta.days % 365) // 30
return {
'days': delta.days,
'years': years,
'months': months,
'label': f'{years} year(s) and {months} month(s)' if years else f'{months} month(s)'
}
age = calculate_account_age('2021-03-15T00:00:00Z')
print(age['label']) # e.g. '5 year(s) and 2 month(s)'LLM के लिए संदर्भ स्ट्रिंग बनाना
ग्राहक प्रोफ़ाइल को एक संक्षिप्त संदर्भ ब्लॉक में बदलें, जिसे सिस्टम प्रॉम्प्ट में शामिल किया जाए। इसे छोटा रखें—केवल वर्तमान सत्र से सीधे संबंधित तथ्यों को शामिल करें।
def build_context_block(profile: CustomerProfile) -> str:
recent_order = profile.recent_purchases[0] if profile.recent_purchases else None
last_ticket = profile.previous_tickets[0] if profile.previous_tickets else None
parts = [
f'Customer: {profile.name} ({profile.email})',
f'Account age: {profile.account_age_days} days | Tier: {profile.subscription_tier}',
f'Lifetime value: USD {profile.lifetime_value_usd:.0f}',
]
if recent_order:
parts.append(
f'Last order: {recent_order["date"]} — '
f'{', '.join(recent_order["items"][:2])} ({recent_order["status"]})'
)
if last_ticket:
parts.append(f'Last ticket: "{last_ticket["subject"]}" ({last_ticket["status"]})')
return '\n'.join(parts)संदर्भ से प्रतिक्रियाओं को व्यक्तिगत बनाना
संदर्भ ब्लॉक को सिस्टम प्रॉम्प्ट में शामिल करें, ताकि LLM बिना स्पष्ट निर्देश दिए प्रतिक्रियाओं में स्वाभाविक रूप से उसका उल्लेख करे।
import openai
client = openai.OpenAI(api_key='YOUR_OPENAI_KEY')
def respond_with_context(user_message: str, profile: CustomerProfile) -> str:
context = build_context_block(profile)
system_prompt = (
f'You are a helpful customer service agent for ShopCo.\n'
f'Customer context:\n{context}\n\n'
f'Be warm and personal. Reference their history when relevant. '
f'Address the customer by first name.'
)
resp = client.chat.completions.create(
model='gpt-4o',
messages=[
{'role': 'system', 'content': system_prompt},
{'role': 'user', 'content': user_message}
]
)
return resp.choices[0].message.contentग्राहक संदर्भ को कैश करना
हर संदेश पर कई एपीआई से प्रोफ़ाइल डेटा प्राप्त करना धीमा और महँगा होता है। बातचीत की शुरुआत में प्रोफ़ाइल को कैश करें और केवल उन फ़ील्ड को अपडेट करें जो बदल सकती हैं (ऑर्डर की स्थिति, टिकट की स्थिति)।
import time
profile_cache: dict[str, dict] = {} # customer_id -> {profile, fetched_at}
CACHE_TTL = 300 # 5 minutes
def get_cached_profile(customer_id: str) -> CustomerProfile | None:
entry = profile_cache.get(customer_id)
if entry and time.time() - entry['fetched_at'] < CACHE_TTL:
return entry['profile']
return None
def set_cached_profile(customer_id: str, profile: CustomerProfile):
profile_cache[customer_id] = {
'profile': profile,
'fetched_at': time.time()
}इतिहास से संवेदनशील स्थितियों का पता लगाना
इतिहास ऐसे पैटर्न सामने ला सकता है जिनके लिए विशेष तरीके से संभालने की आवश्यकता होती है: ऐसा ग्राहक जिसके पिछले तीनों ऑर्डर खराब थे, ऐसा व्यक्ति जिसने पिछले महीने सदस्यता रद्द करने की धमकी दी थी, या ऐसा उपयोगकर्ता जो 7 वर्षों से आपके साथ है।
def assess_risk_flags(profile: CustomerProfile) -> list[str]:
flags = []
# Check for cancellation risk
cancel_keywords = ['cancel', 'unsubscribe', 'quit', 'competitor']
for ticket in profile.previous_tickets:
if any(kw in ticket.get('subject', '').lower() for kw in cancel_keywords):
flags.append('cancellation_risk')
break
# Defective product pattern
defective = sum(1 for o in profile.recent_purchases if o.get('status') == 'refunded')
if defective >= 2:
flags.append('product_quality_issue')
# High-value customer
if profile.lifetime_value_usd > 5000:
flags.append('high_value_customer')
return flagsसंपूर्ण संदर्भ संयोजन पाइपलाइन
सभी डेटा स्रोतों को बातचीत की शुरुआत में एक बार बुलाई जाने वाली assemble_context() फ़ंक्शन में संयोजित करें।
from datetime import date
def assemble_context(email: str) -> CustomerProfile:
# Try cache first
# In production: look up customer_id from email in your user DB
customer_id = 'CUST_123'
cached = get_cached_profile(customer_id)
if cached:
return cached
# Fetch from all sources
sub = get_subscription_info(customer_id)
orders = get_purchase_history(customer_id)
tickets = get_support_history(customer_id)
profile = CustomerProfile(
customer_id=customer_id,
name='Alice Smith',
email=email,
join_date=date(2021, 3, 15),
subscription_tier=sub['tier'],
account_age_days=calculate_account_age('2021-03-15T00:00:00Z')['days'],
lifetime_value_usd=1240.00,
previous_tickets=tickets,
recent_purchases=orders
)
set_cached_profile(customer_id, profile)
return profileग्राहक संदर्भ का कौन-सा भाग एजेंट को सबसे सीधे यह कहने में सक्षम बनाता है, ‘मैं देख रहा हूँ कि आप 2021 से हमारे साथ हैं’?
प्रतिक्रियाओं को व्यक्तिगत बनाने के लिए ग्राहक प्रोफ़ाइल के विशिष्ट डेटा बिंदुओं का उल्लेख करना आवश्यक है। यह पहचानना कि कौन-सा फ़ील्ड इस कथन को संभव बनाता है, स्मरण-आधारित व्यावहारिक प्रश्न है।
ग्राहक संदर्भ का पुनरावलोकन
एक उत्कृष्ट ग्राहक सेवा एजेंट खरीदारी इतिहास, सहायता टिकट, सदस्यता स्तर और खाते की आयु से एक समृद्ध प्रोफ़ाइल बनाता है। सिस्टम प्रॉम्प्ट में एक संक्षिप्त संदर्भ ब्लॉक शामिल करें, सत्र के लिए उसे कैश करें, और स्थिति बिगड़ने से पहले संवेदनशील स्थितियों का पता लगाने के लिए जोखिम संकेतों का उपयोग करें।
एआई शिक्षक के साथ AI एजेंट सीखें — निःशुल्क
अपने ब्राउज़र में वास्तविक कोड लिखें और चलाएँ, चौबीसों घंटे एआई शिक्षक से तुरंत सहायता पाएँ, और वेब या ऐप पर वहीं से शुरू करें जहाँ आपने छोड़ा था।
- पाठ्यक्रम
- 60
- पाठ
- 239
अक्सर पूछे जाने वाले प्रश्न
क्या “ग्राहक संदर्भ और इतिहास प्रबंधन” पाठ निःशुल्क है?
हाँ—“ग्राहक संदर्भ और इतिहास प्रबंधन” का पूरा पाठ यहाँ वेब पर निःशुल्क पढ़ा जा सकता है। इंटरैक्टिव अभ्यास (अंतर्निहित कोड संपादक और 24/7 एआई ट्यूटर) करने और AI एजेंट पाठ्यक्रम का बाकी हिस्सा अनलॉक करने के लिए CoddyKit PRO लें। AI एजेंट पाठ्यक्रम में कुल 4 पाठ शामिल हैं।
“ग्राहक संदर्भ और इतिहास प्रबंधन” में मैं क्या सीखूँगा?
पिछली खरीदारी, टिकटों और प्राथमिकताओं के आधार पर वैयक्तिकृत उत्तर। आप ब्राउज़र में सीधे चलाए जाने वाले व्यावहारिक कोड के साथ AI एजेंट का अभ्यास करते हैं, और पाठ पूरा करते समय 24/7 एआई ट्यूटर आपके प्रश्नों के उत्तर देता है।
क्या AI एजेंट शुरू करने के लिए मुझे किसी अनुभव की आवश्यकता है?
पहले के अनुभव की आवश्यकता नहीं है। CoddyKit पर AI एजेंट शुरुआती से लेकर उन्नत शिक्षार्थियों तक सभी के लिए व्यवस्थित किया गया है, इसलिए आप यहीं से या शुरुआत से सीखना शुरू कर सकते हैं और अपनी गति से आगे बढ़ सकते हैं। यह 4 में से 4वाँ पाठ है।
“ग्राहक संदर्भ और इतिहास प्रबंधन” पाठ पूरा करने में कितना समय लगता है?
CoddyKit का अधिकांश पाठ लगभग 5–10 मिनट में पूरा हो जाता है। हर पाठ छोटा और संवादात्मक है, इसलिए आप लगातार प्रगति करते हैं और वेब या ऐप पर वहीं से सीखना जारी रख सकते हैं जहाँ आपने छोड़ा था।
क्या मैं इस AI एजेंट पाठ में कोड लिख और चला सकता हूँ?
हाँ। हर AI एजेंट पाठ में एक अंतर्निर्मित कोड संपादक शामिल है, जिससे आप सीधे अपने ब्राउज़र में वास्तविक कोड लिख और चला सकते हैं और तुरंत एआई प्रतिक्रिया पा सकते हैं—स्थानीय सेटअप की आवश्यकता नहीं है।
इस पाठ्यक्रम के सभी पाठ
- टिकट रूटिंग और एस्केलेशन तर्क
- CRM एकीकरण: Salesforce और HubSpot
- मानव हस्तांतरण प्रोटोकॉल
- ग्राहक संदर्भ और इतिहास प्रबंधन