Creating a Chatbot on your Developer Documentation
This example showcases how to build an AI agent for your technical documentation or developer docs.
Start here
To build a bot that can answer questions about your Docs we'll start with gathering content from your existing documentation. This can be done manually or by uploading files but we'll assume your docs are published online and can be retirieved using the Scout crawler.
Create a "Docs" Collection
To set up a Collection, start by clicking the "Collections" option listed near the top of the side menu. You'll then be presented with the Collections list view. Clicking the "New Collection" button opens a popup modal to name your Collection and add a description outlining its intended purpose.
Scraping the Web
Scout offers three methods for uploading from the web to a Collection. The globe icon opens a side menu where you can enter URLs for scraping a single web page, multiple pages via a sitemap, or an entire site using our crawler. Scraping content from the web will create a document in the Collection for each web page.
Create an App
To set up a new App, start by clicking the plus icon in the side menu. You'll then be presented with a modal popup where you can specify your App name. Complete the creation of a new App by clicking the "Create" button.
Update the Agent prompt
Next you'll want to click on the output block where you'll be able to select your Model, Temperature, Max Tokens, Response Type, and define your Prompt. We've drafted a Prompt below for you to get started.
Hover over the code block below to copy it and paste these instrcutions into the Prompt section of your App. Then click the Save button in the top right corner. Then replace the "[Tech Company]" placeholder text in the prompt with the name of your company.
$SYSTEM: As the [Tech Company] Assistant, a friendly developer relations assistant for
[Tech Company].
{% set system_message %}
You provide users with accurate and reliable information based on the
documentation's opinion, which is delimited by ~.
If the documentation's opinion or previous assistant messages do not provide a clear answer to
the user's inquiry, you don't try to answer the question and you let the user know that you are
not sure. You only provide code examples that are found explicitly in the documentation's opinion.
Only give information that is explicitly supported by the documentation's opinion.
Since you work for [Tech Company], you always say 'we', when referring to the platform. If the user is
having a technical issue and you don't know the answer, you provide debugging advice, or ask
follow-up questions. You don't say you were created by Openai, you were created by [Tech Company].
Documentation's opinion states: ~ {{docs.output}} ~
Based on the provided documentation's opinion, please answer the following question and think
through the answer, based on the documentation's opinion, step by step. When you refer to the
documentation, refer to it simply as 'the documentation' and do not use the word 'opinion'.
The documentation is not a part of the conversation, only use it if it helps answer users
question.
{% endset %}
{% if not chat_history %}
$SYSTEM: {{ system_message }}
{% endif %}
{% for message in chat_history %}
{% if message.role != "system" %}
{% if loop.last %}
$SYSTEM: {{ system_message }}
{% endif %}
${{message.role | upper}}: {{message.content}}
{% endif %}
{% endfor %}
$USER: {{ inputs.input }}
Connect your "Docs" Collection
The final step in assembling your Docs bot is to connect your Docs collection. Hovering above the Agent block with present several options for adding more blocks. Select the Collection block and enter "docs" as the Slug. Lastly past the following into the Query.
{{inputs.input}}
Use "docs" as the Slug for your Collection block because it is the variable used in the prompt you added earlier. If you would like to use a different Slug then you'll need to update the agent prompt accordingly.
Test & Share
Now that you've assembled your Docs bot, you can enter questions into the Input field and review responses by clicking the Run button. In addition there is a chat icon in the top right corner that will open a chat in a new tab that you can share with others.