CodeEvals
A Python package for code evaluation and analysis.
Installation
pip install codeevals
Usage
Python API
from typing import List
from codeevals.core import Evaluate
from codeevals.metrics.logic_relevancy import LogicRelevancy
from codeevals.inputs.llm_input import LLMInput
from codeevals.metrics.syntax_relevancy import SyntaxRelevancy
from codeevals.results.base_result import BaseResult
code_relevancy = LogicRelevancy()
syntax_relevancy = SyntaxRelevancy()
evals = Evaluate(metrics=[code_relevancy, syntax_relevancy], model="self-hosted/meta-llama/Meta-Llama-3.1-8B-Instruct",
base_url="https://9styblyjb29d54-8003.proxy.runpod.net/v1")
input_1 = LLMInput(ground_truth = "def sum(a,b):\n\treturn a+b",
actual_response = "def summation(number_1,number_2):\n\tif number_1 is not 0 and number_2 is not 0:\n\t\treturn number_1+number_2")
results: List[BaseResult] = evals.evaluate(llm_input=[input_1])
for result in results.results:
print(f"eval: {result.eval_name}, score: {result.score}, reason: {result.reason}")
Development
Setting up the development environment
# Clone the repository
git clone https://github.com/yourusername/codevals.git
cd codevals
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
License
This project is licensed under the terms of the Apache2.0 license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
codeevals-0.0.2.tar.gz
(11.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
codeevals-0.0.2-py3-none-any.whl
(20.8 kB
view details)
File details
Details for the file codeevals-0.0.2.tar.gz.
File metadata
- Download URL: codeevals-0.0.2.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8fb2ef60e2805b988c2a00d20785b43ced994a493089fe5aa218e5d139f9423
|
|
| MD5 |
cecd70949dfc1ef7b8217de029d8121d
|
|
| BLAKE2b-256 |
dddf06ec7565585f32a60fb6d26b62fc1c5650687e64cb07dbfb0ba8cbc83c9d
|
File details
Details for the file codeevals-0.0.2-py3-none-any.whl.
File metadata
- Download URL: codeevals-0.0.2-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0ab693cd3d1045651901171a9c920bf647ae72fbe5496a54274fcb47b31e903
|
|
| MD5 |
ab0f03254446654f74b28973202daec0
|
|
| BLAKE2b-256 |
b61f092a11870caab3a46768fbba3f893f7a9bcf055be6c1b70f4fc49b0bd921
|