Dialogflow CX: একটি খুচরা ভার্চুয়াল এজেন্ট তৈরি করুন

১. শুরু করার আগে

এই কোডল্যাবে, আপনি Dialogflow CX ব্যবহার করে একটি রিটেইল চ্যাটবট তৈরি করতে শিখবেন। Dialogflow CX হলো কথোপকথনমূলক ইউজার ইন্টারফেস (UI) তৈরির জন্য একটি কনভারসেশনাল এআই প্ল্যাটফর্ম (CAIP)। Dialogflow CX চ্যাটবট, ভয়েস বট, ফোন গেটওয়ের মতো ভার্চুয়াল এজেন্ট বাস্তবায়ন করতে পারে এবং ৫০টিরও বেশি বিভিন্ন ভাষায় একাধিক চ্যানেল সমর্থন করতে পারে।

এই কোডল্যাবটি আপনাকে একটি রিটেইল প্রতিষ্ঠানের জন্য ওয়েবসাইট চ্যাটবট তৈরি করার পদ্ধতি শেখাবে। আমরা যে কাল্পনিক ব্যবসাটির জন্য চ্যাটবটটি তৈরি করছি, তার নাম হলো: জি-রেকর্ডস । জি-রেকর্ডস হলো ক্যালিফোর্নিয়া-ভিত্তিক একটি রক রেকর্ড লেবেল। এই লেবেলের সাথে ৪টি রক ব্যান্ড চুক্তিবদ্ধ আছে; অ্যালিস গুগলার , জি'স এন' রোজেস , দ্য গু ফাইটার্স এবং দ্য গুগল ডলস । জি-রেকর্ডস সকল রক ভক্তদের কাছে ব্যান্ডের মার্চেন্ডাইজ বিক্রি করে।

এই কোডল্যাবের শেষে, আপনি চ্যাটবটটি ব্যবহার করে শার্ট বা মিউজিক অর্ডার করতে পারবেন অথবা আপনার অর্ডার সম্পর্কে জিজ্ঞাসা করতে পারবেন।

চূড়ান্ত ফলাফল

আপনি যা শিখবেন

হাতে-কলমে কাজ করার মাধ্যমেই আপনি Dialogflow ES-এর তুলনায় Dialogflow CX-এর সুবিধাগুলো জানতে পারবেন! এর মধ্যে নিম্নলিখিত ধারণাগুলো অন্তর্ভুক্ত রয়েছে:

  • গুগল ক্লাউডের মধ্যে কীভাবে একটি Dialogflow CX ভার্চুয়াল এজেন্ট তৈরি করবেন
  • ফ্লো তৈরি করার পদ্ধতি শিখুন
  • এনটিটি তৈরি করার পদ্ধতি শিখুন
  • ইন্টেন্ট তৈরি করার পদ্ধতি শিখুন
  • স্টেট হ্যান্ডলার ব্যবহার করে কীভাবে পেজ তৈরি ও পেজ পরিবর্তন করতে হয় তা শিখুন।
  • ইন্টেন্ট রুট ব্যবহার করে কীভাবে পেজ পরিবর্তন করতে হয় তা শিখুন
  • প্যারামিটার ও কন্ডিশন রাউট ব্যবহার করে কীভাবে পেজ পরিবর্তন করতে হয় তা শিখুন।
  • সিস্টেম ফাংশন ব্যবহার করে কীভাবে শর্তসাপেক্ষ প্রতিক্রিয়া প্রদান করতে হয় তা শিখুন।
  • ফলব্যাক বার্তা তৈরি করার পদ্ধতি জানুন
  • সিমুলেটরটি কীভাবে ব্যবহার করতে হয় তা শিখুন
  • টেস্ট কেস এবং টেস্ট কভারেজ তৈরি করার পদ্ধতি শিখুন।

Dialogflow CX এজেন্টের চূড়ান্ত ডিজাইনটি দেখতে এইরকম হবে:

চূড়ান্ত ফলাফল

আপনার যা যা লাগবে

  • Dialogflow CX এজেন্ট তৈরি করতে আপনার একটি Google Identity / Gmail ঠিকানা লাগবে।
  • গুগল ক্লাউডে প্রবেশাধিকার।

২. পরিবেশ সেটআপ

একটি গুগল ক্লাউড প্রজেক্ট তৈরি করুন

যেহেতু Dialogflow CX গুগল ক্লাউডে চলে, তাই আপনাকে অবশ্যই একটি গুগল ক্লাউড প্রজেক্ট তৈরি করতে হবে। একটি প্রজেক্ট আপনার সমস্ত গুগল ক্লাউড রিসোর্সকে সংগঠিত করে। এতে থাকে একদল সহযোগী, সক্রিয় এপিআই (এবং অন্যান্য রিসোর্স), মনিটরিং টুল, বিলিং তথ্য এবং প্রমাণীকরণ ও অ্যাক্সেস নিয়ন্ত্রণ।

যখন আপনি একটি নতুন প্রজেক্ট তৈরি করবেন, তখন আপনাকে একটি প্রজেক্টের নাম লিখতে হবে। এবং এটিকে একটি বিদ্যমান বিলিং অ্যাকাউন্ট ও অর্গানাইজেশনের সাথে লিঙ্ক করতে হবে।

একটি বিলিং অ্যাকাউন্ট ব্যবহার করে নির্ধারণ করা হয় যে, নির্দিষ্ট কিছু রিসোর্সের জন্য কে অর্থ প্রদান করবে, এবং এটি এক বা একাধিক প্রজেক্টের সাথে লিঙ্ক করা যেতে পারে। প্রজেক্ট ব্যবহারের চার্জ লিঙ্ক করা বিলিং অ্যাকাউন্টে করা হয়। বেশিরভাগ ক্ষেত্রে, আপনি যখন একটি প্রজেক্ট তৈরি করেন, তখনই বিলিং কনফিগার করেন। আরও তথ্যের জন্য, বিলিং ডকুমেন্টেশন দেখুন। নিশ্চিত করুন যে আপনার ক্লাউড প্রজেক্টের জন্য বিলিং সক্রিয় করা আছে।

একটি নতুন প্রকল্প তৈরি করুন

Dialogflow API সক্রিয় করুন

Dialogflow ব্যবহার করার জন্য, আপনাকে আপনার প্রোজেক্টে Dialogflow API সক্রিয় করতে হবে।

  1. যে প্রজেক্টটির জন্য আপনি এপিআই সক্রিয় করতে চান, সেটি নির্বাচন করুন এবং 'চালিয়ে যান'-এ ক্লিক করুন।
  2. API ও পরিষেবাগুলির মেনুটি সংকুচিত করুন এবং ক্রেডেনশিয়াল তৈরি করুন -এ ক্লিক করুন।
  3. অ্যাপ্লিকেশন ডেটা ক্লিক করুন
  4. বলুন , না, আমি এগুলো ব্যবহার করছি না , যেহেতু আপনি আপাতত Kubernetes Engine, App Engine বা Cloud Functions ব্যবহার করছেন না।
  5. সম্পন্ন ক্লিক করুন

সেটআপ ক্রেডেনশিয়াল

একটি নতুন Dialogflow CX এজেন্ট তৈরি করুন

একটি নতুন Dialogflow CX এজেন্ট তৈরি করতে, প্রথমে Dialogflow CX কনসোলটি খুলুন:

  1. পূর্বে তৈরি করা গুগল ক্লাউড প্রজেক্টটি নির্বাচন করুন।
  2. এজেন্ট তৈরি করুন -এ ক্লিক করুন।

এজেন্টের প্রাথমিক সেটিংসের জন্য ফর্মটি পূরণ করুন:

  • আপনি যেকোনো প্রদর্শনের নাম বেছে নিতে পারেন।
  • অবস্থান হিসেবে বেছে নিন: us-central1
  • আপনার পছন্দের সময় অঞ্চল নির্বাচন করুন।
  • ডিফল্ট ভাষা হিসেবে ইংরেজি নির্বাচন করুন।

তৈরি করুন- এ ক্লিক করুন।

এজেন্ট তৈরি করুন

ঠিক আছে, আমরা পুরোপুরি প্রস্তুত। অবশেষে আমরা আমাদের ভার্চুয়াল এজেন্টের মডেলিং শুরু করতে পারি।

৩. প্রবাহ

জটিল কথোপকথনে প্রায়শই একাধিক আলোচনার বিষয় থাকে। জি-রেকর্ডস-এর জন্য আমরা ব্যান্ডের মার্চেন্ডাইজ বিক্রির যে চ্যাটবটটি তৈরি করছি, সেটিতে প্রোডাক্ট ক্যাটালগ, পেমেন্ট, অর্ডারের অবস্থা এবং কাস্টমার কেয়ার সংক্রান্ত প্রশ্নাবলী নিয়ে কথোপকথন থাকবে। আমরা এই আলোচনার বিষয়গুলোকে বিভিন্ন ফ্লো-তে ভাগ করতে পারি।

খুচরা প্রবাহ

ফ্লো টিমগুলোকে স্বতন্ত্র কথোপকথনের পথে কাজ করার সুযোগ দেয়। একটি ভালো উপায় হলো ফ্লো-কে সরল করা, যাতে এটি স্ক্রিনে সহজে এঁটে যায় এবং আরও মডিউলার হয়।

Dialogflow CX-এ ফ্লো (Flows) একটি নতুন ধারণা। Dialogflow Essentials-এ মেগা এজেন্ট (Mega Agents) নামে একটি ধারণা রয়েছে, যা কিছুটা ফ্লো-এর মতোই। তবে, আপনি ফ্লো অনেক বেশি ব্যবহার করবেন।

এই ল্যাবের পরবর্তী অংশে, আমরা এমন স্টেট হ্যান্ডলার ব্যবহার করব যা দিয়ে একটি ফ্লো শেষ করা যায় (ফলে এটি পরবর্তী বা পূর্ববর্তী ফ্লোতে ফিরে যাবে), অথবা সম্পূর্ণ এজেন্ট সেশনটিও বন্ধ করা যায়।

চলো কিছু ফ্লো তৈরি করি।

Creating Flows

  1. Dialogflow CX- এ, + আইকনে ক্লিক করুন > ফ্লো তৈরি করুন
  2. নাম হিসেবে Catalog উল্লেখ করুন এবং এন্টার চাপুন।

একটি প্রবাহ তৈরি করুন

আপনার প্রথম ফ্লো ক্যাটালগ তৈরি করা হয়েছে। এখন বাকি ফ্লোগুলো তৈরি করুন:

  • Order Process
  • My Order
  • Customer Care

প্রবাহ

এই ল্যাবের পরবর্তী অংশে আমরা পেজ স্টেট হ্যান্ডলার সেট করব, যা নিশ্চিত করবে যে অবশেষে ভিজ্যুয়ালাইজেশনটি দেখতে এইরকম হবে:

প্রবাহ

সিমুলেটর

Dialogflow CX কনসোলের ডানদিকে আপনি বিল্ট-ইন সিমুলেটরের সাহায্যে ভার্চুয়াল এজেন্ট পরীক্ষা করতে পারেন। আপনি কথোপকথনের শুরু থেকে অথবা কোনো নির্দিষ্ট ফ্লো থেকে এটি পরীক্ষা করতে পারেন।

  1. আপনার স্ক্রিনের উপরের ডানদিকে থাকা টেস্ট এজেন্ট বাটনটিতে ক্লিক করুন।
  2. ‘এজেন্টের সাথে কথা বলুন’ ফিল্ডে লিখুন: Hello ভার্চুয়াল এজেন্ট একটি ডিফল্ট স্বাগত বার্তা দিয়ে উত্তর দেবে: শুভেচ্ছা! আমি কীভাবে আপনাকে সাহায্য করতে পারি?

সিমুলেটর

চলুন এই ডিফল্ট স্বাগত বার্তাটি পরিবর্তন করি।

ডিফল্ট স্টার্ট ফ্লো

প্রথমে একটি ইনটেন্ট রুট তৈরি করে শুরু করা যাক, যেটি ভার্চুয়াল এজেন্টকে অভিবাদন জানানোর সাথে সাথে ট্রিগার হবে।

  1. বাম দিকের Build > Flows সাইডবারে, Default Start Flow- তে ক্লিক করুন এবং Start ট্রি নোডটি নির্বাচন করুন।

এটি স্টার্ট পেজটি খুলবে। এটি Build > Pages সাইডবার সেকশনে স্বয়ংক্রিয়ভাবে স্টার্ট পেজটি নির্বাচন করেছে।

  1. Start > Routes- এ গিয়ে Default Welcome Intent- টিতে ক্লিক করুন।

একটি ইন্টেন্ট কোনো কথোপকথনের একটি পর্বের জন্য একজন ব্যবহারকারীর উদ্দেশ্যকে শ্রেণিবদ্ধ করে। Dialogflow CX-এ, পরবর্তী সক্রিয় পৃষ্ঠা বা পরিপূর্ণতায় রাউট করার জন্য ইন্টেন্টগুলো একটি স্টেট হ্যান্ডলারের অংশ হতে পারে।

  1. 'Agent says' শিরোনামের সমস্ত এন্ট্রি মুছে ফেলুন এবং এই নতুন লেখাটি যোগ করুন:

Welcome, I am the virtual agent of G-Records, a fictional rock label. You can order artists merchandise, ask questions about your order or shipping, and I can tell you more which artists are currently signed with us. How can I help?

কথোপকথন সহজ করার জন্য আমাদের কিছু দ্রুত উত্তর দেওয়ার বাটন বা পরামর্শ দেওয়ার চিপেরও প্রয়োজন হবে।

  1. অ্যাড ডায়ালগ অপশনে ক্লিক করুন > কাস্টম পেলোড এবং নিচের কোড স্নিপেটটি ব্যবহার করুন।
  2. নিচের কোড স্নিপেটটি কাস্টম পেলোড হিসেবে ব্যবহার করুন এবং সেভ করুন

কাস্টম পেলোড সম্পর্কে আরও জানতে ডকুমেন্টেশন দেখুন।

{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Which artists?"
            },
            {
              "text": "Which products?"
            },
            {
              "text": "About my order..."
            }
          ]
        }
      ]
    ]
  }

ডিফল্ট স্বাগতম অভিপ্রায়

  1. সিমুলেটরে ওয়েলকাম ইন্টেন্টটি পরীক্ষা করে দেখুন।

আপনি সম্ভবত ভাবছেন কেন কোনো রিচ কন্টেন্ট দেখতে পাচ্ছেন না। এর কারণ হলো, সাজেশন চিপসের মতো রিচ কন্টেন্ট একটি ইন্টিগ্রেশনের উপর নির্ভরশীল। পরবর্তী ধাপগুলোর জন্য একটি বিলিং অ্যাকাউন্ট প্রয়োজন, কিন্তু আপনার যদি তা না থাকে তবে আপনি এই ধাপগুলো এড়িয়ে যেতে পারেন।

  1. বাম সাইডবারে, ম্যানেজ > ইন্টিগ্রেশন- এ ক্লিক করুন।
  2. Dialogflow Messenger বেছে নিন এবং Connect- এ ক্লিক করুন।
  3. পপ-আপে 'Enable'- এ ক্লিক করুন।

ইন্টিগ্রেশন সক্ষম করুন

আরেকটি পপআপ দেখানো হবে, এবার সেখানে ইন্টিগ্রেশন জাভাস্ক্রিপ্ট কোড থাকবে যা আপনি আপনার ওয়েবসাইটে পেস্ট করে Dialogflow Messenger কম্পোনেন্টটি ইন্টিগ্রেট করতে পারবেন। যেহেতু আমাদের এখনও কোনো ওয়েবসাইট নেই, তাই আমরা ভার্চুয়াল এজেন্টটি সরাসরি টুলটিতেই পরীক্ষা করব।

ডায়ালগফ্লো মেসেঞ্জার এখন চেষ্টা করুন

  1. 'এখনই চেষ্টা করুন ' লিঙ্কে ক্লিক করুন।
  2. চ্যাট উইন্ডোটি খুলতে নিচের ডানদিকের চ্যাটবট আইকনটিতে ক্লিক করুন। কথোপকথন শুরু করতে Hello লিখুন।

ডায়ালগফ্লো মেসেঞ্জার এখন চেষ্টা করুন

আপাতত, আপনি যখন সাজেশন চিপগুলোতে ক্লিক করবেন, ভার্চুয়াল এজেন্ট আপনার কথার অর্থ বুঝতে পারবে না। এর কারণ হলো, আমাদের ভার্চুয়াল এজেন্ট এখনও বিভিন্ন স্টেটের মধ্যে পরিবর্তন করছে না। আমরা Dialogflow CX-এ Pages ব্যবহার করে এটি করতে পারি। চলুন ল্যাবটি চালিয়ে যাই, আমরা প্রথমে কিছু Entity এবং Intent তৈরি করব।

৪. সত্তার প্রকারভেদ

এন্ড-ইউজারের ইনপুট থেকে ডেটা কীভাবে এক্সট্র্যাক্ট করা হবে, তা নিয়ন্ত্রণ করতে এনটিটি টাইপ ব্যবহার করা হয়। Dialogflow CX এনটিটি টাইপগুলো Dialogflow ES এনটিটি টাইপগুলোর মতোই। Dialogflow আগে থেকে সংজ্ঞায়িত সিস্টেম এনটিটি সরবরাহ করে, যা অনেক সাধারণ ধরনের ডেটার সাথে মেলানো যায়। উদাহরণস্বরূপ, তারিখ, সময়, রঙ, ইমেল অ্যাড্রেস ইত্যাদির সাথে মেলানোর জন্য সিস্টেম এনটিটি রয়েছে। এছাড়াও, আপনি কাস্টম ডেটার সাথে মেলানোর জন্য আপনার নিজস্ব কাস্টম এনটিটি তৈরি করতে পারেন।

ফ্লো অনুযায়ী পেজগুলো ডিজাইন করার আগে, চলুন প্রথমে সমস্ত কাস্টম এনটিটিগুলো প্রস্তুত করে নিই। আমরা নিম্নলিখিত এনটিটিগুলো তৈরি করব:

ডায়ালগফ্লো সত্তা

সত্তা তৈরি করা

চলুন একটি আর্টিস্ট এনটিটি তৈরি করি।

  1. পরিচালনা > সত্তার প্রকারভেদ- এ ক্লিক করুন
  2. ক্লিক করুন + তৈরি করুন
  • প্রদর্শিত নাম: Artist
  • সত্তাসমূহ:
  • The Google Dolls (সমার্থক শব্দ: Google Dolls সহ)
  • The Goo Fighters (সমার্থক শব্দ: Goo Fighters সহ)
  • G's N' Roses (সমার্থক শব্দ: Gs and Roses )
  • Alice Googler
  • অ্যাডভান্সড অপশন-এ ক্লিক করুন এবং ফাজি ম্যাচিং (Fuzzy Matching ) চেক করুন। (আপনি ব্যান্ডের নাম ভুল বানান করলেও, এটি হয়তো সঠিক সত্তার সাথে মিলিয়ে দিতে পারে।)
  • অ্যাডভান্সড অপশনে ‘রিডাক্ট ইন লগ’ বিকল্পটিও চেক করুন। (যদি আপনি ব্যান্ডের নাম ভুল বানান করেন, তবে এটি লগে নামটি সংশোধন করে দেবে।)
  1. সংরক্ষণ করুন ক্লিক করুন

মার্চ আইটেমটির জন্য আমাদের একটি এনটিটিও প্রয়োজন হবে:

  1. পরিচালনা > সত্তার প্রকারভেদ- এ ক্লিক করুন
  2. ক্লিক করুন + তৈরি করুন
  • প্রদর্শিত নাম: Merch
  • সত্তাসমূহ:
  • T-shirt
  • Longsleeve (সমার্থক শব্দ: Longsleeve shirt )
  • Tour Movie
  • Digital Album (সমার্থক শব্দ: MP3 Album , MP3 )
  • CD (সমার্থক শব্দ: Disc , Physical CD )
  1. সংরক্ষণ করুন ক্লিক করুন

অ্যালবামের জন্য আমাদের একটি এনটিটিরও প্রয়োজন হবে:

  1. পরিচালনা > সত্তার প্রকারভেদ- এ ক্লিক করুন
  2. ক্লিক করুন + তৈরি করুন
  • প্রদর্শনের নাম: Album
  • সত্তাসমূহ:
  • Live
  • Greatest Hits (সমার্থক শব্দ: Hits )
  1. সংরক্ষণ করুন ক্লিক করুন

পোশাকের মাপের জন্য আমাদের একটি সত্তারও প্রয়োজন হবে:

  1. পরিচালনা > সত্তার প্রকারভেদ- এ ক্লিক করুন
  2. ক্লিক করুন + তৈরি করুন
  • প্রদর্শিত নাম: ShirtSize
  • সত্তাসমূহ:
  • XS (সমার্থক শব্দ: Extra Small )
  • S (সমার্থক শব্দ: Small )
  • M (সমার্থক শব্দ: Medium )
  • L (সমার্থক শব্দ: Large )
  • XL (সমার্থক শব্দ: Extra Large )
  • 2XL (সমার্থক শব্দ: Extra Extra Large )
  • 3XL
  1. সংরক্ষণ করুন ক্লিক করুন

এবং অর্ডার নম্বরের জন্য একটি এনটিটি, যা সাধারণত ৪টি আলফানিউমেরিক এবং ৩টি সংখ্যা নিয়ে গঠিত। (যেমন ABCD123)

  1. পরিচালনা > সত্তার প্রকারভেদ- এ ক্লিক করুন
  2. ক্লিক করুন + তৈরি করুন
  • প্রদর্শিত নাম: OrderNumber
  • রেগএক্স সত্তা
  • সত্তা: [AZ]{4}[0-9]{3}
  1. সংরক্ষণ করুন ক্লিক করুন

আপনার এনটিটি কনফিগারেশনটি নিম্নলিখিতের অনুরূপ হওয়া উচিত:

@Artist: @শিল্পী সত্তার ধরণ

@মার্চ: @মার্চ সত্তার ধরণ

@অ্যালবাম: @অ্যালবাম সত্তার ধরণ

@শার্টের সাইজ: @শার্টসাইজ সত্তার ধরণ

@অর্ডার নম্বর: @অর্ডারনম্বর সত্তার ধরণ

কাস্টম এনটিটিগুলো তৈরি হয়ে গেলে, আমরা ইনটেন্টগুলো প্রস্তুত করতে পারব। চলুন ল্যাবটি চালিয়ে যাই।

৫. অভিপ্রায়

একটি ইন্টেন্ট একটি কথোপকথনের পালা চলাকালীন একজন ব্যবহারকারীর উদ্দেশ্যকে শ্রেণিবদ্ধ করে। Dialogflow CX-এ এগুলোকে ব্যাপকভাবে সরল করা হয়েছে, এটি এখন আর কথোপকথন নিয়ন্ত্রণের মূল ভিত্তি নয়। Dialogflow CX শুধুমাত্র ব্যবহারকারীরা যা বলছেন তার সাথে মেলানোর জন্য ইন্টেন্ট ব্যবহার করে। Dialogflow ES-এ, আপনাকে সবকিছু একটি ইন্টেন্টের সাথে যুক্ত করতে হতো (প্যারামিটার, ইভেন্ট, ফুলফিলমেন্ট, ইত্যাদি)। Dialogflow CX-এর ইন্টেন্টগুলোতে শুধুমাত্র প্রশিক্ষণমূলক বাক্যাংশ থাকে এবং তাই এগুলো পুনঃব্যবহারযোগ্য। এটি এখন আর কথোপকথন নিয়ন্ত্রণ করে না। সুতরাং ইন্টেন্ট তৈরি করার প্রক্রিয়াটি খুবই সহজ হবে:

ইনটেন্টের ট্রেনিং ফ্রেজগুলো 'পরিবর্তনশীল' ইনপুট বের করার জন্য এনটিটি ব্যবহার করতে পারে, এই কারণেই আগে থেকে আপনার এনটিটি টাইপগুলো তৈরি করে রাখা একটি ভালো অভ্যাস, যা আমরা ল্যাব স্টেপের আগের পৃষ্ঠায় করেছি।

অভিপ্রায় তৈরি করা

ফ্লো অনুযায়ী পেজগুলো ডিজাইন করার আগে, চলুন প্রথমে সমস্ত ইনটেন্টগুলো প্রস্তুত করে নিই।

  1. ম্যানেজ > ইনটেন্টস- এ ক্লিক করুন।
  2. + তৈরি করুন- এ ক্লিক করুন

নিম্নলিখিত বিবরণগুলি ব্যবহার করুন:

  • প্রদর্শনের নাম redirect.artists.overview
  • বিবরণ Artists overview: The bands supported by the label

নতুন উদ্দেশ্য

নিচে স্ক্রোল করুন এবং নিম্নলিখিত প্রশিক্ষণ বাক্যগুলো তৈরি করুন:

  • Which bands are signed?
  • Which bands
  • Which artists
  • Which artists are part of the record label
  • Who is part of the label
  • From which bands can I buy merchandise
  • Band merchandise
  • Which music do you have?
  • I would like to know who are signed to the label
  • Who are supported by the label
  • From who can I buy shirts
  • What music can I order
  • Can I get an overview of all the artists

প্রশিক্ষণের বাক্যাংশ

  1. সংরক্ষণ করুন- এ ক্লিক করুন।
  1. এবার চলুন বাকি সব ইন্টেন্ট তৈরি করা যাক। আরও ট্রেনিং ফ্রেজ তৈরি করতে নিজের কল্পনাশক্তি ব্যবহার করুন। একটি উত্তম অনুশীলন হলো, প্রতিটি ইন্টেন্টের জন্য অন্তত ১০টি ট্রেনিং ফ্রেজ রাখা, যাতে একজন ব্যবহারকারী বিভিন্ন উপায়ে সেই ইন্টেন্টটি ট্রিগার করতে পারে। এই ল্যাবের জন্য এর চেয়ে কম থাকলেও চলবে।

কয়েকটি বিষয় খেয়াল রাখতে হবে:

  • মনে রাখবেন যে, আপনি আপনার প্রশিক্ষণ বাক্যাংশটি প্রবেশ করানোর সাথে সাথে Dialogflow CX স্বয়ংক্রিয়ভাবে আপনার এনটিটিগুলোকে টীকাযুক্ত করবে। যদি এটি তা না করে, তাহলে আপনাকে আপনার এনটিটি আপডেট করতে হতে পারে (একটি প্রতিশব্দ যোগ করে) অথবা প্রশিক্ষণ বাক্যাংশটি নিজে হাতে টীকাযুক্ত করতে হতে পারে।
  • সংক্ষিপ্ত প্রশিক্ষণ বাক্যাংশ: Dialogflow-এর NLU সিস্টেম সংক্ষিপ্ত প্রশিক্ষণ বাক্যাংশ দিয়েও কাজ করতে পারে এবং আমরা এখানে কয়েকটি উদাহরণ দিয়েছি।
  • অতিরিক্ত প্রশিক্ষণ: একটি ইন্টেন্টের জন্য খুব বেশি প্রশিক্ষণ বাক্যাংশ ব্যবহার করলে তা ওভার-ট্রেনিং এবং একটি অনাকাঙ্ক্ষিত ফলাফলের কারণ হতে পারে। পুনরাবৃত্তিমূলক এবং ক্রমবর্ধমান টেস্টিং ব্যবহার করা এবং কোনো ইন্টেন্ট মিলে না গেলে প্রশিক্ষণ বাক্যাংশ যোগ করাই সর্বোত্তম পন্থা।

প্রদর্শনের নাম

প্রশিক্ষণের বাক্যাংশ

redirect.product.overview

"Which products do you sell?", "What merchandise items do you have?", "What are you selling?", "What are the items?", "Which products?" "What merchandise?", "Please tell me what you have"

confirm.artists.overview

"Yeah, let me buy merchandise", "Yes, I want to purchase something", "Yes, I would like to order merchandise from Alice Googler" (দ্রষ্টব্য: অ্যালিস গুগলারকে একজন @Artist সত্তা হিসেবে গণ্য করা উচিত!) , "Ok, let's buy stuff."

redirect.price

"How much does a t-shirt cost?", "What's the price for the tour movie?", "The album is how much?", "I want to know the price of a longsleeve shirt", "What's the price difference?", "What does each product costs?", "What does it cost?", "What is the price?"

redirect.product

"Tour movie", "I am interested in a t-shirt", "Can I buy a digital album?", "I want the CD", "I want to buy something", "Can I purchase a record?", "I want to buy a t-shirt size M of The Google Dolls", "Can I purchase the Alice Googler digital album?"

redirect.product.of.artist

"Yeah, let's shop", "Give me merch of Alice Googler", "Shirts of The Google Dolls that would be nice.", "Yes", "I want The Goo Fighters stuff", "Yes, I want to order merchandise", "Yep, give me items of G's N' Roses", "Go for it", "Anything Alice Googler", "I am a G's N' Roses fan!", "Google Dolls", "Yes of The Google Dolls"

redirect.shirts

"Shirts", "I want to buy shirts", "I am interested in shirts", "I want a shirt", "Shirts of G's N' Roses please", "Give me shirts of the Google Dolls", "I want to buy shirts of Alice Googler"

redirect.music

"Music", "I want to buy music", "I am interested in music", "Give me music of the Goo Fighters", "Music of Goo Fighters please", "Interested in buying the Alice Googler album", "Purchase Alice Googler music"

redirect.album

"Hits", "Live Album", "I want the Greatest Hits Digital Album", "Give me the Greatest Hits CD", "Hits on MP3"

redirect.shirt.size

"XS", "I have M", "I want Large", "My size is 3XL", "Extra Large is the size"

redirect.my.order

"About my order", "I have a question about my order", "My order is ABCD123, I have a question about my order."

status

redirect.my.order.status

redirect.my.order.canceled

"I want to cancel my order", "I want to cancel order ABCD123", "Please cancel order ABCD123", "Undo my order", "Stop my order", "Cancel"

redirect.shipping.info

"How long will it take?", "How long is shipping?", "How long does shipping take?", "When will I receive it?"

redirect.refund.info

"I want a refund.", "Can I get a refund", "I want to return the CD", "I want to return my t-shirt"

redirect.swapping.info

"I want to swap my item", "Can I change my t-shirt for a larger size?", "Can I change my product?", "I want to swap the CD"

redirect.order.process

"I want to buy a t-shirt of the Google Dolls, size S", "Let me buy the digital CD of Alice Googler", "Get me the tour movie of G's N' Roses", "Buy a longsleeve shirt of The Goo Fighters", "Purchase the Alice Googler t-shirt", "Please order me the Google Dolls CD"

confirm.proceed.order

"Yes", "Yes, please continue", "Yes order", "I want to order", "Yeah", "Yep", "I confirm", "Agree", "Go ahead", "Order", "Buy it", "Purchase", "Okay"

decline.proceed.order

"No", "I rather not", "I don't want it anymore", "Don't order", "Stop", "Not anymore", "Nope", "Go back", "Reset", "Decline", "I don't need it"

redirect.home

"Go back", "Home", "Help", "What else can I ask", "Restart", "Can you tell me what I can order?", "What questions can I ask", "I need help", "Advice please", "Hi", "Hello", "Good day!"

redirect.end

"No that's it, goodbye", "Bye", "Cheers", "End", "That's it", "No more questions", "Exit", "Have a good day", "End Call", "Close"

এখন যেহেতু আমাদের পুনঃব্যবহারযোগ্য উপাদানগুলো (ফ্লো, এনটিটি এবং ইনটেন্ট) প্রস্তুত, আমরা পেজ এবং স্টেট হ্যান্ডলার তৈরি করে এটিকে একত্রিত করতে পারি।

৬. পেজ এবং স্টেট হ্যান্ডলার

একটি Dialogflow CX কথোপকথনকে (একটি সেশন) একটি ফাইনাইট স্টেট মেশিন হিসেবে বর্ণনা ও কল্পনা করা যেতে পারে। উদাহরণস্বরূপ, একটি ভেন্ডিং মেশিনকে ফাইনাইট স্টেট মেশিন হিসেবে মডেল করা যেতে পারে। এর নিম্নলিখিত স্টেটগুলো রয়েছে: কয়েনের জন্য অপেক্ষা করা, ক্যান্ডি নির্বাচন করা, ক্যান্ডি দেওয়া এবং কিছু ইনপুট পেলে এটি এই স্টেটগুলোর মধ্যে চলাচল করে। উদাহরণস্বরূপ, একটি কয়েন ঢোকালে ভেন্ডিং মেশিনটি 'কয়েনের জন্য অপেক্ষা করা' থেকে 'ক্যান্ডি নির্বাচন করা' স্টেটে চলে যায়। একটি Dialogflow CX ভার্চুয়াল এজেন্টের জন্য এই স্টেটগুলোকে মডেল করার উপায় হলো পেজ

একজন ব্যবহারকারী যখন Dialogflow CX-এর সাথে কোনো কথোপকথনে অংশ নেন, তখন কথোপকথনটি এক পৃষ্ঠা থেকে অন্য পৃষ্ঠায় যেতে থাকে। তাই যেকোনো মুহূর্তে, ঠিক একটি পৃষ্ঠাই বর্তমান পৃষ্ঠা হয়, বর্তমান পৃষ্ঠাটিকে সক্রিয় বলে গণ্য করা হয় এবং সেই পৃষ্ঠার সাথে যুক্ত ফ্লো-টিকেও সক্রিয় বলে বিবেচনা করা হয়।

প্রতিটি ফ্লো- এর জন্য আপনি অনেকগুলো পেজ নির্ধারণ করেন, যেখানে আপনার সম্মিলিত পেজগুলো ফ্লো-টির জন্য ডিজাইন করা বিষয়(গুলো)র উপর একটি সম্পূর্ণ কথোপকথন পরিচালনা করতে পারে। প্রতিটি ফ্লো-এর একটি বিশেষ স্টার্ট পেজ থাকে। যখন একটি ফ্লো প্রথম সক্রিয় হয়, তখন স্টার্ট পেজটি বর্তমান পেজ হয়ে যায়। কথোপকথনের প্রতিটি পালার জন্য, বর্তমান পেজটি হয় একই থাকবে অথবা অন্য একটি পেজে পরিবর্তিত হবে। এই ধারণাটি আপনাকে অনেকগুলো পেজ এবং একাধিক কথোপকথনের পালা সহ বৃহত্তর এজেন্ট তৈরি করার সুযোগ দেবে।

পেজগুলিতে ফুলফিলমেন্ট (স্ট্যাটিক এন্ট্রি ডায়ালগ এবং/অথবা ওয়েবহুক), প্যারামিটার এবং স্টেট হ্যান্ডলার থাকে। স্টেট হ্যান্ডলারের মাধ্যমে কথোপকথন নিয়ন্ত্রণ করা হয়, যা আপনাকে অন্য Dialogflow CX পেজে যাওয়ার জন্য বিভিন্ন ট্রানজিশন রুট তৈরি করার সুযোগ দেয়, যার মধ্যে কথোপকথনের শাখা তৈরির জন্য এটিকে শর্তসাপেক্ষ করার সুবিধাও রয়েছে।

একটি কথোপকথনের অবস্থা তিনটি ভিন্ন ধরনের রুটের মাধ্যমে পৃষ্ঠাগুলির মধ্যে পরিবর্তন পরিচালনা করে নিয়ন্ত্রণ করা হয়:

  • ইনটেন্ট রুট : কখন একটি ইনটেন্ট মেলানো উচিত (যেমন, ব্যবহারকারীর কথার উপর ভিত্তি করে পৃষ্ঠা পরিবর্তন করা)। (ভিজ্যুয়াল ডায়াগ্রামের নীল রেখাগুলো।)
  • শর্তাধীন রুট : কখন কোনো শর্ত পরীক্ষা করা উচিত (যেমন, সেশনে সংরক্ষিত নির্দিষ্ট প্যারামিটারের উপর ভিত্তি করে পৃষ্ঠা পরিবর্তন করা) (ভিজ্যুয়াল ডায়াগ্রামের কমলা রেখাগুলো)।
  • ইভেন্ট হ্যান্ডলার : কখন একটি নির্দিষ্ট ফলব্যাক ইভেন্ট হ্যান্ডেল করা উচিত (যেমন, কোনো ইনপুট না পাওয়া বা মিল না পড়ার মতো পরিস্থিতি হ্যান্ডেল করা, যাতে ব্যবহারকারীকে ইন্টেন্ট অথবা কন্ডিশন রুটের মধ্যে পার্থক্য করতে সাহায্য করা যায়) (ভিজ্যুয়াল ডায়াগ্রামের সবুজ রেখাগুলো)।

কথোপকথনের বক্তব্য (অর্থাৎ বিষয়বস্তু বা ব্যবহারকারীকে দেওয়া উত্তর) পরিপূর্ণতার দ্বারা সংজ্ঞায়িত হয়, যা স্থির বা গতিশীল হতে পারে:

  • স্থির পরিপূরণ : যখন একটি স্থির পরিপূরণ প্রতিক্রিয়া প্রদান করা হয়
  • ডাইনামিক ফুলফিলমেন্ট : যখন ডাইনামিক রেসপন্সের জন্য একটি ফুলফিলমেন্ট ওয়েবহুক কল করা হয়

আমাদের রিটেইল বটের জন্য, আমরা কিছু ইনটেন্ট রুট তৈরি করব এবং কিছু স্ট্যাটিক এন্ট্রি ফুলফিলমেন্ট রেসপন্স দেব, যা একটি পেজ অ্যাক্টিভেট হওয়ার সাথে সাথেই ব্যবহারকারীর সামনে উপস্থাপন করা হবে। পরবর্তীতে, মার্চেন্ডাইজ অর্ডার করার জন্য প্রয়োজনীয় তথ্য সংগ্রহ করতে আমরা কন্ডিশন রুটসহ প্যারামিটার তৈরি করব।

পৃষ্ঠা অভিপ্রায় রুট

ডিফল্ট স্টার্ট ফ্লো-তে পৃষ্ঠাগুলি তৈরি করা

ডিফল্ট স্টার্ট ফ্লো-এর একটি ফ্লো চার্ট নিচে দেওয়া হলো:

ক্যাটালগ সংযুক্ত পৃষ্ঠাগুলি

চলুন এটা একসাথে ক্লিক করি:

  1. বিল্ড > ডিফল্ট স্টার্ট ফ্লো-তে ক্লিক করুন
  2. স্টার্ট পেজে ক্লিক করুন
  3. রুটের পাশে থাকা + আইকনে ক্লিক করুন
  4. পুনঃনির্দেশ যোগ করুন.শিল্পী.ওভারভিউ
  5. নিচে স্ক্রল করে Transition- এ যান এবং Catalog ফ্লো-তে প্রবেশ করুন।
  6. সংরক্ষণ করুন
  7. redirect.product.overview এবং এই টেবিলের বাকি ১১টি সারির জন্য উপরের ধাপগুলো পুনরাবৃত্তি করুন:

পৃষ্ঠা (প্রবাহমান)

রুট > অভিপ্রায়

রুট > রূপান্তর

শুরু করুন

Default Welcome Intent

-

শুরু করুন

redirect.artists.overview

প্রবাহ: ক্যাটালগ

শুরু করুন

redirect.product.overview

প্রবাহ: ক্যাটালগ

শুরু করুন

redirect.shirts

প্রবাহ: ক্যাটালগ

শুরু করুন

redirect.music

প্রবাহ: ক্যাটালগ

শুরু করুন

redirect.product

প্রবাহ: ক্যাটালগ

শুরু করুন

redirect.product.of.artist

প্রবাহ: ক্যাটালগ

শুরু করুন

redirect.refund.info

প্রবাহ: গ্রাহক সেবা

শুরু করুন

redirect.shipping.info

প্রবাহ: গ্রাহক সেবা

শুরু করুন

redirect.swapping.info

প্রবাহ: গ্রাহক সেবা

শুরু করুন

redirect.my.order

প্রবাহ: আমার অর্ডার

শুরু করুন

redirect.my.order.canceled

প্রবাহ: আমার অর্ডার

শুরু করুন

redirect.my.order.status

প্রবাহ: আমার অর্ডার

শুরু করুন

redirect.end

পৃষ্ঠা: সেশন শেষ করুন

ডিফল্ট স্টার্ট পেজ রুট

ডিফল্ট স্টার্ট ফ্লোটি একটি কল সেন্টারে ফোন করার সময় অপশন মেনু যেভাবে কাজ করে, সেভাবেই কাজ করবে। তবে, এই ভার্চুয়াল এজেন্টে এটিকে ন্যাচারাল ল্যাঙ্গুয়েজ বা স্বাভাবিক ভাষা দিয়ে প্রশিক্ষণ দেওয়া হয়েছে, যেখানে ইন্টেন্টের মধ্যে প্রশিক্ষণ বাক্যাংশগুলো থাকে। ফলে, এর ইন্টারঅ্যাকশনটি DTMF অপশনের পরিবর্তে কথোপকথন দ্বারা চালিত হয় এবং এটি আরও স্বাভাবিক ও মানবিক।

ডিফল্ট স্টার্ট পেজ রুট

ক্যাটালগ ফ্লোতে পৃষ্ঠা তৈরি করা

নিম্নলিখিত চ্যাট প্রতিলিপিটি ক্যাটালগ ফ্লো-এর অন্তর্গত:

> "Hi"
"Welcome, I am the virtual agent of G-Records, a fictional rock label.
You can order artists merchandise, ask questions about your order or shipping,
and I can tell you more which artists are currently signed with us. How can I help?"
> "Which bands are signed with this record label?"
"The following bands are signed with G-Records:
Alice Googler, G's N' Roses, The Goo Fighters and The Google Dolls.

From which of these artists would you like to order merchandise?"
> "Alice Googler"
"You want to rock with Alice Googler merchandise. Awesome!

We sell shirts, music or the tour movie.

Which merchandise item do you want?"
"(Suggestion chips: [Shirts] [Music] [Tour Movie])"
> "I would like to buy a Shirt"
"Do you want a longsleeve or a t-shirt?"
"(Suggestion chips: [T-shirt, Longsleeve, Price?])"
> "What's the price difference?"
"A t-shirt costs $25 and a longsleeve costs $30.

Do you want a longsleeve or a t-shirt?"
> "A t-shirt",
"What shirt size do you want?"
"(Suggestion chips: [XS, S, M, L, XL, 2XL, 3XL])"
> "M"
"A T-shirt of Alice Googler size: M costs $25. Shall I continue to order?"

আপনি মিউজিক বা ট্যুর মুভি বেছে নিলে সংলাপটি ভিন্ন হবে: মিউজিকের ক্ষেত্রে সংলাপটি দেখতে এইরকম হবে:

 > "Music"
"We have a Greatest Hits Album or the Live Album. Which one do you want?"
"(Suggestion chips: [Greatest Hits, Live, Price?])"
> "The Live Album"
"Do you want this album on CD or MP3?"
"(Suggestion chips: [CD, MP3])"
> "What's the price difference?"
"A CD costs $15. The digital album on MP3 costs $10.
Do you want this album on CD or MP3?"
> "Digital Album",
"The Digital Album: Alice Googler - Live costs $10. Shall I continue to order?"

ট্যুর মুভিটির সংলাপটি দেখতে এইরকম হবে:

 > "Tour Movie"
"The Tour Movie of G's N' Roses costs $25. Shall I continue to order?

ক্যাটালগ ফ্লো-এর অন্তর্ভুক্ত সমস্ত পেজের একটি ফ্লো চার্ট নিচে দেওয়া হলো:

ক্যাটালগ সংযুক্ত পৃষ্ঠাগুলি

এই প্রবাহটির জটিলতা লক্ষ্য করুন:

  • আমি ‘কোন কোন শিল্পী’ প্রশ্নটি বাদ দিয়ে সরাসরি জিজ্ঞাসা করতে পারতাম , ‘কোন কোন মার্চেন্ডাইজ আইটেম পাওয়া যাচ্ছে’
  • ডিফল্ট স্টার্ট ফ্লো থেকে, আমি জিজ্ঞাসা করতে পারি: "আমি গুগল ডলস টি-শার্টটি কিনতে চাই", অথবা "আমি কিছু একটা কিনতে চাই"। এর মানে হলো, ভার্চুয়াল এজেন্ট এই প্রয়োজনীয় প্যারামিটারগুলোর জন্য নির্দিষ্ট স্থানগুলো পূরণ করতে কিছু প্রাসঙ্গিক প্রশ্ন জিজ্ঞাসা করবে। এটি সরাসরি প্রোডাক্ট পেজে চলে যায়।
  • The Price dialogue comes from the Price page that will be reused.
  • যদিও ট্যুর মুভির সংলাপটি সবচেয়ে সহজ মনে হতে পারে, আমরা আসলে এটি নিয়ে বিশেষ কিছু করব। আমরা সংলাপের এই অংশটি পুনরায় ব্যবহার করব, যাতে ব্যবহারকারীরা সমস্ত তথ্য একবারে নির্দিষ্ট করে দিলে, এটি সরাসরি অন্য কোনো পণ্যের জন্যও ব্যবহার করতে পারেন।
 > "I want The Goo Fighters longsleeve size S."
"The longsleeve of The Goo Fighters size S costs $30. Shall I continue to order?"

চলুন প্রথমে পৃষ্ঠাগুলো সংযুক্ত করার মাধ্যমে শুরু করা যাক।

  1. বিল্ড > ক্যাটালগ-এ ক্লিক করুন
  2. স্টার্ট পেজে ক্লিক করুন
  3. রুটের পাশে থাকা + আইকনে ক্লিক করুন
  4. পুনঃনির্দেশ যোগ করুন.শিল্পী.ওভারভিউ
  5. নিচে স্ক্রল করে Transition- এ যান, Page নির্বাচন করুন এবং বেছে নিন: + নতুন পেজ
  6. Use the page name: Artist Overview and hit Save

এবার বাকি প্রবাহটা শেষ করা যাক:

  1. পূর্ববর্তী ধাপগুলো নিম্নলিখিত পেজ, ইন্টেন্ট এবং ফুলফিলমেন্টগুলোর সাথে পুনরাবৃত্তি করা যেতে পারে। এই টেবিলটি গ্রহণ করুন। 'পেজ' হলো সেই পেজ যা আপনি ফ্লো-তে নির্বাচন করবেন, 'রুটস > ট্রানজিশন টু' হলো নতুন ফ্লো বা পেজ যা আপনি তৈরি করবেন এবং যেখানে ট্রানজিশন করবেন।

পৃষ্ঠা (প্রবাহমান)

রুট > অভিপ্রায়

রুট > রূপান্তর

ক্যাটালগ শুরু

redirect.artists.overview

শিল্পীর সংক্ষিপ্ত বিবরণ

ক্যাটালগ শুরু

redirect.product

পণ্য

ক্যাটালগ শুরু

redirect.product.overview

পণ্যের সংক্ষিপ্ত বিবরণ

ক্যাটালগ শুরু

redirect.product.of.artist

পণ্যের সংক্ষিপ্ত বিবরণ

ক্যাটালগ শুরু

redirect.shirts

শার্ট

ক্যাটালগ শুরু

redirect.music

সঙ্গীত

ক্যাটালগ শুরু

redirect.end

অধিবেশন শেষ করুন

ক্যাটালগ শুরু

redirect.home

শেষ প্রবাহ

শিল্পীর সংক্ষিপ্ত বিবরণ

redirect.product.of.artist

পণ্যের সংক্ষিপ্ত বিবরণ

এখন চলুন আরও কিছু স্ট্যাটিক ফুলফিলমেন্ট যোগ করে এগিয়ে যাই।

  1. ক্যাটালগ ফ্লো-তে, আর্টিস্ট ওভারভিউ পেজটিতে ক্লিক করুন।
  2. এন্ট্রি ফুলফিলমেন্ট বিভাগে এডিট ফুলফিলমেন্ট- এ ক্লিক করুন।
  3. নিম্নলিখিত স্থির পরিপূরণগুলি ব্যবহার করুন ( এজেন্টের মতে ):
  • The following bands are signed with G-Records: Alice Googler, G's N' Roses, The Goo Fighters and The Google Dolls.
  1. সংরক্ষণ করুন ক্লিক করুন
  2. ক্যাটালগ ফ্লো-তে, প্রোডাক্ট ওভারভিউ পেজটিতে ক্লিক করুন।
  3. এন্ট্রি ফুলফিলমেন্ট বিভাগে এডিট ফুলফিলমেন্ট- এ ক্লিক করুন।
  4. নিম্নলিখিত স্থির পরিপূরণ ব্যবহার করুন ( এজেন্টের মতে ):
  • We sell shirts, music or the tour movie.
  1. সংরক্ষণ করুন।

পৃষ্ঠার পরামিতি

একটি সেশন চলাকালীন ব্যবহারকারীর সরবরাহ করা মানগুলো ধারণ ও উল্লেখ করার জন্য প্যারামিটার ব্যবহার করা হয়। প্রতিটি প্যারামিটারের একটি নাম এবং একটি এনটিটি টাইপ থাকে। মার্চেন্ডাইজ অর্ডার করার জন্য আমাদের ন্যূনতম যে প্যারামিটারগুলো সংগ্রহ করতে হয়, সেগুলো হলো @Artist এবং @Merch । টি-শার্ট বা লং-স্লিভের জন্য আপনাকে @ShirtSize ও সংগ্রহ করতে হবে এবং যদি আপনি মিউজিক অর্ডার করতে চান, তাহলে আপনার একটি @Carrier এবং @Album name-ও প্রয়োজন হবে।

ঐ প্যারামিটারগুলোকে আবশ্যক হিসেবে চিহ্নিত করতে হবে। এবং একবার এটি আবশ্যক হয়ে গেলে, আপনার শেষ ব্যবহারকারীকে মনে রাখার জন্য কাস্টম প্রম্পট প্রদান করতে হবে, যাতে তিনি সঠিক উত্তর দেন এবং এই প্যারামিটারগুলো সংগ্রহ করা যায়। Dialogflow CX-এ এমন কয়েকটি পদ্ধতি রয়েছে যা আপনাকে এই কাজে সাহায্য করতে পারে।

উদাহরণস্বরূপ, আপনি প্যারামিটার বিভাগে কাস্টম স্ট্যাটিক ফুলফিলমেন্ট মেসেজ প্রদান করতে পারেন। যদি প্যারামিটারটি আবশ্যক হয়, তাহলে এই প্যারামিটার ফুলফিলমেন্টগুলো দেখানো হবে। এই রেসপন্স মেসেজগুলো রেসপন্স কিউ -তে যুক্ত হবে। একজন এজেন্টের পালা চলাকালীন, একাধিক ফুলফিলমেন্ট কল করা সম্ভব (এবং কখনও কখনও কাম্য), যার প্রত্যেকটি একটি রেসপন্স মেসেজ তৈরি করতে পারে। Dialogflow এই রেসপন্সগুলোকে একটি রেসপন্স কিউ- তে সংরক্ষণ করে। পেজ লাইফ সাইকেল এবং যে ক্রমে এই ফুলফিলমেন্টগুলো রেসপন্স কিউ-তে যুক্ত হবে সে সম্পর্কে আরও জানতে, Dialogflow CX Page Docs পড়ুন।

আর্টিস্ট ওভারভিউ পৃষ্ঠায় প্যারামিটার তৈরি করা

চলুন পৃষ্ঠার কিছু প্যারামিটার নির্ধারণ করা যাক:

  1. ক্যাটালগ ফ্লো-তে, আর্টিস্ট ওভারভিউ পেজটিতে ক্লিক করুন।
  2. প্যারামিটার ব্লকে থাকা + চিহ্নে ক্লিক করুন। আর্টিস্ট প্যারামিটারটি যোগ করুন:
  • প্রদর্শিত নাম: artist
  • সত্তার ধরণ: @Artist
  • প্রয়োজনীয়: যাচাই করুন
  • লগে গোপন করুন: পরীক্ষা করুন
  1. এখন আমরা কিছু কাস্টম প্যারামিটার পূরণের বার্তা যোগ করব। যদি ভার্চুয়াল এজেন্ট দ্বারা আর্টিস্ট প্যারামিটারটি এখনও সংগ্রহ করা না হয়ে থাকে, তাহলে শেষ ব্যবহারকারী রেসপন্স কিউতে এই এজেন্ট রেসপন্সটি পাবেন:

From which of these artists would you like to order merchandise?

  1. একটি দ্বিতীয় ডায়ালগ অপশন যোগ করুন যা সমৃদ্ধ সাজেশন চিপস প্রদান করে। 'অ্যাড ডায়ালগ অপশন'- এ ক্লিক করুন এবং এই কোডটি ( JSON ফরম্যাটে) ব্যবহার করুন:
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "The Google Dolls"
          },
          {
            "text": "The Goo Fighters"
          },
          {
            "text": "Alice Googler"
          },
          {
            "text": "G's N' Roses"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}

আপনার ব্যবহারকারী এই প্রশ্নগুলোর উত্তর দেওয়ার জন্য কতবার চেষ্টা করেছেন, তার উপর ভিত্তি করে বিভিন্ন ফলব্যাক ফুলফিলমেন্ট প্রম্পট পরিচালনা করা সম্ভব। আপনি প্যারামিটার ইভেন্ট হ্যান্ডলার ব্যবহার করে এটি করতে পারেন। বেছে নেওয়ার জন্য বিভিন্ন বিল্ট-ইন ইভেন্ট হ্যান্ডলার রয়েছে, যেমন ইনভ্যালিড প্যারামিটারস , আটারেন্সেস টু লং , নো ইনপুট , নো ইনপুট ফার্স্ট ট্রাই , সেকেন্ড ট্রাই , অথবা নো ম্যাচ । নো ইনপুট এবং নো ম্যাচের মধ্যে পার্থক্য হলো, নো ইনপুটের ক্ষেত্রে ব্যবহারকারী কখনোই কোনো উত্তর দেননি, যেখানে নো ম্যাচের ক্ষেত্রে ব্যবহারকারী উত্তর দিলেও Dialogflow CX সেটিকে কোনো পেজের সাথে ইন্টেন্ট ম্যাচ করতে পারেনি।

  1. Reprompt ইভেন্ট হ্যান্ডলার সেকশন পর্যন্ত স্ক্রল করুন।
  2. ইভেন্ট হ্যান্ডলার যোগ করুন- এ ক্লিক করুন এবং ইভেন্টটি নির্বাচন করুন: No-match default
  3. নিম্নলিখিত ইভেন্ট স্ট্যাটিক টেক্সট ফুলফিলমেন্ট ব্যবহার করুন:

I missed that. Please, specify the artist. You can choose between: Alice Googler, G's N' Roses, The Google Dolls or The Goo Fighters. Which artist do you want to buy merchandise from?

  1. সংরক্ষণ করুন ক্লিক করুন
  2. ইভেন্ট হ্যান্ডলার যোগ করুন -এ ক্লিক করুন এবং ইভেন্টটি নির্বাচন করুন: No-input default
  3. নিম্নলিখিত ইভেন্ট স্ট্যাটিক টেক্সট ফুলফিলমেন্ট ব্যবহার করুন:

I am sorry, I could understand the artist's name. You can choose between Alice Googler, G's N' Roses, The Google Dolls or The Goo Fighters. Which artist do you want to buy merchandise from?

  1. সংরক্ষণ করুন ক্লিক করুন

পৃষ্ঠার শর্ত রুট

পেজ কন্ডিশনাল রাউটের সাথে একত্রে প্যারামিটারগুলো খুবই শক্তিশালী। যখন কোনো শর্ত সত্য বলে প্রমাণিত হয়, তখন সংশ্লিষ্ট পেজ রাউটটি কল করা হবে। একটি শর্ত হতে পারে, একটি প্যারামিটার একটি নির্দিষ্ট মানের সমান হওয়া , অথবা একটি প্যারামিটার অনুপস্থিত থাকতে পারবে না , অথবা একটি ফর্ম পূরণ করা হয়েছে , এবং আরও অনেক কিছু। আপনি Dialogflow CX ডকুমেন্টেশনে প্যারামিটার এবং শর্ত সম্পর্কে আরও তথ্য পেতে পারেন।

আমাদের রিটেইল ভার্চুয়াল এজেন্টের জন্য ধারাবাহিকভাবে কিছু প্যারামিটার সংগ্রহ করতে হবে, এজন্য একটি 'ফর্ম' পূরণ করা হয়েছে কিনা তা যাচাই করার জন্য আমাদের একটি শর্ত তৈরি করতে হবে। ফর্ম হলো প্যারামিটারগুলোর একটি তালিকা, যা পেজটির জন্য এন্ড-ইউজারের কাছ থেকে সংগ্রহ করা উচিত। ভার্চুয়াল এজেন্টটি এন্ড-ইউজারের সাথে একাধিকবার কথোপকথন চালিয়ে যায়, যতক্ষণ না এটি ফর্মের সমস্ত প্রয়োজনীয় প্যারামিটার সংগ্রহ করে ফেলে, যেগুলো পেজ প্যারামিটার নামেও পরিচিত।

Dialogflow CX ফর্ম পূরণের সময় ব্যবহারকারীর দেওয়া প্যারামিটার মান স্বয়ংক্রিয়ভাবে সেট করে। বর্তমান পৃষ্ঠার সম্পূর্ণ ফর্মটি পূরণ করা হয়েছে কিনা তা পরীক্ষা করতে, নিম্নলিখিত শর্তটি ব্যবহার করুন: $page.params.status = "FINAL"

আর্টিস্ট ওভারভিউ পৃষ্ঠায় শর্তসাপেক্ষ রুট তৈরি করা

চলুন একটি শর্তসাপেক্ষ রুট তৈরি করি, যা শিল্পীর পরিচয় জানা গেলে পরবর্তী পৃষ্ঠায় নিয়ে যাবে:

  1. আর্টিস্ট ওভারভিউ পেইজের রুটস সেকশনে থাকা + আইকনে ক্লিক করুন।
  2. নিচে স্ক্রল করে কন্ডিশন সেকশনে যান।
  3. Select At least one (OR)
  4. এরপরে, আমরা এমন একটি রাশি লিখব যা
  • প্যারামিটার: $page.params.status
  • অপারেটর: =
  • মান: "FINAL"
  1. এখন, আমরা রুটে একটি নির্দিষ্ট স্ট্যাটিক ফুলফিলমেন্ট মেসেজ তৈরি করব, যা এন্ড ইউজারের পছন্দ নিশ্চিত করবে। ফুলফিলমেন্ট ব্লকে স্ক্রল ডাউন করুন এবং নিম্নলিখিত ফুলফিলমেন্ট মেসেজগুলো লিখুন:
  • $session.params.artist, great choice! Rock on!
  • You want to rock with $session.params.artist merchandise. Awesome!
  1. যখন শর্তটি সত্য হবে, তখন আপনাকে প্রোডাক্ট ওভারভিউ পেজে যেতে হবে। নিচে স্ক্রল করে ট্রানজিশন সেকশনে যান এবং নিম্নলিখিত পেজটি ব্যবহার করুন: Product Overview
  2. সংরক্ষণ করুন।

প্যারামিটার

প্রোডাক্ট ওভারভিউ পৃষ্ঠায় রুট তৈরি করা

এখন যেহেতু আমরা জানি কীভাবে প্যারামিটার এবং কন্ডিশনাল রাউট তৈরি করতে হয়, চলুন নিম্নলিখিত পেজগুলোর জন্য আরও প্যারামিটার তৈরি করি:

পণ্যের সংক্ষিপ্ত বিবরণ

  1. প্রোডাক্ট ওভারভিউ পেজে artist প্যারামিটার তৈরি করুন:
  • Display Name: artist
  • সত্তার ধরণ: @Artist
  • প্রয়োজনীয়: যাচাই করুন
  • লগে গোপন করুন: পরীক্ষা করুন
  • প্রাথমিক অনুরোধ পূরণ: From which of these artists would you like to order merchandise?
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "The Google Dolls"
          },
          {
            "text": "The Goo Fighters"
          },
          {
            "text": "Alice Googler"
          },
          {
            "text": "G's N' Roses"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}
  • ইভেন্ট হ্যান্ডলার > No-match default : To buy merchandise you can choose between the following artists: Alice Googler, G's N' Roses, The Google Dolls or The Goo Fighters. Which artist do you want to buy merchandise from?
  • কাস্টম পেলোড:
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "The Google Dolls"
          },
          {
            "text": "The Goo Fighters"
          },
          {
            "text": "Alice Googler"
          },
          {
            "text": "G's N' Roses"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}
  • ইভেন্ট হ্যান্ডলার > No-input default : To buy merchandise you can choose between the following artists: Alice Googler, G's N' Roses, The Google Dolls or The Goo Fighters. Which artist were you trying to mention?
  • কাস্টম পেলোড:
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "The Google Dolls"
          },
          {
            "text": "The Goo Fighters"
          },
          {
            "text": "Alice Googler"
          },
          {
            "text": "G's N' Roses"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}
  1. merch প্যারামিটার তৈরি করুন:
  • প্রদর্শিত নাম: merch
  • সত্তার ধরণ: @Merch
  • প্রয়োজনীয়: যাচাই করুন
  • লগে গোপন করুন: পরীক্ষা করুন
  • সরবরাহ: Which merchandise item do you want?
  • ক্লিক করুন: ডায়ালগ অপশন যোগ করুন > কাস্টম পেলোড :
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Shirts"
            },
            {
              "text": "Music"
            },
            {
              "text": "Tour movie"
            }
          ]
        }
      ]
    ]
  }
  • ইভেন্ট হ্যান্ডলার > No-match default
  • ইভেন্ট হ্যান্ডলার ফুলফিলমেন্ট: We sell Shirts, Music or the Tour movie. Which of these items do you want?
  • কাস্টম পেলোড:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Shirts"
            },
            {
              "text": "Music"
            },
            {
              "text": "Tour movie"
            }
          ]
        }
      ]
    ]
  }
  • ইভেন্ট হ্যান্ডলার > No-input default
  • ইভেন্ট হ্যান্ডলার ফুলফিলমেন্ট: I couldn't understand which merchandise item you wanted to buy. You can choose between: Shirts, Music or the Tour movie. Which item do you want?
  • কাস্টম পেলোড:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Shirts"
            },
            {
              "text": "Music"
            },
            {
              "text": "Tour movie"
            }
          ]
        }
      ]
    ]
  }
  1. এমন একটি রুট তৈরি করুন যা artist এবং merch আইটেম প্রদান করা হলে প্রোডাক্ট পেজে নিয়ে যাবে।
  • অবস্থা:
  • প্রতিটি নিয়ম মেলান (এবং)
  • এক্সপ্রেশন: $session.params.artist != null
  • Expression: $session.params.merch != null
  • পরিপূর্ণতা: Alright! $session.params.merch of $session.params.artist, let's go!
  • রূপান্তর: পৃষ্ঠা: Product
  1. ব্যবহারকারী "শার্ট" বললে তার জন্য একটি রুট তৈরি করুন।
  • উদ্দেশ্য: রিডাইরেক্ট.শার্টস
  • রূপান্তর: পৃষ্ঠা: Shirts
  1. ব্যবহারকারী যখন "Music" বলবে তখন একটি রুট তৈরি করুন।
  • উদ্দেশ্য: পুনঃনির্দেশ.সঙ্গীত
  • রূপান্তর: পৃষ্ঠা: Music
  1. ব্যবহারকারী যখন মূল্যের তথ্য জানতে চাইবে, তখন তার জন্য একটি রুট তৈরি করুন।
  • উদ্দেশ্য: পুনঃনির্দেশ.মূল্য
  • রূপান্তর: নতুন পৃষ্ঠা তৈরি করুন: Price

যখন আপনি উপরের কনফিগারেশনটি সেট করবেন, তখন আপনি নীচের ছবির মতো একটি ভিজ্যুয়ালাইজেশন দেখতে পাবেন। লক্ষ্য করুন যে ডায়াগ্রামে ইন্টেন্ট রুটগুলি নীল এবং কন্ডিশন রুটগুলি কমলা রঙের। যদিও দেখানো হয়নি, ইভেন্ট হ্যান্ডলারগুলি সবুজ রঙের, এবং যখন একাধিক রুট টাইপ একটি পৃষ্ঠায় ট্রানজিশন করে, তখন লাইনটি ধূসর হয়ে যাবে।

ক্যাটালগ প্রবাহের শুরু

এতক্ষণে আপনারা শিখেছেন কীভাবে প্যারামিটার- ভিত্তিক স্টেট হ্যান্ডলার, যেমন— ইনটেন্ট রাউট এবং কন্ডিশনাল রাউট ব্যবহার করে ফ্লো , এনটিটি , ইনটেন্ট এবং পেজ তৈরি করতে হয়। এই ল্যাবের পরবর্তী অংশে, আমরা ইনপুটের উপর ভিত্তি করে বিভিন্ন ডায়ালগ দেখানোর জন্য ফুলফিলমেন্টে কন্ডিশনাল ব্রাঞ্চিং ব্যবহার করব।

আমাদের ভার্চুয়াল এজেন্টকে চূড়ান্ত করতে আপনি নিম্নলিখিত কনফিগারেশনগুলো ব্যবহার করতে পারেন।

শার্ট পাতা:

  1. শার্ট পেজে নিম্নলিখিত কনফিগারেশনগুলো তৈরি করুন:
  • প্রবেশপত্র পূরণ: Do you want a longsleeve or a t-shirt?
  • এন্ট্রি পূরণের কাস্টম পেলোড:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "T-shirt"
            },
            {
              "text": "Longsleeve"
            },
            {
              "text": "Price?"
            }
          ]
        }
      ]
    ]
  }
  1. Price পেজে ট্রানজিশন সহ redirect.price নামে একটি ইনটেন্ট রুট তৈরি করুন।
  2. নিম্নলিখিত প্যারামিটারটি তৈরি করুন:
  • প্যারামিটার: merch - এনটিটি টাইপ: @Merch , Required এবং Redact in log
  • প্যারামিটার > ইভেন্ট হ্যান্ডলার > No-match default
  • প্যারামিটার > ইভেন্ট হ্যান্ডলার ফুলফিলমেন্ট: You can choose between a t-shirt or a longsleeve. Which of these do you want?
  • প্যারামিটার > ইভেন্ট হ্যান্ডলার ফুলফিলমেন্ট কাস্টম পেলোড:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "T-shirt"
            },
            {
              "text": "Longsleeve"
            }
          ]
        }
      ]
    ]
  }
  • প্যারামিটার > ইভেন্ট হ্যান্ডলার > No-input default
  • প্যারামিটার > ইভেন্ট হ্যান্ডলার ফুলফিলমেন্ট: I couldn't understand if you want the t-shirt or the longsleeve. Which of these do you want?
  • প্যারামিটার > ইভেন্ট হ্যান্ডলার ফুলফিলমেন্ট কাস্টম পেলোড:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "T-shirt"
            },
            {
              "text": "Longsleeve"
            }
          ]
        }
      ]
    ]
  }
  1. এন্ট্রি ফুলফিলমেন্ট-এ ক্লিক করুন এবং প্যারামিটার প্রিসেট পর্যন্ত স্ক্রল ডাউন করুন, প্রতিবার যখন শার্টস পেজটি সক্রিয় হবে, ক্যাটাগরি প্যারামিটারটি শার্টস -এ সেট হয়ে যাবে।

প্যারামিটার

মূল্য

category

shirts

  1. একটি শর্তসাপেক্ষ রুট যোগ করুন:
  • অন্তত একটি নিয়ম মেলান (অথবা)
  • এক্সপ্রেশন: $session.params.merch = "T-shirt"
  • এক্সপ্রেশন: $session.params.merch = "Longsleeve"
  • নতুন পৃষ্ঠায় যান: Shirt Size

মূল্য পৃষ্ঠা:

যেহেতু দামের বার্তাগুলো নির্বাচিত পণ্য বা বিভাগের (সঙ্গীত বা শার্ট) উপর নির্ভর করবে, তাই আমরা এই অংশটি পরে ল্যাবে ঠিক করব। আপাতত শুধু একটি প্লেসহোল্ডার প্রবেশ করানোই যথেষ্ট।

  1. মূল্য পৃষ্ঠায় নিম্নলিখিত কনফিগারেশনগুলি তৈরি করুন:
  • এন্ট্রি পূরণ: PRICE TODO

Since you can request the price from various places in the conversation, it should always give you an answer and transfer you back to the previous part of the dialogue, to continue the order. There are 5 places in the dialogue tree where you can branch of to get price information. (Shirt, Shirt Size, Music, Carrier and also direct via an Intent Route), thus we will need some conditional routes to move back:

  1. Add a conditional Route:
  • Match Every rule (AND)
  • Expression: $session.params.category = "shirts"
  • Expression: $session.params.merch = "null"
  • Transition to new page: Shirts
  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $session.params.category = "shirts"
  • Expression: $session.params.size = "null"
  • Transition to new page: Shirt Size
  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $session.params.category = "music"
  • Expression: $session.params.album = "null"
  • Transition to new page: Music
  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $session.params.category = "music"
  • Expression: $session.params.merch = "null"
  • Transition to new page: Carrier
  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $session.params.category = "null"
  • Transition to new page: Product Overview

Shirt Size Page:

  1. Create the following configurations in the Shirt Size Page:
  • Entry fulfillment: What shirt size do you want?
  • Entry fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "XS"
            },
            {
              "text": "S"
            },
            {
              "text": "M"
            },
            {
              "text": "L"
            },
            {
              "text": "XL"
            },
            {
              "text": "2XL"
            },
            {
              "text": "3XL"
            }
          ]
        }
      ]
    ]
  }
  1. Create an Intent route : redirect.price with a transition to the Price Page.
  2. Create the following parameter:
  • Parameter: shirtsize - Entity Type: @ShirtSize - Required , Redact In Log
  • Parameter > Event Handler > No-match default
  • Parameter > Event Handler Fulfillment: Please tell me the shirt size, such as XL.
  • Parameter > Event Handler Fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "XS"
            },
            {
              "text": "S"
            },
            {
              "text": "M"
            },
            {
              "text": "L"
            },
            {
              "text": "XL"
            },
            {
              "text": "2XL"
            },
            {
              "text": "3XL"
            }
          ]
        }
      ]
    ]
  }
  • Parameter > Event Handler > No-input default
  • Parameter > Event Handler Fulfillment: I couldn't understand the shirt size. What size do you want?
  • Parameter > Event Handler Fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "XS"
            },
            {
              "text": "S"
            },
            {
              "text": "M"
            },
            {
              "text": "L"
            },
            {
              "text": "XL"
            },
            {
              "text": "2XL"
            },
            {
              "text": "3XL"
            }
          ]
        }
      ]
    ]
  }
  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $page.params.shirtsize != "null"
  • Transition to Page: Product

Music Page:

  1. Create the following configurations in the Music Page:
  • Entry fulfillment: We have a Greatest Hits Album or the Live Album. Which one do you want?
  • Entry fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Greatest Hits"
            },
            {
              "text": "Live"
            },
            {
              "text": "Price?"
            }
          ]
        }
      ]
    ]
  }
  1. Create an Intent Route : redirect.price with a transition to Page: Price .
  2. Create the following parameter:
  • Parameter: album - Entity Type: @Album - Required , Redact In Log
  • Parameter > Event Handler > No-match default
  • Parameter > Event Handler Fulfillment: You can choose between Greatest Hits and Live Album. Which of these do you want?
  • Parameter > Event Handler Fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Greatest Hits"
            },
            {
              "text": "Live"
            }
          ]
        }
      ]
    ]
  }
  • Parameter > Event Handler > No-input default
  • Parameter > Event Handler Fulfillment: I couldn't understand if you want the album: Greatest Hit or Live. Which of these do you want?
  • Parameter > Event Handler Fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Greatest Hits"
            },
            {
              "text": "Live"
            }
          ]
        }
      ]
    ]
  }
  1. Click on the entry fulfillment and scroll down to Parameter presets , each time when the Music page gets active, the category parameter will be set to music :

প্যারামিটার

মূল্য

category

music

  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $page.params.album != "null"
  • Transition to Page: Carrier

Carrier Page:

  1. Create the following configurations in the Carrier Page:
  • Entry fulfillment: Do you want this album on CD or MP3?
  • Entry fulfillment Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "CD"
            },
            {
              "text": "MP3"
            },
            {
              "text": "Price?"
            }
          ]
        }
      ]
    ]
  }
  1. Create an Intent route : redirect.price which transitions to the Price Page.
  2. Create the following parameter:
  • Parameter: merch - Entity Type: @Merch - Required , Redact In Log
  • Parameter > Event Handler > No-match default
  • Parameter > Event Handler Fulfillment: Do you want a physical CD or the digital album?
  • Parameter > Event Handler Fulfillment: Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "CD"
            },
            {
              "text": "Digital Album"
            }
          ]
        }
      ]
    ]
  }
  • Parameter > Event Handler > No-input default
  • Parameter > Event Handler Fulfillment: I couldn't understand if you mean CD or MP3. Which one do you want?
  • Parameter > Event Handler Fulfillment: Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "CD"
            },
            {
              "text": "MP3"
            }
          ]
        }
      ]
    ]
  }
  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $page.params.merch != "null"
  • Transition to Page: Product

Product Page:

  1. Create the following parameters:

Parameter Displayname

Parameter Entity Type

চেক

artist

@Artist

Required, Redact in log

merch

@Merch

Required, Redact in log

  1. The artist parameter needs the following initial prompt fulfillment, which will be shown when the artist isn't known. You didn't mention which artist you are interested in. You can ask me to buy the $session.params.merch of the artist you like or ask which artists we signed. How can I help?
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "Which artists?"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}
  • Also add a No-input default event handler with fulfillment: I couldn't understand what you just said. Ask me which artists are signed.
  • And a No-match default event handler with fulfillment: I missed that. Please ask me which artists are signed.
  1. The merch parameter needs reprompt event handlers as well.
  • Add a No-input default event handler with fulfillment: I couldn't understand what you just said. Which merchandise item do you want?
  • And a No-match default event handler with fulfillment: I missed that. Which merchandise item do you want?

The next route will transition to the confirmation page when the artist is known and the user chooses a "Tour Movie".

  1. Add a Conditional Route:
  • Match Every rule (AND)
  • Expression: $session.params.artist != null
  • Expression: $session.params.merch = "Tour Movie"
  • Parameter Presets Add Parameter > price = 25
  • Transition to new page: Confirmation

The next route will transition to the confirmation page when the artist is known and the user chooses a "T-shirt" and the shirt size is chosen.

  1. Add a Conditional Route:
  • Custom Expression: $session.params.artist != null AND $session.params.merch = "T-shirt" AND $session.params.shirtsize != null
  • Parameter Presets Add Parameter > price = 25
  • Transition to page: Confirmation

The next route will transition to the confirmation page when the artist is known and the user chooses a "Longsleeve" and the shirt size is chosen.

  1. Add a Conditional Route:
  • Custom Expression: $session.params.artist != null AND $session.params.merch = "Longsleeve" AND $session.params.shirtsize != null
  • Parameter Presets Add Parameter > price = 30
  • Transition to page: Confirmation

The next route will transition to the confirmation page when the artist is known and the user chooses a "CD" also the album name is chosen.

  1. Add a Conditional Route:
  • Custom Expression: $session.params.artist != null AND $session.params.merch = "CD" AND $session.params.album != null
  • Parameter Presets Add Parameter > price = 15
  • Transition to page: Confirmation

The next route will transition to the confirmation page when the artist is known and the user chooses a "Digital Album" and the album name is chosen.

  1. Add a Conditional Route:
  • Custom Expression: $session.params.artist != null AND $session.params.merch = "Digital Album" AND $session.params.album != null
  • Parameter Presets Add Parameter > price = 10
  • Transition to page: Confirmation

Next, we will now make some advanced conditionals with prompts that detect missing information. The next route will transition back to the music page when the artist is known and the user chooses a "CD" or a "Digital Album" but the album name was not chosen.

  1. Add a Conditional Route:
  • Custom Expression: $session.params.artist != null AND ($session.params.merch = "CD" OR $session.params.merch = "Digital Album") AND $session.params.album = null
  • Fulfillment: I would also need to know which album you would like to buy!
  • Transition to page: Music

And the last route will transition to the confirmation page when the artist is known and the user choose a "T-shirt" or a "Longsleeve", but when t-shirt size was not chosen.

  1. Add a conditional Route:
  • Custom Expression: $session.params.artist != null AND ($session.params.merch = "T-shirt" OR $session.params.merch = "Longsleeve") AND $session.params.shirtsize = null
  • Fulfillment: I would also need to know which shirt size you need!
  • Transition to page: Shirt Size

In the next part of the lab, we will make use of conditional fulfillments to give different fulfillment messages depending on the input.

7. Conditional Responses

Some responses will return a different dialogue based on the input, The dialogues will branch off, we call this conditional responses . This can become interesting, when you are not making use of webhook fulfillments, where the conditional responses were determined on the back-end. An example could look like:

if [condition]
  [response]
elif [condition]
  [response]
elif [condition]
  [response]
else
  [response]
endif
  • An example of a [condition] could be: $session.params.user-age >= 21 . It uses a similar formatting as the conditions in the routes.
  • An [response] takes the static text response
  • Conditional responses always start with if
  • elif and else blocks are optional

Dialogflow CX can also make use of built-in system functions to make use of. For example to format a date or time, or to display the current time ( $sys.func.NOW() )

Let's finalize the Catalog flow, by fixing the Confirmation and Price Pages.

Confirmation Page:

Now we will build the confirmation page. It has the following requirements:

  • If merch is CD or Digital Album . We will show the following fields in the confirmation: artist , merch , album and price .
  • If merch is T-shirt or Longsleeve . We will show the following fields in the confirmation: artist , merch , size and price .
  • Else (and thus if merch is Tour Movie ). We will show the following fields in the confirmation: artist , merch and price .
  1. Click on the Confirmation Page.
  2. Click Edit Fulfillment > Agent Responses > Add dialogue option > Conditional Response :
if ($session.params.merch = "CD" OR $session.params.merch = "Digital Album")
  The $session.params.merch: $session.params.artist - $session.params.album costs $$session.params.price. Shall I continue to order?
elif ($session.params.merch = "T-shirt" OR $session.params.merch = "Longsleeve")
  A $session.params.merch of $session.params.artist size: $session.params.shirtsize costs $$session.params.price. Shall I continue to order?
elif $session.params.merch = "Tour Movie"
  The $session.params.merch of $session.params.artist costs $$session.params.price. Shall I continue to order?
else
  It looks like something went wrong with your order. You can say "Reset", to restart the order process.
endif
  1. Create the following Custom payload:
  • Custom payload:
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "Yes, confirm"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}

Next, create two intent routes:

  1. confirm.proceed.order transitions to: Order Process Flow.
  2. decline.proceed.order transitions to End Flow

When the user declines the order, and does not want to proceed the order process, we will have to transition back to the welcome page, but all the parameters have to be cleared. We can do this by specifically setting null to all the possible parameters. You can do this with Parameter presets.

  1. In the decline.proceed.order intent route, scroll down to Parameter presets and add the following parameters:

Parameter

Value

artist

null

merch

null

shirtsize

null

category

null

album

null

price

null

restart

true

Notice that we have created an additional parameter called restart. If this parameter is present, the Default Start Flow, should know to continue the conversation by showing a customized message.

  1. Click on the Default Start Flow, Start Page, and create another Conditional Route:
  • $session.params.restart = "true"
  • Fulfillment: "Welcome back, as the virtual agent of G-Records, I can help you order artists merchandise, you can ask questions about your order or shipping, and I can tell you more which artists are currently signed with us. How can I help?"
  • Custom payload:
{
    "richContent": [
      [
        {
          "type": "chips",
          "options": [
            {
              "text": "Which artists?"
            },
            {
              "text": "Which products?"
            },
            {
              "text": "About my order..."
            }
          ]
        }
      ]
    ]
  }
  1. Select the Start Page and click on the redirect.end intent. Create the following fulfillment: Thank you for contacting G-Records! Have a nice day!

Price Page:

Let's also fix the Price TODOs. The price information will be static for now. Click on the Price Page in the Catalog Flow, and use the following entry fulfillment:

  • Delete the Agent Says entry fulfillment.
  • Create a new Conditional Response:
if $session.params.category = "shirts"
  A t-shirt costs $25 and a longsleeve costs $30.
elif $session.params.category = "music"
  A CD costs $15. The digital album on MP3 costs $10.
else
  A t-shirt costs $25 and a longsleeve costs $30. A CD costs $15 and a digital album on MP3 $10. In case you are interested in the Tour Movie, that one is $25.
endif

Conditional Responses

Well done, by now you completed the Catalog flow. Your flow should look similar to this diagram:

8. Wrapping up the agent

We are almost at the end of this lab. Let's configure the last flows together, and take in practice all the new things that we have learned.

Creating the My Order Flow

  1. Go to the My Order Flow, and create the following intent transitions:

Page (In Flow)

Routes > Intent

Routes > Transition To

My Order Start

redirect.my.order

My Order

My Order Start

redirect.my.order.status

My Order Status

My Order Start

redirect.my.order.canceled

My Order Cancellation

My Order Start

redirect.end

End Session

My Order Start

redirect.home

End Flow

My Order

redirect.my.order.status

My Order Status

My Order

redirect.my.order.canceled

My Order Cancellation

Default Start Flow

redirect.my.order.canceled

Flow: My Order

Default Start Flow

redirect.my.order.status

Flow: My Order

  1. Let's create the following entry fulfillment for the My Order Page:
  • Entry fulfillment: I can look up the status of your order, or I can cancel an order.
  1. In the My Order Page create the following parameter:
  • Displayname: ordernumber
  • Entity Type: @OrderNumber
  • Required: checked
  • Initial prompt fulfillment: What's the order number? For example ABCD123.
  • Event Handler: No-match default: To proceed with your order I will need an order number. Order numbers start with 4 characters and end with 3 numbers, such as ABCD123. Which order number may I use?
  • Event Handler: No-input default: I missed that. To proceed with your order I will need an order number. Order numbers start with 4 characters and end with 3 numbers, such as ABCD123. Which order number may I use?
  1. Create the following conditional route:
  • Customize Expression: $page.params.status = "FINAL"
  • Fulfillment: And do you want to Cancel your order, or should I look up the status?
  1. Click on Add state handler > Event Handlers and create the Event Handler: No-input default
  • Fulfillment: I'm sorry, what was that? Would you like me to cancel an order or look up the status?
  • Custom payload:
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "Status"
          },
          {
            "text": "Cancel"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}
  1. Create the Event Handler: No-match default
  • Fulfillment: Would you like me to cancel an order or lookup the status?
  • Custom payload:
{
  "richContent": [
    [
      {
        "options": [
          {
            "text": "Status"
          },
          {
            "text": "Cancel"
          }
        ],
        "type": "chips"
      }
    ]
  ]
}
  1. In the My Order Status Page create the following parameter:
  • Displayname: ordernumber
  • Entity Type: @OrderNumber
  • Required checked
  • Initial prompt fulfillment: What's the order number? For example ABCD123.
  • Event Handler: No-match default: To proceed with your order I will need an order number. Order numbers start with 4 characters and end with 3 numbers, such as ABCD123. Which order number may I use?
  • Event Handler: No-input default: I missed that. To proceed with your order I will need an order number. Order numbers start with 4 characters and end with 3 numbers, such as ABCD123. Which order number may I use?
  1. In the My Order Status Page create the following conditional route:
  • Customize Expression: $session.params.ordernumber != null
  • Fulfillment: Your order $session.params.ordernumber has been shipped, it can take up to approx 2 weeks before you will receive your items.
  • Add dialogue option > Text: Is there anything else I can help you with?
  1. In the My Order Cancelation Page create the following parameter:
  • Displayname: ordernumber
  • Entity Type: @OrderNumber
  • Required checked
  • Initial prompt fulfillment: What's the order number? For example ABCD123.
  • Event Handler: No-match default: To proceed with your order I will need an order number. Order numbers start with 4 characters and end with 3 numbers, such as ABCD123. Which order number may I use?
  • Event Handler: No-input default: I missed that. To proceed with your order I will need an order number. Order numbers start with 4 characters and end with 3 numbers, such as ABCD123. Which order number may I use?
  1. In the My Order Cancelation Page create the following conditional route:
  • Customize Expression: $session.params.ordernumber != null
  • Fulfillment: Your order $session.params.ordernumber has been canceled.
  • Add dialogue option > Text: Is there anything else I can help you with?
  1. Test the flow and create the following two test scenarios:
>"About my order"
>"ABCD123"
>"Status"

And:

>"What's the status of order DEFG222"
  1. Select the Start Page and click on the redirect.end intent. Create the following fulfillment: Thank you for contacting G-Records! Have a nice day!
  2. Select the Start Page and click on the redirect.home intent. Create the following parameter preset: restart = true

Default Negative intents (Fallback)

When you create a virtual agent, a default negative intent is created for you. You can add training phrases to this intent that act as negative examples that will trigger a No-match event. There may be cases where end-user input has a slight resemblance to training phrases in normal intents, but you do not want these inputs to match any normal intents.

  1. Try in the simulator: I don't like Alice Googler.

You will see that the virtual agent answers with the Product Overview Page, to continue ordering Alice Googler merchandise. However, your end user does not like that artist. Let's use the Default Negative Intent for this.

  1. Go to Manage > Intents and select the Default Negative Intent.
  2. Add the following training phrases that will trigger the No-match event.
  • I don't like Alice Googler
  • I am not a fan of G's N' Roses
  • I can't stand the music of the Google Dolls
  1. Hit Save and test the following sentence in the simulator: I am really not a fan of the Goo Fighters

This time the No-match event was triggered, you stayed on the Start Page.

Default Fallback Messages

  1. Click the Default Start Flow, select the sys.no-input-default event handler.

The No-input fallback basically means: No text or speech answers were detected. Likely no answers were given, or the system couldn't hear it. Therefore, let's make the fallback messages more specific. Use the tab key, to create alternative dialogues:

  1. Remove all answers, and add these text dialogues:
  • I'm sorry, I didn't receive an answer. Can you say it again?
  • I missed your answer, can you say it again?
  • Sorry, I didn't hear anything. Can you say it again?
  • I couldn't hear what you were saying, what was that?
  • I'm sorry, I missed your answer. What were you trying to say?

Don't forget to click Save.

  1. Click the Default Start Flow, select the sys.no-match-default event handler.

The No Match fallback basically means: Text or speech answers were detected but nothing in Dialogflow CX got matched.

  1. Remove all answers, and add these text dialogues:
  • Sorry, I didn't get that. Can you please rephrase?
  • I'm sorry, I don't understand. Can you please rephrase?
  • I don't understand, please rephrase.
  • Sorry, I didn't get that. What was that?
  • I didn't get that, can you please rephrase?

Don't forget to click Save.

  1. It's advised to repeat these steps for the Catalog, My Order, Order Process and Customer Care flows.

Here's a tip: when creating fallback messages, make them more explicit, by rephrasing the previous question or by mentioning an example. You could create these type of No-match and No-input events on Page level when creating parameters. In our labs, we have already done this.

Creating the Order Process Flow

  1. Go to the Order Process Flow, and create the following intent transitions:

Page (In Flow)

Routes > Intent

Routes > Transition To

Order Process Start

redirect.end

End Session

Order Process Start

redirect.home

End Flow

Order Process Start

confirm.proceed.order

New Page: Shipping Details

  1. Let's create the following entry fulfillment for the Shipping Details Page:
  • Entry fulfillment: To complete your order I will first need to collect your shipping details.
  1. Create the following parameters:

These parameters will make use of built-in system entities. System entity support differs for each language. See the docs for more information.

Parameter Display name

Entity

Required?

Initial prompt fulfillment

No-match default

No-input default

firstname

@sys.person

Required

What's your first name?

I'm sorry I missed that. What's the first name?

I'm sorry, I didn't understand. What's the first name?

lastname

@sys.person

Required

What's your last name?

I'm sorry I missed that. What's the last name?

I'm sorry, I didn't understand. What's the last name?

address

@sys.address

Required

What's your address?

I missed that. What's the address?

I'm sorry, I didn't understand. What's the address?

zipcode

@sys.any

Required

What postal code or zipcode do you have?

I'm sorry, what's the zip or postal code? For example: 1234AB or 10001.

I'm sorry, I didn't understand. What's the zip or postal code? For example: 1234AB or 10001.

city

@sys.geo-city

Required

What's the name of the city?

I missed that, what's the name of the city?

I'm sorry, I didn't understand. What's the name of the city?

country

@sys.geo-country

Required

What's the name of the country?

I missed that, what's the name of the country?

I'm sorry, I didn't understand. What's the name of the country?

email

@sys.email

Required

Lastly, what's your email address?

I am sorry. What's the email address? For example name@domain.com.

I am sorry, I didn't understand. What's the email address? For example name@domain.com.

  1. Create the following conditional route:
  • Customize Expression: $page.params.status = "FINAL"
  • Transition to new Page: Payment Details
  1. Create the following entry fulfillment.

Let's fake it that this virtual agent makes use of Google Pay. Don't worry this tutorial won't make real transactions. Create the following entry dialogues:

  • Agent Says:
Alright $session.params.firstname! We will make use of Google Pay, that's connected to your email account: $session.params.email.
  • Conditional Response
if $session.params.merch != "Digital Album"
  Shipping costs an additional 5 dollars. This will make the total price $$sys.func.TO_TEXT($sys.func.ADD($session.params.price, 5)).
  Your merchandise will be shipped to:
  $session.params.firstname $session.params.lastname
  $session.params.address
  $session.params.zipcode $session.params.city
  $session.params.country
  To continue the order process please explicitly say "I confirm". Do you want to confirm your $session.params.artist $session.params.merch order?
else
  The total costs will be: $$session.params.price.
  After purchasing the digital album, you will receive an email with the download link.
  To continue the order process please explicitly say "I confirm".
  Do you want to confirm your $session.params.artist $session.params.merch order?
endif
  1. Create the following Intent Route
  • Intent: confirm.proceed.order
  • Agent Says: Thank you for your order! Your merchandise will be shipped today!
  • Add Dialogue Option > Text: Here's the order number: ABCD123 .
  • Add Dialogue Option > Text: Have a good day!
  • Transition: End Session
  1. Select the Start Page and click on the redirect.end intent. Create the following fulfillment: Thank you for contacting G-Records! Have a nice day!
  2. Select the Start Page and click on the redirect.home intent. Create the following parameter preset: restart = true

Awesome! By now we have a fully working realworld retailer chatbot! In the next lab, we will test how well the virtual agent performs!

9. Test your virtual agent

You can use the built-in simulator to test the dialogues of your virtual agent. The advantage of testing the flows in the simulator is that you will see a nice overview of flows, pages, parameters, and (DTMF) events that the simulator collected while walking through your flows. This makes testing easier than testing it directly in an integration, as those types of information will be hidden from the end user. It's even possible to create test cases, save and reuse those test cases. This makes a lot of sense, for when you maintain or edit your flows over time, and you want to be sure that none of your changes break your previous work.

It is also possible to export and import previously made test cases, by storing the tests in Google Cloud Storage or local. Exporting a test will download a blob file. To learn more about the simulator and test cases check out the Simulator / Test Cases Docs .

Before creating some test cases, let's first finalize the rest of our virtual agent:

Creating the Customer Care Flow

  1. Go to the Customer Care Flow, and create the following intent transitions:

Page (In Flow)

Routes > Intent

Routes > Transition To

Customer Care Start

redirect.shipping.info

শিপিং

Customer Care Start

redirect.refund.info

ফেরত

Customer Care Start

redirect.swapping.info

অদলবদল

Customer Care Start

redirect.home

End Flow

Customer Care Start

redirect.end

অধিবেশন শেষ করুন

Customer Care Flow

  1. Create the following entry fulfillments for the Shipping Page:
  • Shipping physical merchandise items can take up to 2 weeks.
  • Is there anything else I can help you with?
  1. Create the following entry fulfillments for the Refund Page:
  • We offer free returns and refunds. We provide one free return label for each order. You can use it within 30 days from receiving your order. If your refund is accepted, we will refund the price you paid for your item back to your original payment method.
  • Is there anything else I can help you with?
  1. Create the following entry fulfillments for the Swapping Page:
  • If you would like to change your item for a different one, please return your unwanted item and place a new order. If your refund is accepted, we will refund the price you paid for your item back to your original payment method.
  • Is there anything else I can help you with?
  1. Select the Start Page and click on the redirect.end intent. Create the following fulfillment: Thank you for contacting G-Records! Have a nice day!
  2. Select the Start Page and click on the redirect.home intent. Create the following parameter preset: restart = true

Create test cases

  1. Click the Test Agent button on the right side of the screen.

When you first open the simulator, you need to select an agent environment and active flow. In most cases, you should use the draft environment and default start flow.

  1. Type: Hi

Customer Care Flow

  1. Ask: Which artists are signed with your label?
  2. Say: The Google Dolls
  3. Say: I am interested in buying a shirt
  4. Say: A t-shirt
  5. Say: Medium
  6. Now click on the save test case button. Which you can find in the top of the simulator (next to the redo arrow, and reset trash bin icon)

Customer Care Flow

  1. Give it the following details:
  • Test case name: Buy Google Dolls t-shirt size M
  • Tags: #catalog, #shirts, #t-shirt, #TheGoogleDolls
  1. সংরক্ষণ করুন ক্লিক করুন

Let's create more test cases.

  1. First clear the current dialogue, by clicking on the Reset (thrash bin) icon.
  2. Create the following test cases:

Buy the Alice Googler t-shirt:

>"Buy the Alice Googler t-shirt."
>"XL"
  • Test case name: Buy the Alice Googler t-shirt
  • Tags: #catalog, #shirts, #t-shirt, #AliceGoogler

Buy a t-shirt size M: (Note the Artist name hasn't been mentioned, but you do want to skip the bands overview, products overview, shirts and shirt size pages)

>"Buy a t-shirt size M"
>"The Google Fighters"
  • Test case name: Buy a t-shirt size M
  • Tags: #catalog, #shirts, #t-shirt, #TheGoogleFighters
  • Description: (Note the Artist name hasn't been mentioned, but you do want to skip the bands overview, products overview, shirts and shirt size pages)

Purchase Music of G's N' Roses (Note this will skip the bands overview and products overview page)

>"Purchase music of G's N' Roses"
>"Live"
>"CD"
  • Test case name: Purchase music of G's N' Roses
  • Tags: #catalog, #music, #CD, #GsNRoses, #live
  • Description: (Note this will skip the bands overview and products overview page)

Check price information:

>"Which products"
>"Shirts"
>"What's the price difference?"
>"Longsleeve"
>"What does it cost?"
>"M"
>"The Google Dolls"
>"No"
>"Which bands"
>"The Gooo Fighters"
>"Music"
>"How much does it cost?"
>"Greatest Hits"
>"What's the price difference?"
>"Mp3"
>"No"
>"I want to buy the tour movie"
>"Alice Googler"
>"Yes"
  • Test case name: Price info
  • Tags: #catalog, #music, #tourmovie, #shirts
  • Description: Test price info on various points in the dialogue

Test pre-recorded test cases

  1. Select Manage > Test Cases in the Dialogflow main menu on the left.
  2. Select all the test cases and press the Run button, above the table.

Dialogflow CX will run all the selected test cases against the recording that was saved as a "Golden Test Case", if the results are the same as how you saved it, then the tests are passed. - Did something change in the flows like Pages that are not correctly configured, or intents that directed you to the wrong pages, then the tests will fail.

Test Cases

  1. In the simulator ask the following question: How long will shipping take?
  2. Note the result, and save the test case as Shipping with the tag: #shipping .
  3. Go to the Manage > Test Cases panel and press the Run button on the top right of the grid, to run only the Shipping test case.

This test should pass.

  1. Go back to the Customer Care Flow, Select the Start Page and click on the Routes header.

This will show a screen with a grid that shows all the routes.

  1. Remove the redirect.shipping.info route
  2. Go to the Manage > Test Cases panel and press the Run button on the top right of the grid, to run only the Shipping test case.

This test should fail.

  1. You can click on the failed test, to see the details of the fail.

In this case the test failed with the below error message:

Page: Page mismatch:
Expected: Shipping
Actual: Start Page

The reason for this is because the page doesn't exist in the flow anymore. We expected the Shipping Page, but instead we never moved away from the Start Page. (or your end-users would receive a fallback message.)

With other words, this is a missed request, a False Negative Test result. The test failed. We expected the Shipping Page, but nothing happens, or a fallback message was shown.

  1. Go back to the Customer Care Flow, and add the redirect.shipping.info as an intent route, to the Start Page. Don't forget to transition to the Shipping Page and hit Save .
  2. In the simulator record the following test case: I want to swap my item , save this test case as Swapping #swapping .
  3. Open Manage >Intents > redirect.refund.info and add the following training phrase: I want to swap this item for a refund

Without that training phrase, when a user would ask to change an item for a refund, it would hit the redirect.swapping.info intent, but we don't want to give information on changing items, we want to give information on refunds.

  1. Create the following golden test case: I want to swap this item for a refund in the simulator, and save this test case as Swap for Refund #refund
  2. Go back to the Manage >Intents > redirect.refund.info intent, and remove the I want to swap this item for a refund line.
  3. Go back to Manage > Test Cases , select the Swap for Refund test case, and Run it.

Your latest test failed, with the below error message:

If you would like to change your item for a different one, please return your unwanted item and place a new order. If your refund is accepted, we will refund the price you paid for your item back to your original payment method.`
Is there anything else I can help you with?
 Page: Page mismatch:
Expected: Refund
Actual: Swapping

With other words, this is a missed understood request, a False Positive Test result. The test failed. We expected the Refund Page, but Swapping Page became active.

কভারেজ

In Dialogflow CX, test coverage is a measure used to describe the degree to which the dialogue of the virtual agent (Pages and Intents) is executed when a particular test suite runs. A virtual agent with high test coverage, measured as a percentage, has had more of its dialogues executed during testing, which suggests it has a lower chance of containing undetected bugs (like missed understood requests) compared to a virtual agent with low test coverage.

  1. To view a test coverage report for all test cases, click Coverage .
  2. Click on the tab Transitions .

This will show you the test coverage for all the page transitions.

Transitions Coverage

  1. Click on the tab Intents .

This will show you the test coverage for all the intents.

Intents Coverage

Congratulations, by now you have built and tested a complete real world example of a retailer bot! Let's go to the next lab page to read the conclusion and find some handy references!

১০. উপসংহার

Dialogflow CX is a Conversational AI Platform (CAIP) for creating virtual agents like chat or voice bots. Dialogflow CX empowers your team to accelerate creating enterprise-level conversational experiences through visual bot builders, reusable intents, and the ability to address multi-turn conversations.

In this codelab, you have learned how to build a real world retail virtual agent. We addressed the following concepts:

  • প্রবাহ
  • Parameters, Custom & System Entities
  • পৃষ্ঠাগুলি
  • State Handlers like Intent Routes and Condition Routes
  • Static Fulfillment Messages and Conditional Responses
  • Fallback intents
  • Simulator, Test Cases and Coverage

চূড়ান্ত ফলাফল

তথ্যসূত্র

To learn more about Dialogflow CX have a look into the following blogs and documentation!