Package: bitefix
BiteFix 🛠️BiteFix is an advanced and efficient tool designed to revolutionize the error-fixing process using the capabilities of Large Language Models (LLM). It is a Python library that offers a range of decorators to help you debug your code and fix errors in a matter of seconds.Table of Contents 📋IntroductionTechnologies UsedGetting StartedExamplesContributingFeedbackContactLicenseReferencesIntroduction🌟By offering decorators, BiteFix empowers you to enhance the error-handling experience in your functions. When a decorated function encounters an error, the decorator orchestrates a team of AI Agents, each specializing in a unique aspect of error resolution. Here's a brief overview of the AI Agents:🕵️Python code Diagnosis Expert: Swiftly analyzes the code to pinpoint the root cause of the error.👨‍💻Senior Python Developer: Provides insightful ideas on how to rectify the issue within the decorated function's code.👩‍💼Lead Python Developer: Meticulously evaluates ideas, selecting the most effective one for implementation.👨‍💻Python Code Developer: Skillfully rewrites the code to bring the chosen idea to life, ultimately fixing the error.BiteFix simplifies the error-fixing journey by seamlessly combining the expertise of these AI Agents, ensuring a smoother and more efficient debugging process for your Python code.Technologies-Used🔧Getting-Started🚀Install BiteFix usingpip install bitefixExplore the powerful decorators to streamline your error-fixing process!Check out theexamplesto understand how BiteFix works.Happy Coding! 🚀Examples💻Let's take a look at some examples to understand how BiteFix works. Bitefix offers two decorators:@resolveand@resolve_with_openai.Example 1 : Using Open AI ModelsLet's say you have a function that is supposed to return longest length of subsequence in a given list. We can use@resolve_with_openaidecorator with our function to help us resolve the error if the function fails while execution.frombitefiximportresolve_with_openai@resolve_with_openai(openai_api_key="YOUR_OPENAI_KEY")deflength_of_lis(nums):ifnotnums:return0dp=[1]*len(nums)foriinrange(1,len(nums)):forjinrange(i):ifnums[i]>nums[j]:dp[i]=dp[i+1]returnmax(dp)In the above example, we have just added Open AI API key as a parameter to the decorator. You can also add the name of the particular Open AI LLM you want to use and the temperature. By default, it uses OpenAI's gpt-4 model with temperature 0.7.
Now after writing the function, let's try to execute it with a list of numbers.input_list=[10,9,2,5,3,7,101,18]result=length_of_lis(input_list)print(result)Here is the recorded output of the function execution -bitefix_decorator_exampleWe can see how this decorator provided us step by step debugging of the function in case of failure by using crew of Python AI coders. It also provided us with the solution to the error.Example 2 : Using Open Source ModelsIf we want to use some other Large Language Model instead of OpenAI, we can use@resolvedecorator with our function to help us resolve the error if the function fails while execution. This helps us to use any custom trained model as well for error resolution.For this example, let's use Openhermes model from Ollama. You can download Ollama fromhere. Ollama allows you to run open-source large language models, such as Openhermes, Llama 2, locally.After downloading Ollama, install it. Then run the following command to pull the Openhermes model.ollamapullopenhermesNow, we can use the model with the decorator@resolveas follows.frombitefiximportresolvefromlangchain_community.llmsimportOllamallm=Ollama("openhermes")@resolve(llm)deflength_of_lis(nums):ifnotnums:return0dp=[1]*len(nums)foriinrange(1,len(nums)):forjinrange(i):ifnums[i]>nums[j]:dp[i]=dp[i+1]returnmax(dp)Similarly, we can use any other Large Language Model with the decorator.Contributing🤝Contributions are always welcome!If you find any issue or have suggestions for improvements, please submit them as Github issues or pull requests.Here is the steps you can follow to contribute to this project:Fork the project on Github.Clone the forked project to your local machine.Create a virtual environment usingpython -m venv venv.Activate the virtual environment usingvenv\Scripts\activateon Windows orsource venv/bin/activateon Mac/LinuxInstall the dependencies usingpip install -r requirements.txt.Make the required changes.Format the code usingblack ..Create a pull request.Feedback📣'bitefix' library is just a small step towards making the error-fixing process more efficient using the capabilities of Large Language Models. We have to go a long way to make this better.
Feel free to send me feedback atdataaienthusiast128@gmail.com. Let me know if you have any suggestions on how to make this project better.If you liked the project support it by giving a star :star: to this repo.🔗Contact📞License📝This project is licensed under the terms of theMIT licenseReferences📚crewAI: Cutting-edge framework for orchestrating role-playing, autonomous AI agents.https://github.com/joaomdmoura/crewAIlangchain: Python library for interacting with the Langchain API.https://api.python.langchain.com/en/latest/langchain_api_reference.html#OpenAI: OpenAI is an artificial intelligence research laboratory consisting of the for-profit corporation OpenAI LP and its parent company, the non-profit OpenAI Inc.https://openai.com/Ollama: Ollama allows you to run open-source large language models, such as Openhermes, Llama 2, locally.https://ollama.ai/