InlineGPT is a Python package that integrates Google's Generative AI models directly into your Python applications to provide inline error handling and suggestions for code corrections.
You can install InlineGPT via pip:
pip install InlineGPTTo use InlineGPT, you need to obtain an API key from Google AI Studio.
from inline.inlinegpt import InlineGPT
import os
# Initialize your API KEY
gpt = InlineGPT(os.environ.get('G_API_KEY'))
try:
result = 10 / 0
except ZeroDivisionError as e:
print(f"Error: {e}")
gpt.get_solution("test.py", e)The get_solution method analyzes the code in file_name and the provided error_message, then generates a response suggesting how to resolve the error using Google's Generative AI models.
We welcome contributions to InlineGPT! Please fork the repository and submit pull requests to contribute.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues with InlineGPT or have suggestions for improvements, please open an issue on GitHub.
- Dependencies: InlineGPT relies on
google.generativeaifor its AI capabilities. Ensure you have the necessary permissions and API key from Google AI Studio. - Error Handling: If the API key is invalid or not provided, InlineGPT will raise an initialization error.