Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roma-guru/smart-exceptions
Better Python Stacktraces with power of AI.
https://github.com/roma-guru/smart-exceptions
Last synced: 7 days ago
JSON representation
Better Python Stacktraces with power of AI.
- Host: GitHub
- URL: https://github.com/roma-guru/smart-exceptions
- Owner: roma-guru
- License: mit
- Created: 2024-03-05T21:29:55.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-08-08T19:40:09.000Z (4 months ago)
- Last Synced: 2024-08-14T08:11:02.479Z (4 months ago)
- Language: Jupyter Notebook
- Size: 683 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-chatgpt - Python Smart Exceptions - AI-powered Python exceptions debugging. (Integrations / Examples)
README
# smart-exceptions
Better Python Stacktraces with power of AI.
Now your problems are solved at the same moment they're arised!## Installation
```console
pip install smart-exceptions
```## Usage
In file:
```python
import smart_exceptions as se
se.init("your-openai-token")
se.install_handler()
...[code causing exception]...
```
In [debug] console global exception handler is suppressed and have to call GPT explicitly:
```python
>>> import smart_exceptions as se; se.init("your-openai-token")
>>> ...[code causing exception]...
>>> se.ask_gpt()
```You can provide token explicitly or implicitly via _$OPENAI\_TOKEN_ env variable.
Also you can specify proxy explicitly or via _$OPENAI\_PROXY_.## Pytest support
Place this in `conftest.py`:
```python
import smart_exceptions as se
se.init()def pytest_exception_interact(node, call, report):
exc_info = (call.excinfo.type, call.excinfo.value, call.excinfo.traceback[0]._rawentry)
se.gpt_backend.ask_gpt(exc_info)
```## Demo
[![Smart Exceptions Demo](https://img.youtube.com/vi/XfaaJW_2RfU/0.jpg)](https://www.youtube.com/watch?v=XfaaJW_2RfU)Click to go to Youtube.