Send feedback
Class CodeExecutionMetric (2.4.0)
Stay organized with collections
Save and categorize content based on your preferences.
2.4.0 (latest)
2.3.0
2.2.0
2.1.3
2.0.1
1.165.1
1.164.0
1.163.0
1.162.0
1.161.0
1.160.0
1.159.0
1.158.0
1.157.0
1.156.0
1.155.0
1.154.0
CodeExecutionMetric ( ** data : typing . Any )
A metric that executes custom Python code for evaluation.
Methods
CodeExecutionMetric
CodeExecutionMetric ( ** data : typing . Any )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
model_post_init
model_post_init ( context : Any , / ) - > None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that's what pydantic-core passes when calling it.
validate_code
validate_code ( value : typing . Optional [ str ]) - > typing . Optional [ str ]
API documentation for validate_code method.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-10-07 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-07 UTC."],[],[]]