सामान्य जवाब (Dialogflow)

Dialogflow में जानें

Dialogflow में हमारे जवाबों के सैंपल को इंपोर्ट करने के लिए, जारी रखें पर क्लिक करें. इसके बाद, सैंपल को डिप्लॉय और टेस्ट करने के लिए, यह तरीका अपनाएं:

  1. एजेंट का नाम डालें और सैंपल के लिए, नया Dialogflow एजेंट बनाएं.
  2. एजेंट इंपोर्ट हो जाने के बाद, एजेंट पर जाएं पर क्लिक करें.
  3. मुख्य नेविगेशन मेन्यू से, पूरा किया गया पर जाएं.
  4. इनलाइन एडिटर को चालू करें. इसके बाद, डिप्लॉय करें पर क्लिक करें. एडिटर में सैंपल कोड होता है.
  5. मुख्य नेविगेशन मेन्यू में, इंटिग्रेशन पर जाएं. इसके बाद, Google Assistant पर क्लिक करें.
  6. इसके बाद दिखने वाली मोडल विंडो में, बदलावों की ऑटो-झलक देखने की सुविधा को चालू करें. इसके बाद, ऐक्शन सिम्युलेटर खोलने के लिए, जांच करें पर क्लिक करें.
  7. नमूने की जांच करने के लिए सिम्युलेटर में, Talk to my test app डालें!
जारी रखें

आसान जवाब, विज़ुअल तौर पर चैट बबल के रूप में होते हैं. इनमें आवाज़ के लिए, लिखाई को बोली में बदलने (टीटीएस) या स्पीच सिंथेसिस मार्कअप लैंग्वेज (एसएसएमएल) का इस्तेमाल किया जाता है.

टीटीएस टेक्स्ट का इस्तेमाल, डिफ़ॉल्ट रूप से चैट बबल कॉन्टेंट के तौर पर किया जाता है. अगर उस टेक्स्ट का विज़ुअल आसपेक्ट आपकी ज़रूरतों के हिसाब से है, तो आपको चैट बबल के लिए कोई डिसप्ले टेक्स्ट तय करने की ज़रूरत नहीं है.

अपनी सेट की गई कार्रवाई में इन विज़ुअल एलिमेंट को शामिल करने का तरीका जानने के लिए, हमारे बातचीत डिज़ाइन करने से जुड़े दिशा-निर्देश भी देखे जा सकते हैं.

प्रॉपर्टी

पहली इमेज. जवाब देने का आसान उदाहरण (स्मार्टफ़ोन)

आसान रिस्पॉन्स में यहां दी गई ज़रूरी शर्तें और वैकल्पिक प्रॉपर्टी होती हैं, जिन्हें कॉन्फ़िगर किया जा सकता है:

  • actions.capability.AUDIO_OUTPUT या actions.capability.SCREEN_OUTPUT क्षमताओं वाले प्लैटफ़ॉर्म पर काम करती है.
  • हर चैट बबल में 640 वर्ण की सीमा. सीमा से ज़्यादा लंबी स्ट्रिंग को 640 वर्णों से पहले पहले वर्ड ब्रेक (या खाली सफ़ेद जगह) पर काट दिया जाता है.

  • चैट बबल कॉन्टेंट, एक फ़ोनेटिक सबसेट या TTS/SSML आउटपुट की पूरी ट्रांसक्रिप्ट होनी चाहिए. इससे उपयोगकर्ताओं को आपकी बातों को समझने में मदद मिलती है और कई स्थितियों में उन्हें समझना आसान हो जाता है.

  • हर बार ज़्यादा से ज़्यादा दो चैट बबल की सुविधा हो.

  • Google को सबमिट किया जाने वाला चैट हेड (लोगो) 192x192 पिक्सल का होना चाहिए और उसे ऐनिमेट नहीं किया जा सकता.

दूसरी इमेज. जवाब देने के लिए आसान उदाहरण (स्मार्ट डिसप्ले)

नमूना कोड

Node.js

app.intent('Simple Response', (conv) => {
  conv.ask(new SimpleResponse({
    speech: `Here's an example of a simple response. ` +
      `Which type of response would you like to see next?`,
    text: `Here's a simple response. ` +
      `Which response would you like to see next?`,
  }));
});

Java

@ForIntent("Simple Response")
public ActionResponse welcome(ActionRequest request) {
  ResponseBuilder responseBuilder = getResponseBuilder(request);
  responseBuilder.add(
      new SimpleResponse()
          .setTextToSpeech(
              "Here's an example of a simple response. "
                  + "Which type of response would you like to see next?")
          .setDisplayText(
              "Here's a simple response. Which response would you like to see next?"));
  return responseBuilder.build();
}

Node.js

conv.ask(new SimpleResponse({
  speech: `Here's an example of a simple response. ` +
    `Which type of response would you like to see next?`,
  text: `Here's a simple response. ` +
    `Which response would you like to see next?`,
}));

Java

ResponseBuilder responseBuilder = getResponseBuilder(request);
responseBuilder.add(
    new SimpleResponse()
        .setTextToSpeech(
            "Here's an example of a simple response. "
                + "Which type of response would you like to see next?")
        .setDisplayText(
            "Here's a simple response. Which response would you like to see next?"));
return responseBuilder.build();

JSON

ध्यान दें कि नीचे दिया गया JSON, वेबहुक रिस्पॉन्स के बारे में बताता है.

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "Here's an example of a simple response. Which type of response would you like to see next?",
              "displayText": "Here's a simple response. Which response would you like to see next?"
            }
          }
        ]
      }
    }
  }
}

JSON

ध्यान दें कि नीचे दिया गया JSON, वेबहुक रिस्पॉन्स के बारे में बताता है.

{
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "possibleIntents": [
        {
          "intent": "actions.intent.TEXT"
        }
      ],
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "Here's an example of a simple response. Which type of response would you like to see next?",
                "displayText": "Here's a simple response. Which response would you like to see next?"
              }
            }
          ]
        }
      }
    }
  ]
}

एसएसएमएल और साउंड

अपने जवाबों में एसएसएमएल और आवाज़ों का इस्तेमाल करने से, उन्हें और बेहतर बनाया जाता है. साथ ही, उपयोगकर्ता अनुभव को बेहतर बनाया जाता है. नीचे दिए गए कोड स्निपेट, SSML का इस्तेमाल करने वाले रिस्पॉन्स बनाने का तरीका बताते हैं:

Node.js

app.intent('SSML', (conv) => {
  conv.ask(`<speak>` +
    `Here are <say-as interpet-as="characters">SSML</say-as> examples.` +
    `Here is a buzzing fly ` +
    `<audio src="https://actions.google.com/sounds/v1/animals/buzzing_fly.ogg"></audio>` +
    `and here's a short pause <break time="800ms"/>` +
    `</speak>`);
  conv.ask('Which response would you like to see next?');
});

Java

@ForIntent("SSML")
public ActionResponse ssml(ActionRequest request) {
  ResponseBuilder responseBuilder = getResponseBuilder(request);
  responseBuilder.add(
      "<speak>"
          + "Here are <say-as interpet-as=\"characters\">SSML</say-as> examples."
          + "Here is a buzzing fly "
          + "<audio src=\"https://actions.google.com/sounds/v1/animals/buzzing_fly.ogg\"></audio>"
          + "and here's a short pause <break time=\"800ms\"/>"
          + "</speak>");
  return responseBuilder.build();
}

Node.js

conv.ask(`<speak>` +
  `Here are <say-as interpet-as="characters">SSML</say-as> examples.` +
  `Here is a buzzing fly ` +
  `<audio src="https://actions.google.com/sounds/v1/animals/buzzing_fly.ogg"></audio>` +
  `and here's a short pause <break time="800ms"/>` +
  `</speak>`);
conv.ask('Which response would you like to see next?');

Java

ResponseBuilder responseBuilder = getResponseBuilder(request);
responseBuilder.add(
    "<speak>"
        + "Here are <say-as interpet-as=\"characters\">SSML</say-as> examples."
        + "Here is a buzzing fly "
        + "<audio src=\"https://actions.google.com/sounds/v1/animals/buzzing_fly.ogg\"></audio>"
        + "and here's a short pause <break time=\"800ms\"/>"
        + "</speak>");
return responseBuilder.build();

JSON

ध्यान दें कि नीचे दिया गया JSON, वेबहुक रिस्पॉन्स के बारे में बताता है.

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "<speak>Here are <say-as interpet-as=\"characters\">SSML</say-as> examples.Here is a buzzing fly <audio src=\"https://actions.google.com/sounds/v1/animals/buzzing_fly.ogg\"></audio>and here's a short pause <break time=\"800ms\"/></speak>"
            }
          },
          {
            "simpleResponse": {
              "textToSpeech": "Which response would you like to see next?"
            }
          }
        ]
      }
    }
  }
}

JSON

ध्यान दें कि नीचे दिया गया JSON, वेबहुक रिस्पॉन्स के बारे में बताता है.

{
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "possibleIntents": [
        {
          "intent": "actions.intent.TEXT"
        }
      ],
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "<speak>Here are <say-as interpet-as=\"characters\">SSML</say-as> examples.Here is a buzzing fly <audio src=\"https://actions.google.com/sounds/v1/animals/buzzing_fly.ogg\"></audio>and here's a short pause <break time=\"800ms\"/></speak>"
              }
            },
            {
              "simpleResponse": {
                "textToSpeech": "Which response would you like to see next?"
              }
            }
          ]
        }
      }
    }
  ]
}

ज़्यादा जानकारी के लिए, SSML रेफ़रंस दस्तावेज़ देखें.

साउंड लाइब्रेरी

हम अपनी साउंड लाइब्रेरी में, बिना कोई शुल्क दिए कई तरह की शॉर्ट साउंड उपलब्ध कराते हैं. ये साउंड आपके लिए होस्ट किए गए हैं. इसलिए, आपको बस इन्हें अपने एसएसएमएल में शामिल करना है.