Knowledge connectors

Knowledge connectors complement defined intents. They parse documents (for example, FAQs or articles) to find automated responses. To configure them, you define one or more knowledge bases, which are collections of documents. You can enable knowledge bases for your agent, so all detect intent requests may find automated responses using your knowledge bases. Alternatively, you can specify one or more knowledge bases in your individual detect intent requests.

It is common for an agent using knowledge connectors to also use defined intents. Knowledge connectors offer less response precision and control than intents. When using both intents and knowledge connectors, you should define your intents to handle complex user requests that require special handling and precision, and let knowledge connectors handle simple requests with responses automatically extracted from your documents. When you identify content in FAQs that you want to expand on, you can convert the questions into defined intents, giving you full control.

For a list of supported languages, see the Knowledge Connectors column on the Languages page.

Before you begin

You should do the following before reading this guide:

  1. Read Dialogflow basics.
  2. Perform setup steps.

Create an agent

The steps in this guide make assumptions about your agent, so it's best to start with a new agent. You should delete any existing agent for your project before creating a new one. To delete an existing agent:

  1. Go to the Dialogflow Console.
  2. If requested, sign in to the Dialogflow Console. See Dialogflow console overview for more information.
  3. Select the agent you wish to delete.
  4. Click the settings settings button next to the agent's name.
  5. Scroll down to the bottom of the General settings tab.
  6. Click Delete this agent.
  7. Enter DELETE in the text field.
  8. Click Delete.

To create an agent:

  1. Go to the Dialogflow Console.
  2. If requested, sign in to the Dialogflow Console. See Dialogflow console overview for more information.
  3. Click Create Agent in the left sidebar menu. (If you already have other agents, click the agent name, scroll to the bottom and click Create new agent.)
  4. Enter your agent's name, default language, and default time zone.
  5. If you have already created a project, enter that project. If you want to allow the Dialogflow Console to create the project, select Create a new Google project.
  6. Click the Create button.

Enable beta features

You may need to enable the beta API:

  1. Go to the Dialogflow Console
  2. Select an agent
  3. Click the settings settings button next to the agent's name
  4. Scroll down while on the General tab and ensure that Beta Features is enabled
  5. If you have made changes, click Save

Create a knowledge base

A knowledge base contains information about the documents that will be used by Dialogflow when looking for responses to user requests. The samples below show you how to use the Dialogflow Console, REST API (including command line), or client libraries to create a knowledge base. To use the API, call the create method on the KnowledgeBase type.

Web UI

Use the Dialogflow Console to create a knowledge base:

  1. Go to the Dialogflow Console
  2. Select an agent
  3. Click Knowledge on the left sidebar menu
  4. Click Create Knowledge Base
  5. Enter a knowledge base name
  6. Click Save

Knowledge connector left panel screenshot

REST & CMD LINE

Call the create method on the KnowledgeBase type.

Before using any of the request data below, make the following replacements:

  • project-id: your GCP project ID
  • knowledge-base-display-name: desired knowledge base name

HTTP method and URL:

POST https://dialogflow.googleapis.com/v2beta1/projects/project-id/knowledgeBases

Request JSON body:

{
  "displayName": "knowledge-base-display-name"
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/project-id/knowledgeBases/NDA4MTM4NzE2MjMwNDUxMjAwMA",
  "displayName": "knowledge-base-display-name"
}

Take note of the value of the name field. This is the name of your new knowledge base. The path segment after knowledgeBases is your new knowledge base ID. Save this ID for requests below.

Java


/**
 * Create a Knowledge base
 *
 * @param projectId   Project/agent id.
 * @param displayName Name of the knowledge base.
 * @return The created KnowledgeBase.
 */
public static KnowledgeBase createKnowledgeBase(String projectId, String displayName)
    throws Exception {
  // Instantiates a client
  try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
    KnowledgeBase knowledgeBase = KnowledgeBase.newBuilder().setDisplayName(displayName).build();
    ProjectName projectName = ProjectName.of(projectId);
    KnowledgeBase response = knowledgeBasesClient.createKnowledgeBase(projectName, knowledgeBase);
    System.out.format("Knowledgebase created:\n");
    System.out.format("Display Name: %s \n", response.getDisplayName());
    System.out.format("Knowledge ID: %s \n", response.getName());

    return response;
  }
}

Node.js

// Imports the Dialogflow client library
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow client.
const client = new dialogflow.KnowledgeBasesClient();

/**
 * TODO(developer): Uncomment the following lines before running the sample.
 */
// const projectId = 'ID of GCP project associated with your Dialogflow agent';
// const displayName = `your knowledge base display name, e.g. myKnowledgeBase`;

const formattedParent = client.projectPath(projectId);
const knowledgeBase = {
  displayName: displayName,
};
const request = {
  parent: formattedParent,
  knowledgeBase: knowledgeBase,
};

const [result] = await client.createKnowledgeBase(request);
console.log(`Name: ${result.name}`);
console.log(`displayName: ${result.displayName}`);

Python

def create_knowledge_base(project_id, display_name):
    """Creates a Knowledge base.

    Args:
        project_id: The GCP project linked with the agent.
        display_name: The display name of the Knowledge base."""
    import dialogflow_v2beta1 as dialogflow
    client = dialogflow.KnowledgeBasesClient()
    project_path = client.project_path(project_id)

    knowledge_base = dialogflow.types.KnowledgeBase(
        display_name=display_name)

    response = client.create_knowledge_base(project_path, knowledge_base)

    print('Knowledge Base created:\n')
    print('Display Name: {}\n'.format(response.display_name))
    print('Knowledge ID: {}\n'.format(response.name))

Add a document to the knowledge base

Your new knowledge base currently has no documents, so let's add a document to it. We will use the Cloud Storage FAQ document for this example. You can use any FAQ document; the FAQ parser is capable of handling most FAQ formats. See Supported content below for a description of all supported content options.

The samples below show you how to use the Dialogflow Console, REST API (including command line), or client libraries to create a knowledge document. To use the API, call the create method on the Document type.

Web UI

Use the Dialogflow Console to create a knowledge document:

  1. If you are not continuing from steps above, navigate to your knowledge base settings:
    1. Go to the Dialogflow Console
    2. Select an agent
    3. Click Knowledge on the left sidebar menu
    4. Click your knowledge base name
  2. Click New Document or Create the first one
  3. Enter a document name
  4. Select text/html for Mime Type
  5. Select FAQ for Knowledge Type
  6. Select URL for Data Source
  7. Enter https://cloud.google.com/storage/docs/faq in the URL field
  8. Click CREATE

Knowledge connector new doc screenshot

REST & CMD LINE

Before using any of the request data below, make the following replacements:

  • project-id: your GCP project ID
  • knowledge-base-id: your knowledge base ID returned from previous request
  • document-display-name: desired knowledge document name

HTTP method and URL:

POST https://dialogflow.googleapis.com/v2beta1/projects/project-id/knowledgeBases/knowledge-base-id/documents

Request JSON body:

{
  "displayName": "document-display-name",
  "mimeType": "text/html",
  "knowledgeTypes": "FAQ",
  "contentUri": "https://cloud.google.com/storage/docs/faq"
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/project-id/operations/ks-add_document-MzA5NTY2MTc5Mzg2Mzc5NDY4OA"
}

The path segment after operations is your operation ID. Creating a document is a long-running operation, so it may take a substantial amount of time to complete. You can poll the status of this operation to see if it has completed. For more information, see Long-running operations.

Java


/**
 * @param knowledgeBaseName Knowledge Base id.
 * @param displayName       display name of the Document.
 * @param mimeType          MIME type of the Document. e.g. text/csv, text/html
 * @param knowledgeType     Knowledge Type of the Document. e.g. FAQ, EXTRACTIVE_QA
 * @param contentUri        Uri of the Document. e.g. gs://path/mydoc.csv, http://mypage.com/faq.html
 * @return The created document.
 */
public static Document createDocument(
    String knowledgeBaseName,
    String displayName,
    String mimeType,
    String knowledgeType,
    String contentUri)
    throws Exception {
  // Instantiates a client
  try (DocumentsClient documentsClient = DocumentsClient.create()) {
    Document document =
        Document.newBuilder()
            .setDisplayName(displayName)
            .setContentUri(contentUri)
            .setMimeType(mimeType)
            .addKnowledgeTypes(KnowledgeType.valueOf(knowledgeType))
            .build();
    CreateDocumentRequest createDocumentRequest =
        CreateDocumentRequest.newBuilder()
            .setDocument(document)
            .setParent(knowledgeBaseName)
            .build();
    OperationFuture<Document, KnowledgeOperationMetadata> response =
        documentsClient.createDocumentAsync(createDocumentRequest);
    Document createdDocument = response.get();
    System.out.format("Created Document:\n");
    System.out.format(" - Display Name: %s\n", createdDocument.getDisplayName());
    System.out.format(" - Knowledge ID: %s\n", createdDocument.getName());
    System.out.format(" - MIME Type: %s\n", createdDocument.getMimeType());
    System.out.format(" - Knowledge Types:\n");
    for (KnowledgeType knowledgeTypeId : document.getKnowledgeTypesList()) {
      System.out.format("  - %s \n", knowledgeTypeId.getValueDescriptor());
    }
    System.out.format(" - Source: %s \n", document.getContentUri());
    return createdDocument;
  }
}

Node.js

// Imports the Dialogflow client library
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow Documents client.
const client = new dialogflow.DocumentsClient({
  projectId: projectId,
});

/**
 * TODO(developer): Uncomment the following lines before running the sample.
 */
// const projectId = 'ID of GCP project associated with your Dialogflow agent';
// const knowledgeBaseFullName = `the full path of your knowledge base, e.g my-Gcloud-project/myKnowledgeBase`;
// const documentPath = `path of the document you'd like to add, e.g. https://dialogflow.com/docs/knowledge-connectors`;
// const documentName = `displayed name of your document in knowledge base, e.g. myDoc`;
// const knowledgeTypes = `The Knowledge type of the Document. e.g. FAQ`;
// const mimeType = `The mime_type of the Document. e.g. text/csv, text/html,text/plain, text/pdf etc.`;

const request = {
  parent: knowledgeBaseFullName,
  document: {
    knowledgeTypes: [knowledgeTypes],
    displayName: documentName,
    contentUri: documentPath,
    source: `contentUri`,
    mimeType: mimeType,
  },
};

const [operation] = await client.createDocument(request);
const [response] = await operation.promise();
console.log(`Document created`);
console.log(`Content URI...${response.contentUri}`);
console.log(`displayName...${response.displayName}`);
console.log(`mimeType...${response.mimeType}`);
console.log(`name...${response.name}`);
console.log(`source...${response.source}`);

Python

def create_document(project_id, knowledge_base_id, display_name, mime_type,
                    knowledge_type, content_uri):
    """Creates a Document.

    Args:
        project_id: The GCP project linked with the agent.
        knowledge_base_id: Id of the Knowledge base.
        display_name: The display name of the Document.
        mime_type: The mime_type of the Document. e.g. text/csv, text/html,
            text/plain, text/pdf etc.
        knowledge_type: The Knowledge type of the Document. e.g. FAQ,
            EXTRACTIVE_QA.
        content_uri: Uri of the document, e.g. gs://path/mydoc.csv,
            http://mypage.com/faq.html."""
    import dialogflow_v2beta1 as dialogflow
    client = dialogflow.DocumentsClient()
    knowledge_base_path = client.knowledge_base_path(project_id,
                                                     knowledge_base_id)

    document = dialogflow.types.Document(
        display_name=display_name, mime_type=mime_type,
        content_uri=content_uri)

    document.knowledge_types.append(
        dialogflow.types.Document.KnowledgeType.Value(knowledge_type))

    response = client.create_document(knowledge_base_path, document)
    print('Waiting for results...')
    document = response.result(timeout=90)
    print('Created Document:')
    print(' - Display Name: {}'.format(document.display_name))
    print(' - Knowledge ID: {}'.format(document.name))
    print(' - MIME Type: {}'.format(document.mime_type))
    print(' - Knowledge Types:')
    for knowledge_type in document.knowledge_types:
        print('    - {}'.format(KNOWLEDGE_TYPES[knowledge_type]))
    print(' - Source: {}\n'.format(document.content_uri))

Settings for knowledge connectors

To access knowledge connector settings:

  1. Go to the Dialogflow Console
  2. Select an agent
  3. Click Knowledge on the left sidebar menu

You can enable one or more knowledge bases for your agent. Enabled knowledge bases will be used for all detect intent requests, unless overridden by specifying specific knowledge bases in a request. Select knowledge bases in the settings and click ENABLE or DISABLE to enable or disable the selected knowledge bases.

You can also set the ADJUST KNOWLEDGE RESULTS PREFERENCE value. This value is used by Dialogflow when a detect intent request has potential intent and knowledge base matches. See Detect intent responses.

Rich responses and integrations

You can use knowledge connectors with rich responses and Integrations:

  1. If you are not continuing from steps above, navigate to your knowledge base settings:
    1. Go to the Dialogflow Console.
    2. Select an agent.
    3. Click Knowledge on the left sidebar menu.
    4. Click your knowledge base name.
  2. Scroll down to the Responses section and add responses as desired:
    1. When defining the first response for the intent, use $Knowledge.Question[1] and $Knowledge.Answer[1] where you want the question and answer to be supplied.
    2. The index for $Knowledge.Question and $Knowledge.Answer starts at 1, so increase this index when adding more responses.
  3. Click SAVE once you are done editing.

When defining responses, you should consider these points:

  • If the number of defined responses is greater than the number N of knowledge connector response matches, only N responses will be returned.
  • Given that the accuracy could be lower than matching explicitly defined intents, we recommend returning three or more responses to your users when possible.

Example:

Knowledge connector integration screenshot

Detect intent with knowledge base

When performing a detect intent request, you can specify one or more knowledge bases for a possible response.

The samples below show you how to use the Dialogflow Console, REST API (including command line), or client libraries to detect intent. To use the API, call the detectIntent method on the Sessions type.

Web UI

You can interact with the agent and receive knowledge connector responses via the Dialogflow simulator:

  1. Follow the steps above to enable a knowledge base.
  2. Follow the steps above to define responses.
  3. Type "How do I sign up?" in the simulator.

REST & CMD LINE

Call the detectIntent method on the Sessions type and specify the knowledge base in the queryParams field.

Before using any of the request data below, make the following replacements:

  • project-id: your GCP project ID
  • knowledge-base-id: your knowledge base ID

HTTP method and URL:

POST https://dialogflow.googleapis.com/v2beta1/projects/project-id/agent/sessions/123456789:detectIntent

Request JSON body:

{
 "queryInput": {
   "text": {
     "text": "How do I sign up?",
     "languageCode": "en-US"
   }
 },
 "queryParams": {
   "knowledgeBaseNames": ["projects/project-id/knowledgeBases/knowledge-base-id"]
 }
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  ...
  "queryResult": {
    "queryText": "How do I sign up?",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentText": "Sign up for Cloud Storage by turning on the Cloud Storage service in the Google Cloud Platform Console.",
    "intent": {
      "name": "projects/my-gcp-project/agent/intents/487c7242-a769-408a-a339-47b95e10dac4",
      "displayName": "Knowledge.KnowledgeBase.MzkzNTAyMDE3NDQxNDk3MDg4MA"
    },
    "intentDetectionConfidence": 0.99371547,
    "languageCode": "en-us",
    "knowledgeAnswers": {
      "answers": [
        {
          "answer": "Sign up for Cloud Storage by turning on the Cloud Storage service in the Google Cloud Platform Console.",
          "matchConfidenceLevel": "HIGH",
          "matchConfidence": 0.99371547
        },
        {
          "answer": "Certain types of content are not allowed on this service; please refer to the Terms of Services and Platform Policies for details. If you believe a piece of content is in violation of our policies, report it here (select See more products, then Google Cloud Storage and Cloud Bigtable).",
          "matchConfidenceLevel": "LOW",
          "matchConfidence": 0.0012244871
        },
        {
          "answer": "From the Cloud Storage documentation click \"Send feedback\" near the top right of the page. This will open a feedback form. Your comments will be reviewed by the Cloud Storage team.",
          "matchConfidenceLevel": "LOW",
          "matchConfidence": 0.0011537358
        }
      ]
    }
  }
}

Java


/**
 * Returns the result of detect intent with text as input.
 *
 * <p>Using the same `session_id` between requests allows continuation of the conversation.
 *
 * @param projectId         Project/Agent Id.
 * @param knowledgeBaseName Knowledge base Id.
 * @param sessionId         Identifier of the DetectIntent session.
 * @param languageCode      Language code of the query.
 * @param texts             The texts to be processed.
 * @return The KnowledgeAnswers found for each text.
 */
public static Map<String, KnowledgeAnswers> detectIntentKnowledge(
    String projectId,
    String knowledgeBaseName,
    String sessionId,
    String languageCode,
    List<String> texts) throws Exception {
  // Instantiates a client
  Map<String, KnowledgeAnswers> allKnowledgeAnswers = Maps.newHashMap();
  try (SessionsClient sessionsClient = SessionsClient.create()) {
    // Set the session name using the sessionId (UUID) and projectID (my-project-id)
    SessionName session = SessionName.of(projectId, sessionId);
    System.out.println("Session Path: " + session.toString());

    // Detect intents for each text input
    for (String text : texts) {
      // Set the text and language code (en-US) for the query
      Builder textInput = TextInput.newBuilder().setText(text).setLanguageCode(languageCode);
      // Build the query with the TextInput
      QueryInput queryInput = QueryInput.newBuilder().setText(textInput).build();

      QueryParameters queryParameters =
          QueryParameters.newBuilder()
              .addKnowledgeBaseNames(knowledgeBaseName)
              .build();

      DetectIntentRequest detectIntentRequest =
          DetectIntentRequest.newBuilder()
              .setSession(session.toString())
              .setQueryInput(queryInput)
              .setQueryParams(queryParameters)
              .build();
      // Performs the detect intent request
      DetectIntentResponse response = sessionsClient.detectIntent(detectIntentRequest);

      // Display the query result
      QueryResult queryResult = response.getQueryResult();

      System.out.format("Knowledge results:\n");
      System.out.format("====================\n");
      System.out.format("Query Text: '%s'\n", queryResult.getQueryText());
      System.out.format(
          "Detected Intent: %s (confidence: %f)\n",
          queryResult.getIntent().getDisplayName(), queryResult.getIntentDetectionConfidence());
      System.out.format("Fulfillment Text: '%s'\n", queryResult.getFulfillmentText());
      KnowledgeAnswers knowledgeAnswers = queryResult.getKnowledgeAnswers();
      for (Answer answer : knowledgeAnswers.getAnswersList()) {
        System.out.format(" - Answer: '%s'\n", answer.getAnswer());
        System.out.format(" - Confidence: '%s'\n", answer.getMatchConfidence());
      }

      KnowledgeAnswers answers = queryResult.getKnowledgeAnswers();
      allKnowledgeAnswers.put(text, answers);
    }
  }
  return allKnowledgeAnswers;
}

Node.js

// Imports the Dialogflow client library
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow client.
const sessionClient = new dialogflow.SessionsClient();

/**
 * TODO(developer): Uncomment the following lines before running the sample.
 */
// const projectId = 'ID of GCP project associated with your Dialogflow agent';
// const sessionId = `user specific ID of session, e.g. 12345`;
// const languageCode = 'BCP-47 language code, e.g. en-US';
// const knowledgeBaseFullName = `the full path of your knowledge base, e.g my-Gcloud-project/myKnowledgeBase`;
// const query = `phrase(s) to pass to detect, e.g. I'd like to reserve a room for six people`;

// Define session path
const sessionPath = sessionClient.sessionPath(projectId, sessionId);
const knowbase = new dialogflow.KnowledgeBasesClient();
const knowledgeBasePath = knowbase.knowledgeBasePath(
  projectId,
  knowledgeBaseFullName
);

// The audio query request
const request = {
  session: sessionPath,
  queryInput: {
    text: {
      text: query,
      languageCode: languageCode,
    },
  },
  queryParams: {
    knowledgeBaseNames: [knowledgeBasePath],
  },
};

const responses = await sessionClient.detectIntent(request);
const result = responses[0].queryResult;
console.log(`Query text: ${result.queryText}`);
console.log(`Detected Intent: ${result.intent.displayName}`);
console.log(`Confidence: ${result.intentDetectionConfidence}`);
console.log(`Query Result: ${result.fulfillmentText}`);
if (result.knowledgeAnswers && result.knowledgeAnswers.answers) {
  const answers = result.knowledgeAnswers.answers;
  console.log(`There are ${answers.length} answer(s);`);
  answers.forEach(a => {
    console.log(`   answer: ${a.answer}`);
    console.log(`   confidence: ${a.matchConfidence}`);
    console.log(`   match confidence level: ${a.matchConfidenceLevel}`);
  });
}

Python

def detect_intent_knowledge(project_id, session_id, language_code,
                            knowledge_base_id, texts):
    """Returns the result of detect intent with querying Knowledge Connector.

    Args:
    project_id: The GCP project linked with the agent you are going to query.
    session_id: Id of the session, using the same `session_id` between requests
              allows continuation of the conversation.
    language_code: Language of the queries.
    knowledge_base_id: The Knowledge base's id to query against.
    texts: A list of text queries to send.
    """
    import dialogflow_v2beta1 as dialogflow
    session_client = dialogflow.SessionsClient()

    session_path = session_client.session_path(project_id, session_id)
    print('Session path: {}\n'.format(session_path))

    for text in texts:
        text_input = dialogflow.types.TextInput(
            text=text, language_code=language_code)

        query_input = dialogflow.types.QueryInput(text=text_input)

        knowledge_base_path = dialogflow.knowledge_bases_client \
            .KnowledgeBasesClient \
            .knowledge_base_path(project_id, knowledge_base_id)

        query_params = dialogflow.types.QueryParameters(
            knowledge_base_names=[knowledge_base_path])

        response = session_client.detect_intent(
            session=session_path, query_input=query_input,
            query_params=query_params)

        print('=' * 20)
        print('Query text: {}'.format(response.query_result.query_text))
        print('Detected intent: {} (confidence: {})\n'.format(
            response.query_result.intent.display_name,
            response.query_result.intent_detection_confidence))
        print('Fulfillment text: {}\n'.format(
            response.query_result.fulfillment_text))
        print('Knowledge results:')
        knowledge_answers = response.query_result.knowledge_answers
        for answers in knowledge_answers.answers:
            print(' - Answer: {}'.format(answers.answer))
            print(' - Confidence: {}'.format(
                answers.match_confidence))

Detect intent responses

The response for the Sessions type detectIntent method is a DetectIntentResponse. Multiple factors affect how response fields are populated.

If a defined intent and a knowledge base are both potential matches, the match confidence of each and the knowledge results preference (see Settings for knowledge connectors) are used to determine which match is the selected match. The selected match is populated in the DetectIntentResponse.queryResult field, and other potential matches are populated in the DetectIntentResponse.alternativeQueryResults field. Both of these fields contain QueryResult messages.

If a knowledge base provides a potential match:

  • QueryResult.knowledgeAnswers is populated with a list of potential knowledge answers ordered by decreasing match confidence.
  • If rich responses have been defined for the knowledge base, QueryResult.fulfillmentMessages is populated with rich response messages.

When performing a detect intent request, it is possible for the knowledge query to fail. When this happens, defined intents will be selected, so the overall detect intent request will not fail. You can find knowledge query error information in the DetectIntentResponse.alternativeQueryResults[i].diagnosticInfo field.

Supported content

The following table shows the supported MIME types by Knowledge Type and Source.

Knowledge Type \ Source Uploaded file (Document.content) (NOT recommended) Uploaded file (Document.raw_content) (recommended) File from Cloud Storage (Document.contentUri) File from public URL (Document.contentUri)
FAQ text/csv text/csv text/csv text/html
Knowledge Base Article text/plain, text/html text/plain, text/html, application/pdf text/plain, text/html, application/pdf N/A

Document content has the following known issues, limitations, and best practices:

General:

  • Files from public URLs must have been crawled by the Google search indexer, so that they exist in the search index. You can check this with the Google Search Console.
  • CSV files must use commas as delimiters.
  • We currently support using either FAQ or Knowledge Base Articles in your agent, but not both. Confidence scores are not yet calibrated between FAQs and Knowledge Base Articles, so if you use both FAQ and Knowledge Base Articles, the best result may not always be the highest.
  • Dialogflow removes HTML tags from content when creating responses. Because of this, it's best to avoid HTML tags and use plain text when possible.
  • Google Assistant responses have a 640 character limit per chat bubble, so long answers are truncated when integrating with Google Assistant.
  • The maximum document size depends on your edition and pricing plan:
    • Standard: 50 MB
    • Essentials: 50 MB
    • Plus: unlimited
  • When using Cloud Storage files, you should either use public URIs or private URIs that your user account or service account has access to.

Specific to FAQ:

  • CSV must have questions in the first column and answers in the second, with no header.
  • Use CSV whenever possible, because CSV is parsed most accurately.
  • Public HTML content with a single QA pair is not supported.
  • The number of QA pairs in one document should not exceed 2000.
  • Duplicate questions with different answers is not supported.

Specific to Knowledge Base Article:

  • Knowledge Base Article is currently experimental. It is based on similar technologies that have been tried and tested at Google in products like Search and Assistant. Send us your feedback on how well it works for Dialogflow.
  • Content with dense text works best. Avoid content with many single sentence paragraphs.
  • Tables and lists are not supported.
  • The number of paragraphs in one document should not exceed 2000.
  • If an article is long (> 1000 words), try to break it down into multiple, smaller articles. If the article covers multiple issues, it can be broken into shorter articles covering the individual issues. If the article only covers one issue, then focus the article on the issue description and keep the issue resolution short.
  • Ideally, only the core content of an article should be provided (issue description and resolution). Additional content like author name, modification history, related links, and ads are not important.
  • Try to include a description for the issues an article can help with and/or sample queries that this article can answer.
Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...

Dialogflow Documentation
Trenger du hjelp? Gå til brukerstøttesiden vår.