parsed_response_results = parse_eval_results(request_eval_results)
# Collect the scores for a final evaluation table
scores['result_synthesizer'].extend(parsed_response_results)
# Print out Score statistics for the evaluation session
header = "{:<20}\t{:<10}\t{:<10}\t{:<10}".format("Metric", "Min", "Mean", "Max")
print(header)
for metric, metric_scores in scores.items():
    mean_scores = sum(metric_scores) / len(metric_scores) if len(metric_scores) > 0 else float('nan')
    row = "{:<20}\t{:<10.2f}\t{:<10.2f}\t{:<10.2f}".format(metric, min(metric_scores), mean_scores, max(metric_scores))
    print(row)
Metric              	Min       	Mean      	Max       
completed           	1.00      	1.00      	1.00      
request_synthesizer 	0.00      	0.23      	1.00      
result_synthesizer  	0.00      	0.55      	1.00      
# Re-show the examples for which the chain failed to complete
failed_examples
[]
Generating Test Datasets#
To evaluate a chain against your own endpoint, you’ll want to generate a test dataset that’s conforms to the API.
This section provides an overview of how to bootstrap the process.
First, we’ll parse the OpenAPI Spec. For this example, we’ll Speak’s OpenAPI specification.
# Load and parse the OpenAPI Spec
spec = OpenAPISpec.from_url("https://api.speak.com/openapi.yaml")
Attempting to load an OpenAPI 3.0.1 spec.  This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.
rtdocs_stable/api.python.langchain.com/en/stable/use_cases/evaluation/openapi_eval.html