Feature Request: More Flexible Router Block (Multi-Route Selection & Custom System Prompt)

Abierto
#4,897 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
ai

Línea de trabajo

No files, tests, or code entry points are named. Start by locating the Router block implementation and its existing single-route behavior, then determine how the requested routing modes, custom prompt, no-match handling, and confidence outputs fit together. Done would require an agreed, backward-compatible scope for these changes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

feature

Problem

The current Router block is useful for AI-powered routing, but it appears to be limited to selecting a single route and relies on a hidden internal system prompt. This makes the block less flexible for advanced workflows and prevents users from adapting the routing behavior to different use cases.

In many real-world scenarios, a single input may legitimately belong to multiple categories. For example:

  • A support ticket may involve both Billing and Technical issues.
  • User feedback may contain both a Bug Report and Product Feedback.
  • A lead may qualify for multiple downstream workflows.

Currently, the Router seems designed around single-route classification, which limits these use cases.

Proposed Improvements

1. Route Selection Mode

Add a configurable routing mode with options such as:

Single Route (Current Behavior)

  • Select exactly one best-matching route.
  • Backward compatible with existing workflows.

Multiple Routes

  • Allow the model to select multiple matching routes.
  • Output an array of selected routes instead of a single value.
  • Trigger multiple output ports simultaneously.

Example:

Input:
"Billing charges are incorrect and the API is returning errors."

Selected Routes:

  • Billing
  • Technical
2. Custom System Prompt

Expose the Router's system prompt as an optional advanced setting.

Example use cases:

  • Adjust routing strictness.
  • Allow multi-label classification.
  • Prioritize specific business rules.
  • Customize fallback behavior.
  • Define confidence thresholds.
  • Improve domain-specific routing.

Example:

"You may select multiple routes if the input clearly belongs to more than one category."

or

"Prefer the most specific route instead of the most general route."

This would significantly increase flexibility without affecting users who prefer the default behavior.

3. Configurable No-Match Behavior

Allow users to choose between:

  • Route to Error Path
  • Force Best Match
  • Return Multiple Candidates
  • Use Custom Fallback Route
4. Confidence Score Output

Provide an optional confidence score for each routing decision.

Example outputs:

  • selectedRoute
  • selectedRoutes
  • confidence
  • reasoning

This would help with debugging and workflow monitoring.

Benefits

  • Supports both single-label and multi-label classification.
  • Works better for complex enterprise workflows.
  • Gives users more control over routing behavior.
  • Reduces the need for custom LLM blocks before the Router.
  • Makes the Router adaptable to a wider range of use cases.

Summary

The Router block would become significantly more powerful by supporting:

  1. Single-route and multi-route modes.
  2. User-configurable system prompts.
  3. Configurable no-match behavior.
  4. Confidence score outputs.

These changes would preserve backward compatibility while providing much greater flexibility for advanced workflow design.

Lenguaje dominante
TypeScript
Estrellas
29.8k
Forks
3.9k
Merge medio
1 h 44 min
PR fusionados (30 d)
841

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de simstudioai/sim

Todos los issues de simstudioai/sim

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.