mirror of
https://github.com/katanemo/plano.git
synced 2026-06-08 14:55:14 +02:00
add output filter chain (#822)
This commit is contained in:
parent
de2d8847f3
commit
1f23c573bf
59 changed files with 2961 additions and 2621 deletions
|
|
@ -430,6 +430,16 @@ def validate_and_render_schema():
|
|||
"Please provide model_providers either under listeners or at root level, not both. Currently we don't support multiple listeners with model_providers"
|
||||
)
|
||||
|
||||
# Validate input_filters IDs on listeners reference valid agent/filter IDs
|
||||
for listener in listeners:
|
||||
listener_input_filters = listener.get("input_filters", [])
|
||||
for fc_id in listener_input_filters:
|
||||
if fc_id not in agent_id_keys:
|
||||
raise Exception(
|
||||
f"Listener '{listener.get('name', 'unknown')}' references input_filters id '{fc_id}' "
|
||||
f"which is not defined in agents or filters. Available ids: {', '.join(sorted(agent_id_keys))}"
|
||||
)
|
||||
|
||||
# Validate model aliases if present
|
||||
if "model_aliases" in config_yaml:
|
||||
model_aliases = config_yaml["model_aliases"]
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ def _resolve_cli_agent_endpoint(plano_config_yaml: dict) -> tuple[str, int]:
|
|||
|
||||
if isinstance(listeners, list):
|
||||
for listener in listeners:
|
||||
if listener.get("type") in ["model", "model_listener"]:
|
||||
if listener.get("type") == "model":
|
||||
host = listener.get("host") or listener.get("address") or "0.0.0.0"
|
||||
port = listener.get("port", 12000)
|
||||
return host, port
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ def convert_legacy_listeners(
|
|||
) -> tuple[list, dict | None, dict | None]:
|
||||
llm_gateway_listener = {
|
||||
"name": "egress_traffic",
|
||||
"type": "model_listener",
|
||||
"type": "model",
|
||||
"port": 12000,
|
||||
"address": "0.0.0.0",
|
||||
"timeout": "30s",
|
||||
|
|
@ -98,7 +98,7 @@ def convert_legacy_listeners(
|
|||
|
||||
prompt_gateway_listener = {
|
||||
"name": "ingress_traffic",
|
||||
"type": "prompt_listener",
|
||||
"type": "prompt",
|
||||
"port": 10000,
|
||||
"address": "0.0.0.0",
|
||||
"timeout": "30s",
|
||||
|
|
|
|||
|
|
@ -104,13 +104,13 @@ listeners:
|
|||
agents:
|
||||
- id: simple_tmobile_rag_agent
|
||||
description: t-mobile virtual assistant for device contracts.
|
||||
filter_chain:
|
||||
input_filters:
|
||||
- query_rewriter
|
||||
- context_builder
|
||||
- response_generator
|
||||
- id: research_agent
|
||||
description: agent to research and gather information from various sources.
|
||||
filter_chain:
|
||||
input_filters:
|
||||
- research_agent
|
||||
- response_generator
|
||||
port: 8000
|
||||
|
|
@ -376,7 +376,7 @@ def test_convert_legacy_llm_providers():
|
|||
assert updated_providers == [
|
||||
{
|
||||
"name": "egress_traffic",
|
||||
"type": "model_listener",
|
||||
"type": "model",
|
||||
"port": 12000,
|
||||
"address": "0.0.0.0",
|
||||
"timeout": "30s",
|
||||
|
|
@ -384,7 +384,7 @@ def test_convert_legacy_llm_providers():
|
|||
},
|
||||
{
|
||||
"name": "ingress_traffic",
|
||||
"type": "prompt_listener",
|
||||
"type": "prompt",
|
||||
"port": 10000,
|
||||
"address": "0.0.0.0",
|
||||
"timeout": "30s",
|
||||
|
|
@ -400,7 +400,7 @@ def test_convert_legacy_llm_providers():
|
|||
},
|
||||
],
|
||||
"name": "egress_traffic",
|
||||
"type": "model_listener",
|
||||
"type": "model",
|
||||
"port": 12000,
|
||||
"timeout": "30s",
|
||||
}
|
||||
|
|
@ -410,7 +410,7 @@ def test_convert_legacy_llm_providers():
|
|||
"name": "ingress_traffic",
|
||||
"port": 10000,
|
||||
"timeout": "30s",
|
||||
"type": "prompt_listener",
|
||||
"type": "prompt",
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ def test_convert_legacy_llm_providers_no_prompt_gateway():
|
|||
"name": "egress_traffic",
|
||||
"port": 12000,
|
||||
"timeout": "30s",
|
||||
"type": "model_listener",
|
||||
"type": "model",
|
||||
}
|
||||
]
|
||||
assert llm_gateway == {
|
||||
|
|
@ -461,7 +461,7 @@ def test_convert_legacy_llm_providers_no_prompt_gateway():
|
|||
},
|
||||
],
|
||||
"name": "egress_traffic",
|
||||
"type": "model_listener",
|
||||
"type": "model",
|
||||
"port": 12000,
|
||||
"timeout": "30s",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue