Eval Definition
Is Code
Checks if the text contains valid programming code
is-code
This evaluation template checks whether a given text contains valid programming code. It can identify code snippets across multiple programming languages and distinguish code from natural language.
Interface Usage
Python SDK Usage
Example Output
Troubleshooting
If you encounter issues with this evaluation:
- Ensure the code is properly formatted with appropriate indentation and syntax for its language
- This evaluation can identify code across common programming languages like Python, JavaScript, Java, etc.
- Mixed content (code with extensive natural language explanations) might yield uncertain results
- Code snippets with syntax errors might still be identified as code, as the evaluation focuses on structural patterns
Related Evaluations
- is-json: Specifically checks if the text is a valid JSON structure
- regex: Validates if a string matches a specified pattern, useful for validating specific code patterns
- json-schema: Evaluates if a JSON object conforms to a specified schema