mirror of
https://github.com/katanemo/plano.git
synced 2026-06-29 15:49:40 +02:00
Validate output filter references
This commit is contained in:
parent
5a4487fc6e
commit
146bf415d4
2 changed files with 35 additions and 8 deletions
|
|
@ -562,15 +562,15 @@ 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"
|
"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
|
# Validate listener-level filter IDs reference valid agent/filter IDs.
|
||||||
for listener in listeners:
|
for listener in listeners:
|
||||||
listener_input_filters = listener.get("input_filters", [])
|
for filter_field in ("input_filters", "output_filters"):
|
||||||
for fc_id in listener_input_filters:
|
for fc_id in listener.get(filter_field, []):
|
||||||
if fc_id not in agent_id_keys:
|
if fc_id not in agent_id_keys:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"Listener '{listener.get('name', 'unknown')}' references input_filters id '{fc_id}' "
|
f"Listener '{listener.get('name', 'unknown')}' references {filter_field} id '{fc_id}' "
|
||||||
f"which is not defined in agents or filters. Available ids: {', '.join(sorted(agent_id_keys))}"
|
f"which is not defined in agents or filters. Available ids: {', '.join(sorted(agent_id_keys))}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Validate model aliases if present
|
# Validate model aliases if present
|
||||||
if "model_aliases" in config_yaml:
|
if "model_aliases" in config_yaml:
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,33 @@ routing_preferences:
|
||||||
tracing:
|
tracing:
|
||||||
random_sampling: 100
|
random_sampling: 100
|
||||||
|
|
||||||
|
""",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "unknown_listener_output_filter",
|
||||||
|
"expected_error": "references output_filters id 'missing_output_guard'",
|
||||||
|
"plano_config": """
|
||||||
|
version: v0.4.0
|
||||||
|
|
||||||
|
filters:
|
||||||
|
- id: input_guard
|
||||||
|
url: http://localhost:10500
|
||||||
|
type: http
|
||||||
|
|
||||||
|
listeners:
|
||||||
|
- name: llm
|
||||||
|
type: model
|
||||||
|
port: 12000
|
||||||
|
input_filters:
|
||||||
|
- input_guard
|
||||||
|
output_filters:
|
||||||
|
- missing_output_guard
|
||||||
|
|
||||||
|
model_providers:
|
||||||
|
- model: openai/gpt-4o-mini
|
||||||
|
access_key: $OPENAI_API_KEY
|
||||||
|
default: true
|
||||||
|
|
||||||
""",
|
""",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue