HomeGuidesAPI ReferenceRelease notes
Log In
Guides

Create Basic LLM Assistant Application

Superwise now offers the ability to create a Basic LLM Assistant, a streamlined application that enables direct communication with the LLM without relying on external tools or contextual data. This application type acts as a straightforward intermediary between the user and the model, improving response times when no additional context is needed.

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 "Basic LLM Assistant"

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: Save & Publish

You're just a step away from launching your chat application:

Additional configuration options

Maximize the potential of your chat application with these extra features:

  • 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 application

from superwise_api.models.application.application import BasicLLMConfig

app = sw.application.create(
    name="My Application name",
    additional_config=BasicLLMConfig(),
    llm_model=llm_model,
  	prompt="Your promot here"
)

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 BasicLLMConfig
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=BasicLLMConfig(),
                         llm_model=llm_model, 
                         prompt=None, 
                         name="Application name"
                        )