Rewrite Question
A component that rewrites a user query.
The Rewrite Question component uses a specified LLM to reformulate a user query from the Interact component, based on the context of previous dialogues. This is particularly useful when users ask follow-up questions that lack context on their own (e.g., “What about last month?” after asking about revenue).
Scenarios
Section titled “Scenarios”A Rewrite Question component is essential when you need to optimize a user query based on the context of previous conversations. It is usually the upstream component of a Retrieval component.
Quick Reference
Section titled “Quick Reference”| Parameter | Type | Default | Description |
|---|---|---|---|
Model | string | — | The language model used for rewriting. |
Message Window Size | number | 6 | Number of prior dialogue rounds to consider when rewriting. |
Temperature | number | 0.1 | Controls randomness in the rewritten output. |
Top P | number | 0.3 | Nucleus sampling parameter. |
Presence Penalty | number | 0.4 | Encourages diverse token usage. |
Frequency Penalty | number | 0.7 | Discourages repeated tokens. |
Configurations
Section titled “Configurations”Click the dropdown menu of Model to show the model configuration window.
- Model: The chat model to use.
- Ensure you set the chat model correctly on the Model providers page.
- You can use different models for different components to increase flexibility or improve overall performance.
- Freedom: A shortcut to Temperature, Top P, Presence penalty, and Frequency penalty settings. Options:
- Improvise: Produces more creative responses.
- Precise: (Default) Produces more conservative responses.
- Balance: A middle ground between Improvise and Precise.
- Temperature: The randomness level of the model’s output. Defaults to 0.1.
- Top P: Nucleus sampling. Defaults to 0.3.
- Presence penalty: Encourages the model to include a more diverse range of tokens. Defaults to 0.4.
- Frequency penalty: Discourages the model from repeating the same words or phrases. Defaults to 0.7.
Message window size
Section titled “Message window size”An integer specifying the number of previous dialogue rounds to input into the LLM.
Examples
Section titled “Examples”Explore the Rewrite Question component configurations by creating an agent and inspecting the component:
-
Click the Agent tab at the top center of the page to access the Agent page.
-
Click + Create agent on the top right of the page to open the agent template page.
-
On the agent template page, hover over the Coordinator agent card and click Use this template.
-
Name your new agent and click OK to enter the workflow editor.
-
In the workflow editor, either:
- Click the existing Rewrite Question component in the workflow to select it, or
- Click + Add component in the toolbar, find Rewrite Question in the components list, and drag it onto the canvas.
-
With the Rewrite Question component selected, the Configuration panel opens on the right. Explore the available settings:
- Model: Select the LLM and adjust Freedom presets or fine-tune Temperature, Top P, Presence penalty, and Frequency penalty.
- Message window size: Set how many prior dialogue rounds are considered when rewriting the query.