more changes

This commit is contained in:
Adil Hafeez 2025-04-25 01:14:12 -07:00
parent 299f183e66
commit 9db30caff1
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
6 changed files with 40 additions and 162 deletions

View file

@ -82,8 +82,20 @@ impl RootContext for FilterContext {
self.system_prompt = Rc::new(config.system_prompt);
self.prompt_targets = Rc::new(prompt_targets);
self.endpoints = Rc::new(config.endpoints);
self.agents = Rc::new(config.agents);
self.tools = Rc::new(config.tools);
//TOOD: check to make sure that agents name is unique
let agents_map: HashMap<String, Agent> = config
.agents
.iter()
.map(|agent| (agent.name.clone(), agent.clone()))
.collect();
self.agents = Rc::new(agents_map);
//TODO: check to make sure that tools name is unique
let tools_map: HashMap<String, Tool> = config
.tools
.iter()
.map(|tool| (tool.name.clone(), tool.clone()))
.collect();
self.tools = Rc::new(tools_map);
if let Some(prompt_guards) = config.prompt_guards {
self.prompt_guards = Rc::new(prompt_guards)

View file

@ -19,8 +19,8 @@ pub struct Configuration {
pub ratelimits: Option<Vec<Ratelimit>>,
pub tracing: Option<Tracing>,
pub mode: Option<GatewayMode>,
pub agents: HashMap<String, Agent>,
pub tools: HashMap<String, Tool>,
pub agents: Vec<Agent>,
pub tools: Vec<Tool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]