Hello guys I am new to rasa. I have a query can anyone please share if you know
Can I use the rasa command generation model along with the existing model (groq) which I am using.
I want to use it because rephrasing utterances is not working with groq
You can read about configuring models in the docs here
Welcome to the Rasa community! Yes, you can use the Rasa command generation model alongside your existing Groq model. This can be particularly useful if you find that rephrasing utterances isnât working well with Groq.
To achieve this, you can configure your Rasa project to use multiple models. Hereâs a general approach:
-
Define Multiple Models: In your
config.yml
, you can define multiple models. For example, you can specify the Rasa command generation model and the Groq model. -
Custom Actions: Create custom actions to handle the logic for switching between models based on the type of utterance or command.
-
Model Selection Logic: Implement logic in your custom actions to determine which model to use for a given input. For example, you can use the Rasa model for rephrasing utterances and the Groq model for other tasks.
Hereâs a simplified example of how you might set this up in your config.yml
:
policies:
- name: MemoizationPolicy
- name: TEDPolicy
- name: RulePolicy
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: DIETClassifier
- name: EntitySynonymMapper
- name: ResponseSelector
- name: FallbackClassifier
- name: CustomModelSelector
models:
- name: rasa_command_generation_model
- name: groq_model
In your custom action, you can implement the logic to select the appropriate model:
from rasa_sdk import Action
from rasa_sdk.events import SlotSet
class ActionSelectModel(Action):
def name(self):
return "action_select_model"
def run(self, dispatcher, tracker, domain):
user_message = tracker.latest_message.get('text')
if "rephrase" in user_message:
selected_model = "rasa_command_generation_model"
else:
selected_model = "groq_model"
return [SlotSet("selected_model", selected_model)]
This is a basic example, and you may need to adjust it based on your specific requirements.
Happy coding!
Combine Rasaâs command generation with your Groq LLM by placing the NLUCommandAdapter
after your NLU pipeline but before the MultiStepLLMCommandGenerator
. Ensure consistent LLM configurations for both, use a custom prompt, and configure flow_retrieval
for context. Include relevant policies and use rasa shell --debug
for troubleshooting.