mirror of
https://github.com/meta-llama/llama-stack.git
synced 2026-01-01 14:34:30 +00:00
todos
This commit is contained in:
parent
011fd59a29
commit
8a576d7d72
24 changed files with 297 additions and 2525 deletions
|
|
@ -75,29 +75,31 @@ VALID_SCHEMAS_FOR_EVAL = [
|
|||
]
|
||||
|
||||
|
||||
def get_valid_schemas(api_str: str):
|
||||
if api_str == Api.scoring.value:
|
||||
return VALID_SCHEMAS_FOR_SCORING
|
||||
elif api_str == Api.eval.value:
|
||||
return VALID_SCHEMAS_FOR_EVAL
|
||||
else:
|
||||
raise ValueError(f"Invalid API string: {api_str}")
|
||||
# TODO(xiyan): add this back
|
||||
|
||||
# def get_valid_schemas(api_str: str):
|
||||
# if api_str == Api.scoring.value:
|
||||
# return VALID_SCHEMAS_FOR_SCORING
|
||||
# elif api_str == Api.eval.value:
|
||||
# return VALID_SCHEMAS_FOR_EVAL
|
||||
# else:
|
||||
# raise ValueError(f"Invalid API string: {api_str}")
|
||||
|
||||
|
||||
def validate_dataset_schema(
|
||||
dataset_schema: Dict[str, Any],
|
||||
expected_schemas: List[Dict[str, Any]],
|
||||
):
|
||||
if dataset_schema not in expected_schemas:
|
||||
raise ValueError(f"Dataset {dataset_schema} does not have a correct input schema in {expected_schemas}")
|
||||
# def validate_dataset_schema(
|
||||
# dataset_schema: Dict[str, Any],
|
||||
# expected_schemas: List[Dict[str, Any]],
|
||||
# ):
|
||||
# if dataset_schema not in expected_schemas:
|
||||
# raise ValueError(f"Dataset {dataset_schema} does not have a correct input schema in {expected_schemas}")
|
||||
|
||||
|
||||
def validate_row_schema(
|
||||
input_row: Dict[str, Any],
|
||||
expected_schemas: List[Dict[str, Any]],
|
||||
):
|
||||
for schema in expected_schemas:
|
||||
if all(key in input_row for key in schema):
|
||||
return
|
||||
# def validate_row_schema(
|
||||
# input_row: Dict[str, Any],
|
||||
# expected_schemas: List[Dict[str, Any]],
|
||||
# ):
|
||||
# for schema in expected_schemas:
|
||||
# if all(key in input_row for key in schema):
|
||||
# return
|
||||
|
||||
raise ValueError(f"Input row {input_row} does not match any of the expected schemas in {expected_schemas}")
|
||||
# raise ValueError(f"Input row {input_row} does not match any of the expected schemas in {expected_schemas}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue