mirror of
https://github.com/katanemo/plano.git
synced 2026-04-27 17:56:28 +02:00
Improve config validation error messages (#825)
* improve config validation error messages and update getting started demo * fix black formatting
This commit is contained in:
parent
bc059aed4d
commit
5d85829bc2
2 changed files with 19 additions and 8 deletions
|
|
@ -3,7 +3,7 @@ import os
|
|||
from planoai.utils import convert_legacy_listeners
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
import yaml
|
||||
from jsonschema import validate
|
||||
from jsonschema import validate, ValidationError
|
||||
from urllib.parse import urlparse
|
||||
from copy import deepcopy
|
||||
from planoai.consts import DEFAULT_OTEL_TRACING_GRPC_ENDPOINT
|
||||
|
|
@ -507,11 +507,15 @@ def validate_prompt_config(plano_config_file, plano_config_schema_file):
|
|||
|
||||
try:
|
||||
validate(config_yaml, config_schema_yaml)
|
||||
except Exception as e:
|
||||
print(
|
||||
f"Error validating plano_config file: {plano_config_file}, schema file: {plano_config_schema_file}, error: {e}"
|
||||
except ValidationError as e:
|
||||
path = (
|
||||
" → ".join(str(p) for p in e.absolute_path) if e.absolute_path else "root"
|
||||
)
|
||||
raise e
|
||||
raise ValidationError(
|
||||
f"{e.message}\n Location: {path}\n Value: {e.instance}"
|
||||
) from None
|
||||
except Exception as e:
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue