Skip to main content

CodeRefineAI

Can LLM's identify and remove Software Inefficiencies?

Overview

CodeRefineAI is a project aimed at leveraging Large Language Models (LLMs) to identify and remove software inefficiencies. The project includes a code execution framework that allows for the submission and validation of code snippets using the Judge0 API.

Features

  • Code Execution: Submit and execute code snippets using the Judge0 API.
  • Template-Based Execution: Execute code using predefined templates.
  • Direct Code Execution: Execute entire code snippets directly without templates.
  • Submission Details: Retrieve detailed information about code submissions.

Installation

To install the CodeRefineAI package, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/CodeRefineAI.git
    cd CodeRefineAI
    
  2. Install the package:

    pip install .
    

Usage

Example: Template-Based Execution

from coderefineai_executor import Executor,load_settings

# Example settings
settings = load_settings("/path/to/your/.env")

# Create an instance of Executor
executor = Executor(settings)

# Example metadata
metadata = pd.Series({
    "question_id": 1,
    "name": "Example Question",
    "setup_code": "class TestCaseGenerator: ...",
    "entry_point": "main",
    "import_code": "import sys",
    "test_cases": "..." #problem dependent
})

# Execute the code
response = executor.execute(
    code_template="def {entry_point}():\n    {import_code}\n    {solution_code}\n    {test_case_code}",
    solution_code="print('Hello, world!')",
    metadata=metadata
)

print(response)

Example: Direct Code Execution

from coderefineai_executor import Executor,load_settings

# Example settings
settings = Settings(
    env="dev",
    self_hosted=True,
    judge0_base_url="http://64.23.144.74:2358",
    judge0_api_key="",
)

executor = Executor(settings)

# Execute the code
response = executor.execute_code(
    code="print('Hello, world!')",
    test_cases="",
    expected_results="Hello, world!",
    )

    # Print the response for debugging purposes
print(response)

Configuration

The Settings class is used to configure the Executor. Here is an example configuration:

from core.executor.config import Settings

settings = Settings(
    env="dev",
    self_hosted=True,
    judge0_base_url="http://64.23.144.74:2358",
    judge0_api_key="",
)

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Contact

For any questions or inquiries, please contact the very handsome harish876.

Metadata

Release files for coderefineai-executor 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for coderefineai-executor 0.1.5
File Interpreter ABI Platform Actions
coderefineai_executor-0.1.5-py3-none-any.whl Python 3 none any Details for coderefineai_executor-0.1.5-py3-none-any.whl

Release files / coderefineai_executor-0.1.5-py3-none-any.whl

Download URL coderefineai_executor-0.1.5-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caea4ac768920004bd8d2d7da99ad386576aa01c74d6d432dcf50c73895b3730
BLAKE2b-256 checksum
How to use checksums
03d45dfaa43c2bdbd2de0bf7977b11299d651a073938535d1d2d979d1c7061aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Security for coderefineai-executor 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page