Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coderefineai_executor-0.1.5-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file coderefineai_executor-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for coderefineai_executor-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 caea4ac768920004bd8d2d7da99ad386576aa01c74d6d432dcf50c73895b3730
MD5 e07d2200b67d19cb730a4bd8956c63d3
BLAKE2b-256 03d45dfaa43c2bdbd2de0bf7977b11299d651a073938535d1d2d979d1c7061aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page