LLM Configuration for Rasa Pro 3.11 and aboveFor Rasa Pro versions
3.11 and above, refer to the LLM Configuration for >=3.11 page.Overview
This page applies to the following components which use LLMs:- SingleStepLLMCommandGenerator
- MultiStepLLMCommandGenerator
- EnterpriseSearchPolicy
- IntentlessPolicy
- ContextualResponseRephraser
- LLMBasedRouter
- the LLM provider
- the model to be used
3.10, CALM uses LiteLLM under the hood to integrate
with different LLM providers. Hence, all LiteLLM’s integrated providers
are supported with CALM as well. We explicitly mention the settings required for the most frequently used ones in the
sections below.
Recommended Models
The table below documents the versions of each model we recommend for use with various Rasa components. As new models are published, Rasa will test these and where appropriate add them as a recommended model.Chat completion models
Default ProviderCALM is LLM agnostic and can be configured with different LLMs, but OpenAI is the default model provider. Majority of
our experiments have been with models available on OpenAI or OpenAI Azure service. The performance of your
assistant may vary when using other LLMs, but improvements can be made by tuning flow and collect step descriptions.
llm
key of that component’s configuration. For example:
config.yml
Required Parameters
There are certain required parameters under thellm key:
model- Specifies the name of the model identifier available from the LLM provider’s documentation, for e.g.gpt-4-0613provider- Unique identifier of the provider to be used for invoking the specified model.
config.yaml
Optional Parameters
Thellm key also accepts inference time parameters like
temperature, etc which are optional but can be useful in extracting the best performance out of the model being used.
Please refer to the
official LiteLLM documentation for a list of such parameters supported.
When configuring a particular provider, there are a few provider specific settings which are explained under
each provider’s individual sub-section below.
If you switch to a different LLM provider, all default parameters for the old provider
will be overriden with the default parameters of the new provider.E.g. If a provider sets
temperature=0.7 as the default value and you switch to a different LLM
provider, this default will be ignored and it is up to you to set the
temperature for the new provider.OpenAI
API Token
The API token authenticates your requests to the OpenAI API. To configure the API token, follow these steps:- If you haven’t already, sign up for an account on the OpenAI platform.
- Navigate to the OpenAI Key Management page,
and click on the “Create New Secret Key” button to initiate the process of
obtaining
<your-api-key>. - To set the API key as an environment variable, you can use the following command in a terminal or command prompt:
- Linux/MacOS
- Windows
<your-api-key> with the actual API key you obtained from the OpenAI platform.
Configuration
There are no additional OpenAI specific parameters to be configured. However, there could be model specific parameters liketemperature that you might want to modify. Names for such parameters can found in
OpenAI’s API documentation and defined under llm key of the
component’s configuration.
Please refer to
LiteLLM’s documentation to know the
list of models supported from the OpenAI platform.
Model deprecations
OpenAI regularly publishes a deprecation schedule for its models. This schedule can be accessed in the documentation published by OpenAI.Azure OpenAI Service
API Token
The API token authenticates your requests to the Azure OpenAI Service. Set the API token as an environment variable. You can use the following command in a terminal or command prompt:- Linux/MacOS
- Windows
<your-api-key> with the actual API key you obtained from the Azure OpenAI Service platform.
Configuration
To access models provided by Azure OpenAI Service, there are a few additional parameters that need to be configured:provider- Set toazure.api_type- The type of API to use. This should be set to “azure” to indicate the use of Azure OpenAI Service.api_base- The URL for your Azure OpenAI instance. An example might look like this:https://my-azure.openai.azure.com/.api_version- The API version to use for this operation. This follows the YYYY-MM-DD format and the value should be enclosed in single or double quotes.engine/deployment_name- Alias fordeploymentparameter. Name of the deployment on Azure.
temperature can be defined as well. Refer to
OpenAI Azure service’s API documentation
for information on available parameter names.
A complete example configuration of the SingleStepLLMCommandGenerator using Azure OpenAI Service would look like this:
- Rasa Pro <=3.7.x
- 3.8.x<=Rasa Pro<=3.9.x
- Rasa Pro >=3.10.x
config.yml
Model deprecations
Azure regularly publishes a deprecation schedule for its models that come under the OpenAI Azure Service. This schedule can be accessed in the documentation published by Azure.Debugging
If you encounter timeout errors, configurerequest_timeout parameter to a larger value. The exact value depends on
how your azure instance is configured.
Amazon Bedrock
Requirements:
- Make sure you have
rasa-pro>=3.10.xinstalled. - Install
boto3>=1.28.57. - Set the following environment variables -
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION_NAME. - (Optional) Might have to set
AWS_SESSION_TOKENif your organisation mandates the usage of temporary credentials for security.
config.yaml to use an appropriate model and set provider to bedrock:
config.yml
temperature can be defined as well. Refer to
LiteLLM’s documentation
for information on available parameter names
and supported models.
Gemini - Google AI Studio
Requirements:
- Make sure you have
rasa-pro>=3.10.xinstalled. - Install python package
google-generativeai. - Get API Key at https://aistudio.google.com/ .
- Set the API key to an environment variable
GEMINI_API_KEY.
config.yaml to use an appropriate model and set provider to gemini:
config.yml
HuggingFace Inference Endpoints
Requirements:
- Make sure you have
rasa-pro>=3.10.xinstalled. - Set an API Key to the environment variable
HUGGINGFACE_API_KEY. - Edit
config.yamlto use an appropriate model, setprovidertohuggingfaceandapi_baseto the base URL of the deployed endpoint:
config.yml
Self Hosted Model Server
CALM’s components can also be configured to work with an open source LLM that is hosted on an open source model server like vLLM(recommended), Ollama or Llama.cpp web server. The only requirement is that the model server should adhere to the OpenAI API format. Once you have your model server running, configure the CALM assistant’s config.yaml: vLLMconfig.yml
- Recommended version of
vllmto use is0.6.0. - CALM exclusively utilizes the chat completions endpoint of the model server, so it’s essential that the model’s tokenizer includes a chat template. Models lacking a chat template will not be compatible with CALM.
modelshould contain the name of the model supplied to the vllm startup command, for example if your model server is started with:
model should be set to meta-llama/CodeLlama-7b-Instruct-hf.
4. api_base should contain the full exposed URL of the model server with v1 attached as suffix to the URL.
Ollama
Once the ollama model server is running, edit the config.yaml file:
config.yml
Other Providers
If you want to try one of these providers, it is recommended to install Rasa Pro versions
>= 3.10.
For each of the above ones, ensure you have set an environment variable named by the value in
API-KEY variable column
to the API key of that platform and set the provider parameter under llm key of the component’s config to the value
in provider column.
Embedding models
To configure components that use an embedding model, declare the configuration under theembeddings key
of that component’s configuration. For example:
config.yml
embeddings property needs two mandatory parameters:
model- Specifies the name of the model identifier available from the LLM provider’s documentation, for e.g.text-embedding-3-large.provider- Unique identifier of the provider to be used for invoking the specified model, for e.g.openai
- Rasa Pro <=3.9.x
- Rasa Pro >=3.10.x
config.yml
OpenAI
OpenAI is used as the default embedding model provider. To start using, ensure you have configured an API token as you would do for a chat completion model from OpenAI platformConfiguration
- Rasa Pro <=3.9.x
- Rasa Pro >=3.10.x
config.yml
Azure OpenAI Service
Ensure you have configured an API token as you would do for a chat completion model for Azure OpenAI ServiceConfiguration
Configuring an embedding model from Azure OpenAI Service needs values for the same set of parameters that are required for configuring a chat completion model from Azure OpenAI Service- Rasa Pro <=3.9.x
- Rasa Pro >=3.10.x
config.yml
Amazon Bedrock
Configuring an embedding model from amazon bedrock needs the same pre-requisites as a chat completion model. Please ensure you have addressed these before proceeding further.Configuration
config.yml
In-Memory
CALM also provides an option to load lightweight embedding models in-memory without needing them to be exposed over an API. It uses the sentence transformers library under the hood to load and run inference on them.Configuration
- Rasa Pro <=3.9.x
- Rasa Pro >=3.10.x
config.yml
modelparameter can take as value either any embedding model repository available on the HuggingFace hub or a path to a local model.model_kwargsparameter is used to provide load time arguments to the sentence transformer library.encode_kwargsparameter is used to provide inference time arguments to the sentence transformer library.
Other Providers
Other than the above mentioned providers, we have also tested support for the following providers -
For each of the above ones, ensure you have set an environment variable named by the value in
API-KEY variable column
to the API key of that platform and set the provider parameter under llm key of the component’s config to the value
in provider column.
Configuring self-signed SSL certificates
In environments where a proxy performs TLS interception, Rasa may need to be configured to trust the certificates used by your proxy. By default, certificates are loaded from the OS certificate store. However, if your setup involves custom self-signed certificates, you can specify these by setting theRASA_CA_BUNDLE environment variable.
This variable points to the path of the certificate file that Rasa should use to validate SSL connections:
The
REQUESTS_CA_BUNDLE environment variable is deprecated and will no longer be supported in future versions. Please
use RASA_CA_BUNDLE instead to ensure compatibility.Configuring Proxy URLs
In environments where LLM requests need to be routed through a proxy, Rasa relies on LiteLLM to handle proxy configurations. LiteLLM supports configuring proxy URLs through theHTTP_PROXY and HTTPS_PROXY environment
variables.
To ensure that all LLM requests are routed through the proxy, you can set the environment variables as follows:
FAQ
Does OpenAI use my data to train their models?
No. OpenAI does not use your data to train their models. From their website:We do not train our models on your business data by default.
Example Configurations
Azure
A comprehensive example which includes:llmandembeddingsconfiguration for components inconfig.yml:IntentlessPolicyEnterpriseSearchPolicySingleStepLLMCommandGeneratorflow_retrievalin 3.8.x
llmconfiguration for rephrase inendpoints.yml(ContextualResponseRephraser)
- Rasa Pro <=3.7.x
- 3.8.x <= Rasa Pro <= 3.9.x
- Rasa Pro >=3.10.x
endpoints.yml
config.yml