LLMMessagesRouter
Routes Chat Messages to different connections using a generative Language Model to perform classification.
Basic Information
- Type:
haystack_integrations.routers.llm_messages_router.LLMMessagesRouter
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| messages | List[ChatMessage] | A list of ChatMessages to be routed. Only user and assistant messages are supported. |
Outputs
| Parameter | Type | Default | Description |
|---|
Overview
Bear with us while we're working on adding pipeline examples and most common components connections.
Routes Chat Messages to different connections using a generative Language Model to perform classification.
This component can be used with general-purpose LLMs and with specialized LLMs for moderation like Llama Guard.
Usage Example
components:
LLMMessagesRouter:
type: components.routers.llm_messages_router.LLMMessagesRouter
init_parameters:
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| chat_generator | ChatGenerator | A ChatGenerator instance which represents the LLM. | |
| output_names | List[str] | A list of output connection names. These can be used to connect the router to other components. | |
| output_patterns | List[str] | A list of regular expressions to be matched against the output of the LLM. Each pattern corresponds to an output name. Patterns are evaluated in order. When using moderation models, refer to the model card to understand the expected outputs. | |
| system_prompt | Optional[str] | None | An optional system prompt to customize the behavior of the LLM. For moderation models, refer to the model card for supported customization options. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
| messages | List[ChatMessage] | A list of ChatMessages to be routed. Only user and assistant messages are supported. |
Was this page helpful?