1. Help Center
  2. Pulse
  3. Tips & tricks for effective Instructions

How to write an instruction for limiting chatbot knowledge to a specific source

It's possible to restrict the chatbot's responses to information provided from a specific source. This ensures that the chatbot only responds from that source. In this article you will read how to instruct the chatbot on this.

Step 1: Source identification

Begin by identifying the source from which the chatbot will retrieve its information. This could either be a document that you have uploaded through the Document Scraper tool or a specific URL that you have added using the Web Crawler tool. Then you can define the Source URL.

The Source URL from a Document can be found by downloading that document from the Document Scraper and copying and pasting the URL from the browser. 

In the Web Crawler sources the Source URL is the scraped URL. 

In some cases it's necessary to convert the URL into a PDF file and add that to the Document Scraper, to make sure the chatbot understands it can only use the information from that specific URL.

Step 2: Writing the instruction

Then you can start writing the instruction. Make sure to add this instruction to the domain knowledge, since this will always be used.

When writing the instruction, clearly specify the source URL. 

 

Instruction format:

  • Start with a brief comment in triple quotes """.
  • Clearly state the source URL.
  • Specify that the chatbot should use only the information from the provided link or document.
  • Close with triple quotes """.

 

Example:

"""
Source URL: [https://example.com/faq]. Only use the information from this link.
"""

Step 3: Finetuning the instruction

Then it's important to finetune the instruction, based on your chatbot. This you can do by using the examples below:

Use the provided information delimited by triple quotes to answer questions. If the answer is not in the information, please say that you can’t answer this. Do not mention it is not in the document.

You can write this instruction according to your needs. You can, for example, add how you would like the chatbot to respond when it can not find the information in the source.

This you will place above the Instruction in step 2.

 

Other examples and/or additions:

  • Use the provided information delimited by triple quotes to answer questions. If the answer to the question can't be found in the provided information, you can help the person out by hinting what sort of information you can help with or to help them complete the search if the term comes near something that is written in the document. If there is a link with the information, also send the link.
  • You should always refuse to answer questions that are not related to this specific knowledge base. Do not answer even if the data is part of exchanged messages but not within the provided context.

Limiting to a specific source at specific topics

It's also possible to write this instruction for specific topics. For example if someone has a question regarding Topic A, the chatbot should only use Document B. 

In this case you can add this to the instruction: Use the provided information delimited by triple quotes to answer questions regarding Topic A. 

Limiting to sending links from the added source

If you want your chatbot to only send links from the added sitemap, it's best to also add the sitemap as a document via the Document Scraper and write an instruction for this. You can read how to do this in this Help Center article.

Step 4: Testing

After setting up your instruction, test the chatbot in the Interactive tester to ensure it accurately references the content from the specified source(s). Keep finetuning the instructions until your satisfied with the chatbot's output.