mirror of
https://github.com/katanemo/plano.git
synced 2026-05-07 06:42:42 +02:00
orchestration integration (#623)
* orchestration integration * Convert compact json to spaced json
This commit is contained in:
parent
d5a273f740
commit
cb82a83c7b
6 changed files with 1164 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
|||
pub mod llm_router;
|
||||
pub mod orchestrator_model;
|
||||
pub mod orchestrator_model_v1;
|
||||
pub mod router_model;
|
||||
pub mod router_model_v1;
|
||||
|
|
|
|||
30
crates/brightstaff/src/router/orchestrator_model.rs
Normal file
30
crates/brightstaff/src/router/orchestrator_model.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
use common::configuration::AgentUsagePreference;
|
||||
use hermesllm::apis::openai::{ChatCompletionsRequest, Message};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OrchestratorModelError {
|
||||
#[error("Failed to parse JSON: {0}")]
|
||||
JsonError(#[from] serde_json::Error),
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, OrchestratorModelError>;
|
||||
|
||||
/// OrchestratorModel trait for handling orchestration requests.
|
||||
/// Unlike RouterModel which returns a single route, OrchestratorModel
|
||||
/// can return multiple routes as the model output format is:
|
||||
/// {"route": ["route_name_1", "route_name_2", ...]}
|
||||
pub trait OrchestratorModel: Send + Sync {
|
||||
fn generate_request(
|
||||
&self,
|
||||
messages: &[Message],
|
||||
usage_preferences: &Option<Vec<AgentUsagePreference>>,
|
||||
) -> ChatCompletionsRequest;
|
||||
/// Returns a vector of (route_name, model_name) tuples for all matched routes.
|
||||
fn parse_response(
|
||||
&self,
|
||||
content: &str,
|
||||
usage_preferences: &Option<Vec<AgentUsagePreference>>,
|
||||
) -> Result<Option<Vec<(String, String)>>>;
|
||||
fn get_model_name(&self) -> String;
|
||||
}
|
||||
1097
crates/brightstaff/src/router/orchestrator_model_v1.rs
Normal file
1097
crates/brightstaff/src/router/orchestrator_model_v1.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue