Working with AI Assistants
AI Assistants are powerful tools you can use to build AI-powered solutions for your website. They combine the strengths of artificial intelligence to handle questions and requests, together with your organization’s specialized knowledge and expertise.
Published: 2025-11-03 | Updated: 2026-04-30

What are AI Assistants?
AI Assistants combine a Large Language Model (LLM), a knowledge base set up through a Retrieval-Augmented Generation (RAG) framework, and a set of custom instructions. This allows you to create tailored solutions and assistants specifically relevant to your needs.
What are my options when creating AI Assistants?
When creating an AI Assistant for your website, you have two options:
- Use the general Assistant module provided by Sitevision through the Sitevision Marketplace External link..
- Build your own custom solution.
In this article, we will explore the second option.
User Story
We want to create an easily accessible place on our intranet where employees can ask questions related to their work, for example: how to document expenses, what benefits are available, or what career options they have.
The intranet likely contains all this information, but it can be difficult to find. An AI Assistant can help by finding and presenting the right answer when you ask a question.
Setting Up an Assistant
First, we need to create an Assistant in your website’s site settings. To do this, you will need an AI service and a knowledge base. See the following three tabs.

AI services
In the AI services tab you can find the available LLMs on your site. The Sitevision AI service is the LLM that is provided. If you have other AI Services you want to use this is also possible given the correct license agreement.

Knowledge
In the Knowledge tab you define the scope you want to use. The more specific you can be the better. You want to create Expert Assistants to generate as precise answers as possible. If a too wide scope is defined irrelevant or conflicting information might be supplied to the AI. As with any search based functionality, only include what should be accessible. A great experience begins with great data.

A knowledge base is not limited to only internal information from your website. You can also import external sources, allowing you to centralize all your information in one place.
Assistants
In the Assistants tab you combine and define the packaged Assistant. Select an AI Service you want to use and select the Knowledge you want to base the responses on. Additionally you can define a behavioral prompt.
By default, and it is always included, is a simple prompt Sitevision defines internally to control the basic behavior. Answer in markdown format, answer only based on the provided knowledge, and the current date to better handle time related questions. Therefore you do not need to provide a system prompt, but you likely want to add some custom instructions. For example define some tonality instructions, if you want certain keywords highlighted, if you want the responses to include counter questions etc. Test and iterate to find an additional prompt that works for your use case.

With these instructions and restrictions defined we can start using an assistant. For example using the Assistant module available through Sitevision marketplace External link..

More custom solutions might be necessery and of course Sitevision provides a SDK to easilly work with Assistants in your own tailored apps.
Let's explore the aiAssistant SDK
The aiAssistant SDK is the utility you want to use when building conversational assistant solutions. We have looked at how to set these up in the site settings and visualizing the result in the Assistant module. But how do I build my own module based on this technology?
The basic workflow contains three main steps:
- Create a conversation.
- Fetch knowledge related to the user query.
- Let the assistant answer the question and stream the result to the client.
Example
Let's look at some code snippets.
Configuration
First we need to make an assistant available in our application. The best way to achieve this is to create a selector in our app's configuration. This can easily be achieved with ResourceLocatorUtil.getAiAssistantRepository() External link. from the Public API and a custom-selector.
That's our configuration done. When the module is placed on a page the admin needs to select an assistant before proceeding.
Client - Initiate request
We will focus on the aiAssistant SDK parts, but let's include some client code as well.
Imagine a simple textbox or input field where the user can submit a question. When the user sends their questions we need to initiate a request which will be able to handle a streamed answer.
Define the endpoint
Define an endpoint for the query request. In our example we need to collect the input and conversationIdentifier parameters and fetch our assistant node.
Create a conversation
Now let’s start exploring the aiAssistant SDK. As mentioned earlier, the first step in the main workflow is to create a conversation. However, we do not want to create a new conversation every time we make a request.
For follow-up questions, we should continue the existing conversation instead of starting a new one. In other words, a new conversation should only be created when it is the beginning of a new interaction. Otherwise, we reuse the previously created conversation for any follow-ups.
The createConversation function will return a string. This is an unique key for the conversation.
Fetch knowledge
We want to create a specialized assistant, so we need to collect the specific data it should use to generate its answers. Without this data, the LLM will answer according to its general training knowledge, which may not reflect the specialized context we need.
To get relevant data from the Knowledge base we have set up along our assistant we need query it. This is done with the function querySemanticIndex.
In this example, we only retrieve the text result from the knowledge base.
However, you can also access additional metadata, such as the source id (and additional properties for external sources). This allows you to include richer context about each source, which can help the AI provide more informed and relevant answers.
Ask the assistant - options
Our last step is to give the assistant the relevant information we have gathered and let it answer the question. Here the askAssistant function comes in handy.
First we need to define the options. Four are required:
conversationIdentifier- the conversation keymessage- the queryonChunk- How to handle each chunk in the streamonFinish- How to handle the end of the request
In this example we will use one optional property, knowledge. Here we insert the knowledge we previously collected to base our answer on. If this is omitted, the LLM will answer according to its training data which might be highly irrelevant to a business specific assistant. The property is optional, but you most likely want to provide it.
There are more optional options to utilize, consult the documentation for more information.
Ask the assistant
When our options are defined we can initiate the stream. We set a few headers to make sure there are no problems when streaming our answer.
In this example we send the conversationIdentifier as a custom header to be able to store this on the client, and resume the conversation in follow up questions. You could also create the conversation in a separate call, create it on page load, save it in the user session or something else. Figure out a fitting solution for your use case.
When our status and headers are set. Initiate the anwer by calling the askAssistant function.
Client - handle response
By calling the askAssistant function we initate a stream. On the client we need to handle this. Consult the following snippet as a simple example.
Example finished!
That's a wrap for our example. The example snippets used in this article are copied (with some modifications) from an example app freely available on GitHub External link.. See the ai-assistant-recommendations External link. package. Check this one out along with more example projects from Sitevision.
aiAssistant - additional funtions
This example focused on the three main funcions in the aiAssistant SDK. However as of writing there a three more functions available. Here's a very brief explanation on how and when you can use these.
askLLM
The askLLM is a function used to ask the LLM a question. This is not a streamed response so you need to wait for the response to fully finish before proceeding. Use this for supplementary functions to create more advanced functionallity in the assistant you are building.
For example:
- Check what type of question the user sent - to handle the response in another way with the option
additionalInstructionsin theaskAssistantfunction. - Rewrite the user query to supply the AI with more information if maybe demographic or target audience is important to the way it should respond.
- Maybe you need to ask the user to supply more information before you can proceed with the query.
getConversationMemory
Previous messages in the conversation can be accessed through the getConversationMemory function. If you need to check something in the history in relation to a new query before proceeding, this is an option.
getConversationKnowledge
The last set of knowledge used can be accesed with getConversationKnowledge. This way you can reuse the last set of knowledge if the user asked a simple follow up question.
In closing
AI is a powerful tool which allows you to create solutions which can help and guide the user to complete their task more efficient.
The aiAssistant SDK alllows you as a developer to create a conversational AI with a few simple steps.
Take an extra look at the aiAssistant documentation and our exemples on github External link. and start experimenting!