mirror of
https://github.com/katanemo/plano.git
synced 2026-05-09 07:42:43 +02:00
16 lines
479 B
Rust
16 lines
479 B
Rust
|
|
use common::api::open_ai::{ChatCompletionsRequest, Message};
|
||
|
|
use thiserror::Error;
|
||
|
|
|
||
|
|
#[derive(Debug, Error)]
|
||
|
|
pub enum RoutingModelError {
|
||
|
|
#[error("Failed to parse JSON: {0}")]
|
||
|
|
JsonError(#[from] serde_json::Error),
|
||
|
|
}
|
||
|
|
|
||
|
|
pub type Result<T> = std::result::Result<T, RoutingModelError>;
|
||
|
|
|
||
|
|
pub trait RouterModel: Send + Sync {
|
||
|
|
fn generate_request(&self, messages: &[Message]) -> ChatCompletionsRequest;
|
||
|
|
fn parse_response(&self, content: &str) -> Result<Option<String>>;
|
||
|
|
}
|