pub struct Router { /* private fields */ }Expand description
The main Router - implements LlmProvider trait for VEX
Implementations§
Source§impl Router
impl Router
Sourcepub fn with_config(config: RouterConfig) -> Self
pub fn with_config(config: RouterConfig) -> Self
Create a router with a custom configuration
Sourcepub fn builder() -> RouterBuilder
pub fn builder() -> RouterBuilder
Get a builder for configuration
Sourcepub fn route(
&self,
prompt: &str,
system: &str,
) -> Result<RoutingDecision, RouterError>
pub fn route( &self, prompt: &str, system: &str, ) -> Result<RoutingDecision, RouterError>
Route a query and return a decision (without executing)
Sourcepub fn route_with_complexity(
&self,
complexity: &QueryComplexity,
) -> Result<RoutingDecision, RouterError>
pub fn route_with_complexity( &self, complexity: &QueryComplexity, ) -> Result<RoutingDecision, RouterError>
Route with pre-computed complexity
Sourcepub async fn execute(
&self,
prompt: &str,
system: &str,
) -> Result<String, RouterError>
pub async fn execute( &self, prompt: &str, system: &str, ) -> Result<String, RouterError>
Execute a query through the router
Sourcepub async fn ask(&self, prompt: &str) -> Result<String, RouterError>
pub async fn ask(&self, prompt: &str) -> Result<String, RouterError>
Convenience method - ask a question
Sourcepub fn config(&self) -> &RouterConfig
pub fn config(&self) -> &RouterConfig
Get the current configuration
Sourcepub fn observability(&self) -> &Observability
pub fn observability(&self) -> &Observability
Get the observability metrics
Trait Implementations§
Source§impl LlmProvider for Router
impl LlmProvider for Router
Source§fn complete<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Complete a request (implements vex_llm::LlmProvider::complete)
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more