Create a new AI Assistant Retrieval app
If you have a single data source that you want to connect to your application as its context, and you need the application to retrieve information from that source, this is the ideal application type for you. This chain-based application is designed to work quickly and efficiently.
This step-by-step guide will walk you through the process of creating a chat application and seamlessly embedding it directly into your platform.
Using the UI
Step 1: Create your application
First things first, letβs create your chat application:
- Hit the Create button in the Applications screen to start the process.
- Enter a meaningful name for your chat application that reflects its purpose or the service it will provide.
- Select the application type "AI Assistance retrieval"

Step 2: Connect an LLM
To activate your chat application, it's crucial to connect it to an LLM. Your application will not function until this step is completed:
- Select your desired model provider from the following options:
- OpenAI
- GoogleAI
- OpenAI Compatible
- Anthropic
- Depending on your chosen provider, complete the following:
- Choose your preferred model and version from the available list if using OpenAI or GoogleAI.
- Provide the API key or connection details necessary to establish a link between Superwise and the LLM model.
- Test your application connection

Good to know
Utilize the Playground to immediately test the chat application with the connected LLM.
Step 3: Integrate Context into Your Application
For this application type to function optimally, it's necessary to incorporate additional context. The application will retrieve information from this supplementary context to enhance its performance.
Available context types:
Step 4: Save & Publish
You're just a step away from launching your chat application:
- Click the"Save & Publish" button to finalize and go live.
- Post-publishing, the application is prepared for embedding within your platform
Additional configuration options
- Add a prompt: Customizing the initial prompt enables the assistant to perform better by providing context and setting the direction of the conversation. You can read more about Prompt engineering guidelines here.
Using the SDK
Prerequisites
To install and properly configure the SWE SDK, please visit the SDK guide.
Step 1: Create model
Select a model that will form the cornerstone of your application.
from superwise_api.models.application.application import OpenAIModel, OpenAIModelVersion
llm_model = OpenAIModel(version=OpenAIModelVersion.GPT_4, api_token="Open API token")
If you want to see what models are available from the provider and their versions, please use the following code:
List current supported external providers
from superwise_api.models.application.application import ModelProvider
[provider.value for provider in ModelProvider]
List current supported model versions
from superwise_api.models.application.application import GoogleModelVersion, OpenAIModelVersion, AnthropicModelVersion
display([model_version.value for model_version in GoogleModelVersion])
display([model_version.value for model_version in OpenAIModelVersion])
display([model_version.value for model_version in AnthropicModelVersion])
Step 2: Create context
from superwise_api.models.tool.tool import ToolConfigSQLDatabasePostgres
from superwise_api.models.context.context import ContextDef
db_context = ContextDef(name="My DB", config=ToolConfigSQLDatabasePostgres(connection_string="My connection string"))
Step 3: Create application
from superwise_api.models.application.application import AIAssistantConfig
app = sw.application.create(name="application name", additional_config=AIAssistantConfig(context=db_context) ,llm_model=llm_model, prompt=None)
Modify model parameters
In the context of Large Language Models (LLMs), parameters are the adjustable factors that influence how the model generates text and makes decisions based on given inputs.
- Temperature: Controls the randomness of the modelβs outputs; lower values produce more deterministic responses, while higher values increase variety.
- OpenAI: The temperature value can range between 0 and 2, with a default value of 0.
- GoogleAI: The temperature value can range between 0 and 1, with a default value of 0.
- Top-p (Nucleus Sampling): Limits the modelβs output options to a subset of the highest-probability tokens that collectively account for a probability mass of p, ensuring more coherent text generation.
- The top-p value can range between 0 and 1, with a default value of 1.
- Top-k Sampling: Restricts the model to sampling from the top k most probable tokens, reducing the likelihood of selecting less relevant words.
- The top-k value can be any positive integer, with a default value of 40.
Model parameters availability
Please note that parameters are available only on GoogleAI and OpenAI models, and currently, they are accessible exclusively through the SDK. Additionally, the top-k parameter is exclusively available on GoogleAI models.
from superwise_api.models.application.application import GoogleModel, GoogleModelVersion, GoogleParameters
model = GoogleModel(version=GoogleModelVersion.GEMINI_1_5, api_token="Add your API token", parameters=GoogleParameters(temperature=1,top_p=0.9,top_k=30))
app = sw.application.put(str(app.id), additional_config=AIAssistantConfig(context=db_context) ,llm_model=model, prompt=None, name="Application name")
Updated 3 months ago