Giter Site home page Giter Site logo

navinbondade / python-code-writer-code-fixer-error-explainer-and-code-commenter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7.25 MB

Here in this project, I have built an AI system that writes Python code as per user's question, fixes the errors of the user's code and also explain the error.

Python 100.00%

python-code-writer-code-fixer-error-explainer-and-code-commenter's Introduction

Python Code Writer, Code Fixer, Error Explainer and Code Commenter Powered By CodeLLAMA and Zephyr

The development of functional Python code often presents significant challenges, demanding a deep understanding of the language and exceptional debugging abilities. Developers frequently encounter difficulties in crafting efficient code or resolving complex errors, leading to time-consuming and frustrating experiences. To address these hurdles, we have developed an innovative AI system capable of generating Python code based on user-provided prompts. Furthermore, this system excels at identifying and rectifying errors within existing Python code, offering clear explanations and potential solutions. By automating these tasks, our AI system significantly streamlines the development process, enabling developers to focus on higher-level problem-solving and enhancing overall productivity.

Libraries Used

  • LangChain
  • Hugging Face
  • Streamlit

Methodology

Python Code Fixer and Error Explaine

In the “Python Code Fixer and Error Explainer System” I have used CodeLlama and Zephyr models. CodeLlama is utilized to fix the errored code of the user. With prompt engineering, I crafted a custom prompt that incorporates instructions about what the CodeLlama should do. The prompt also includes the user’s error code and the error message generated by the Python interpreter. This prompt acts as input to the CodeLlama model. Considering the error message with respect to the user's code, the CodeLlama model fixes the error and produces the error-free fixed code. The Zephyr model also takes a custom prompt mentioning “explain the error.” After understanding the error, the model outputs a short but accurate explanation of the error message to make the user understand what causes the error.

Python Code Writer

In the “Python Code Writer System” I have used the CodeLlama mode. A custom prompt has been crafted and tested mentioning that the model is an expert Python programmer and its job is to write error-free Python code as per the user's question. This prompt plus user’s question is given to the model to generate an accurate and optimized Python code.

Code Llama

Code Llama is a code-specialized version of Llama 2 that was created by further training Llama 2 on its code-specific datasets, sampling more data from that same dataset for longer. Essentially, Code Llama features enhanced coding capabilities, built on top of Llama 2. It can generate code, and natural language about code, from both code and natural language prompts. It can also be used for code completion and debugging.

Zephyr 7B Beta

Zephyr is a series of language models that are trained to act as helpful assistants. Zephyr-7B-β is the second model in the series, and is a fine-tuned version of mistralai/Mistral-7B-v0.1 that was trained on on a mix of publicly available, synthetic datasets using Direct Preference Optimization (DPO).

Demo Video

Python Code Fixer and Error Explaine

code_fixer.mp4

Python Code Writer

code_generator.mp4

Python Comment Writer

Commenting.the.code.mp4

Python Code Written By The AI

Data Science & Machine Learning Questions:

How to train neural network in tensorflow?

Write an example of linear regression in scikit learn?

How to convert numpy array into tensor?

How to split dataset in train and test using scikit learn?

General Python Questions

Write a program to print the given number is odd or even.

Write a program to find a fibonacci of a number.

Write a program to remove duplicates from a list.

Write a program to find the second largest number in a list.

Errors Fixed & Explained By The AI

Module Not Found Error:

Named Error:

Index Out of Range Error:

Attribute Error:

Comments Added By The AI To Python Code

Python Program to Find Armstrong Number in an Interval

Python Program to Create a Countdown Timer

Python Program to Transpose a Matrix

Python Program to Reverse a Number

Python Program to Find Sum of Array

Conclusion

Here in this project, I have built an AI system that writes Python code as per user's question, fixes the errors of the user's code, explain the error and also comment out the code using two large language modes, i.e. CodeLlama and Zephyr.

python-code-writer-code-fixer-error-explainer-and-code-commenter's People

Contributors

navinbondade avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.