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

@ -4,9 +4,13 @@ properties:
version:
type: string
tools:
type: object
type: array
items:
type: object
agents:
type: object
type: array
items:
type: object
listeners:
type: object
additionalProperties: false

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)]

View file

@ -1,76 +0,0 @@
version: v0.1
listeners:
ingress_traffic:
address: 0.0.0.0
port: 10000
message_format: openai
timeout: 30s
llm_providers:
- name: gpt-4o
access_key: $OPENAI_API_KEY
provider_interface: openai
model: gpt-4o
endpoints:
frankfurther_api:
endpoint: api.frankfurter.dev
protocol: https
tools:
- name: get_exchange_rate
endpoint:
name: frankfurther_api
path: /v1/latest?base={currency_from}&symbols={currency_to}
params:
- name: currency_from
description: currency symbol to convert from
type: str
default: USD
- name: currency_to
description: currency symbol to convert to
type: str
default: EUR
prompt_guards:
input_guards:
jailbreak:
on_exception:
message: Looks like you're curious about my abilities, but I can only provide assistance for currency exchange.
agents:
- name: Currency Exchange Agent
description: Helps with exchange rates for currencies
default_input_modes:
- text
- text/plain
default_output_modes:
- text
- text/plain
skills:
- id: convert_currency
name: Currency Exchange Rates Tool
description: Helps with exchange values between various currencies
examples:
- What is exchange rate between USD and GBP?
capabilities:
streaming: true
push_notifications: true
model: gpt-4o
system_prompt: |
You are a specialized assistant for currency conversions.
Your sole purpose is to use the 'get_exchange_rate' tool to answer questions about currency exchange rates.
If the user asks about anything other than currency conversion or exchange rates,
politely state that you cannot help with that topic and can only assist with currency-related queries.
Do not attempt to answer unrelated questions or use tools for other purposes.
Set response status to input_required if the user needs to provide more information.
Set response status to error if there is an error while processing the request.
Set response status to completed if the request is complete.
tools:
- get_exchange_rate
tracing:
random_sampling: 100
trace_arch_internal: true

View file

@ -1,6 +1,5 @@
version: v0.1
listeners:
ingress_traffic:
address: 0.0.0.0
@ -20,10 +19,9 @@ endpoints:
protocol: https
tools:
get_exchange_rate:
name: get_exchange_rate
- name: get_exchange_rate
description: Get the latest exchange rate for a given currency pair
endpoint:
endpoint:
name: frankfurther_api
path: /v1/latest?base={currency_from}&symbols={currency_to}
parameters:
@ -35,16 +33,14 @@ tools:
description: currency symbol to convert to
type: string
default: EUR
get_list_of_supported_currencies:
name: get_list_of_supported_currencies
- name: get_list_of_supported_currencies
description: Get the list of supported currencies
endpoint:
endpoint:
name: frankfurther_api
path: /v1/currencies
agents:
currency_exchange_agent:
name: Currency Exchange Agent
- name: Currency Exchange Agent
description: Helps with exchange rates for currencies
default_input_modes:
- text
@ -59,26 +55,26 @@ agents:
examples:
- What is exchange rate between USD and GBP?
capabilities:
streaming: true
push_notifications: true
streaming: true
push_notifications: true
agent_orchestrator_model: gpt-4o
agent_orchestrator_prompt: |
You are a specialized assistant for currency conversions.
Your sole purpose is to use the 'get_exchange_rate' tool to answer questions about currency exchange rates.
If the user asks about anything other than currency conversion or exchange rates,
politely state that you cannot help with that topic and can only assist with currency-related queries.
Do not attempt to answer unrelated questions or use tools for other purposes.
Set response status to input_required if the user needs to provide more information.
Set response status to error if there is an error while processing the request.
Set response status to completed if the request is complete.
You are a specialized assistant for currency conversions.
Your sole purpose is to use the 'get_exchange_rate' tool to answer questions about currency exchange rates.
If the user asks about anything other than currency conversion or exchange rates,
politely state that you cannot help with that topic and can only assist with currency-related queries.
Do not attempt to answer unrelated questions or use tools for other purposes.
Set response status to input_required if the user needs to provide more information.
Set response status to error if there is an error while processing the request.
Set response status to completed if the request is complete.
tools:
- get_exchange_rate
- get_list_of_supported_currencies
model: gpt-4o
system_prompt: |
You are a specialized currency exchange assistant.
Your task is to provide the user with the exchange rate between two currencies.
Keep the response concise and relevant to the user's query.
You are a specialized currency exchange assistant.
Your task is to provide the user with the exchange rate between two currencies.
Keep the response concise and relevant to the user's query.
tracing:
random_sampling: 100
trace_arch_internal: true

View file

@ -1,58 +0,0 @@
version: v0.1
listeners:
ingress_traffic:
address: 0.0.0.0
port: 10000
message_format: openai
timeout: 30s
llm_providers:
- name: gpt-4o
access_key: $OPENAI_API_KEY
provider_interface: openai
model: gpt-4o
endpoints:
- name: frankfurther_api
endpoint: api.frankfurter.dev
protocol: https
- name: twelvedata_api
endpoint: api.twelvedata.com
protocol: https
mcp:
- name: get_currency_exchange_rate
- name: get_list_of_supported_currencies
- name: get_stock_quote
prompt_guards:
input_guards:
jailbreak:
on_exception:
message: Looks like you're curious about my abilities, but I can only provide assistance for currency exchange.
agents:
- name: currency_exchange_agent
description: Agent for handling currency exchange queries
llm_provider: gpt-4o
system_prompt: |
You are a helpful assistant. Only respond to queries related to currency exchange. If there are any other questions, I can't help you.
tools:
- get_currency_exchange_rate
- get_list_of_supported_currencies
- name: get_stock_quote_agent
description: Agent for handling stock quote queries
llm_provider: gpt-4o
system_prompt: |
You are a helpful stock exchange assistant. You are given stock symbol along with its exchange rate in json format. Your task is to parse the data and present it in a human-readable format. Keep the details to highlevel and be concise.
tools:
- get_stock_quote
tracing:
random_sampling: 100
trace_arch_internal: true