Skip to main content

bitrouter_core/routers/
model_router.rs

1use crate::{
2    errors::Result,
3    models::{image::image_model::DynImageModel, language::language_model::DynLanguageModel},
4    routers::routing_table::RoutingTarget,
5};
6
7/// A router that routes to the appropriate language model implementation based on the routing target.
8pub trait LanguageModelRouter {
9    /// Routes to the appropriate language model implementation based on the routing target.
10    ///
11    /// Returns a dynosaur-generated [`DynLanguageModel`] that can hold any
12    /// concrete model type while keeping the dynamic-dispatch boilerplate in one place.
13    fn route_model(
14        &self,
15        target: RoutingTarget,
16    ) -> impl Future<Output = Result<Box<DynLanguageModel<'static>>>> + Send;
17}
18
19/// A router that routes to the appropriate image model implementation based on the routing target.
20pub trait ImageModelRouter {
21    /// Routes to the appropriate image model implementation based on the routing target.
22    fn route_model(
23        &self,
24        target: RoutingTarget,
25    ) -> impl Future<Output = Result<Box<DynImageModel<'static>>>> + Send;
26}