Routers are a powerful feature in Kosmoy Studio that allow you to define how requests are routed to different models. This enables you to create sophisticated routing strategies, such as failover mechanisms and load balancing (future feature), to enhance the reliability and performance of your AI applications.
Kosmoy Studio currently supports the following router type:
Failover Router: This router type defines a primary model and a secondary model. If the primary model fails to respond, the router automatically routes the request to the secondary model.
Future Router Types:
Load Balancing Router (Coming Soon): This router type will distribute requests across multiple models based on a defined algorithm (e.g., round-robin, weighted round-robin), optimizing resource utilization and improving response times.
To create a router in Kosmoy Studio, follow these general steps. Note that the specific configuration options will vary depending on the chosen router type:
Navigate to Routers: From the Kosmoy Studio home page, click on the “Routers” menu in the left-hand navigation bar.
Add a New Router: Click the ”+ ADD” button located in the upper right corner of the Routers section.
Select Router Type: Choose the desired router type from the dropdown menu.
Configure Router: Follow the specific configuration steps for the selected router type, as detailed in the subsections below.
Name and Describe the Router: Give your router a unique name and an optional description. This will help you identify it later.
Review and Create: Review the router configuration and click “Create” to create the router.
You cannot edit or delete a router if it is currently referenced by other entities within Kosmoy Studio. This includes being used in:
Gateways
Any other Kosmoy Studio component that references routers.
Before attempting to edit or delete a router, ensure it is not actively used in any of these areas. You may need to modify or remove the router from those components first.
You can update the configuration of a registered router, including its name, description, and parameters, provided it is not currently referenced by any other component.
Navigate to Routers: From the Kosmoy Studio home page, click on the “Routers” icon in the left-hand navigation bar.
Locate the Router Card: Find the card for the router you want to update.
Click the Edit (Pencil) Icon: This will open the update dialog.
Modify Router Parameters: Update the router’s configuration as needed. This may include changing the primary/secondary models for a Failover router, or the model list/algorithm for a Load Balancing router, in addition to its name and description.
Click “Save”: Save the changes.
If you attempt to edit a router that is currently in use, a warning banner will be displayed at the top of the screen, preventing the modification.
You can remove a registered router if it’s no longer needed. However, you cannot delete a router that is currently referenced by any other component.
Navigate to Routers: From the Kosmoy Studio home page, click on the “Routers” icon in the left-hand navigation bar.
Locate the Router Card: Find the card for the router you want to remove.
Click the Delete (Trash Bin) Icon: This will trigger a confirmation prompt.
If you attempt to delete a router that is currently in use, a modal will appear, preventing the deletion and explaining that the router is in use.
Confirm Deletion: Confirm that you want to delete the router.
Warning: Deleting a router is a permanent action and cannot be undone. Ensure that the router is not being referenced by any other component before proceeding.
Routers are used in other parts of Kosmoy Studio to define the logic for routing requests to different models. For example, when creating a Gateway, you can select a Router to handle requests directed to that Gateway.Note: Although routers are not directly used in Assistants or Coded Apps, they are indirectly utilized through Gateways, which can be associated with Assistants and Coded Apps.