| name | rasa-rephrasing-responses |
| description | Enables and configures LLM-powered Contextual Response Rephraser in Rasa CALM. Covers endpoints.yml setup, per-response metadata, and prompt customization. Use when setting up or tuning the Contextual Response Rephraser.
|
| license | Apache-2.0 |
| metadata | {"author":"rasa","version":"0.1.0","rasa_version":">=3.11.0","docs-url":"https://rasa.com/docs/reference/primitives/contextual-response-rephraser/"} |
Rephrasing Responses in Rasa
The Contextual Response Rephraser uses an LLM to dynamically rewrite templated
responses, making them sound more natural and context-aware while preserving the
original meaning. It reads conversation history and user input to ensure rephrasings fit
the context.
Workflow
- Enable the rephraser in
endpoints.yml (see "Endpoints configuration").
- Decide the rephrasing scope — per-response or all responses
(see "Rephrasing scope").
- Add
metadata: rephrase: True/False on individual responses as needed
(see "Domain-side metadata").
- Optionally customize the prompt globally or per response
(see "Prompt customization").
Endpoints configuration
Enable the rephraser by adding nlg: type: rephrase to endpoints.yml.
Configure the LLM model and temperature. Lower temperature (default 0.3) produces more
predictable rephrasings; higher temperature produces more variable output but risks
altering meaning.
nlg:
type: rephrase
llm:
model_group: my_llm
model_groups:
- id: my_llm
models:
- provider: <your-provider>
model: <your-llm-model>
temperature: 0.3
Conversation history
Two modes for how conversation history is included in the rephrasing
prompt.
Summary mode (default) — summarizes history using an additional LLM call. No extra
config needed.
Transcript mode — keeps the last n turns as-is. Set summarize_history: False and
optionally adjust max_historical_turns (default 5).
nlg:
type: rephrase
summarize_history: False
max_historical_turns: 5
Rephrasing scope
Specific responses only (default)
No endpoints.yml change needed. Add metadata: rephrase: True on each response you
want rephrased.
responses:
utter_greet:
- text: "Hey! How can I help you?"
metadata:
rephrase: True
All responses
Set rephrase_all: true in endpoints.yml. Every response is rephrased without needing
per-response metadata.
nlg:
type: rephrase
rephrase_all: true
All except specific ones
Set rephrase_all: true in endpoints.yml, then opt out individual responses with
metadata: rephrase: False.
responses:
utter_legal_disclaimer:
- text: "By proceeding you agree to our terms and conditions."
metadata:
rephrase: False
Prompt customization
Reference a custom Jinja2 template globally in endpoints.yml, or override per response
via rephrase_prompt in metadata.
Available variables: {{history}}, {{current_input}}, {{suggested_response}}.
nlg:
type: rephrase
prompt: prompts/response-rephraser-template.jinja2
responses:
utter_greet:
- text: "Hey! How can I help you?"
metadata:
rephrase: True
rephrase_prompt: |
Rephrase the suggested response in a friendly, casual tone.
Stay close to the original meaning.
Context: {{history}}
{{current_input}}
Suggested: {{suggested_response}}
Rephrased: