explainable-exceptions
Artificial Intelligence is being used in several fields, including computer engineering and programming.
During this work, we pretend to facilitate the process of programming as much as possible adding the option to use a NLP (Natural Language Processing) model to help the user to understand and solve the exceptions that may appear while programming.
As simple as using a magic cell, the user will be able to send the exception to the huggingface chat and obtain a possible solution to solve the exception. In this process, the user must be logged in his huggingchat account. Credentials can be saved to be requested only once.
After receiving the response, the user will be able to request another response if the given one is not helpful enough.
Install
To install explainable_exceptions you must use the following pip
command:
pip install explainable_exceptions
How to use
In order to use the magic cell, we need to import it from the core of
explainable_exceptions. The cell is called
explain.
After that, we can label cells using the magic cell command (%%). We can provide a huggingchat user or we can just use the command (if there are not credentials, then it will ask to generate them).
If an exception is raised inside a magic cell, it will be sent to the huggingchat model to generate a possible solution. This response will be shown by the jupyter standard output.
from explainable_exceptions.core import explain
A usage example could be:
%%explain `username`
import random
random.choice([])
Where username must be replaced (if provided) by the username of the
huggingchat account that will be used to request information.
#%%explain ruescog
import random
random.choice([])
CRITICAL:root:Traceback (most recent call last):
File "/home/ruescog/explainable-exceptions/explainable_exceptions/core.py", line 81, in explain
exec(cell, globals(), local_ns)
File "<string>", line 5, in <module>
File "/grupoa/config/miniconda3/lib/python3.8/random.py", line 290, in choice
raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence
WARNING:root:Be careful, the following response has been generated automatically by a Natural Language Processing Model, so the answer may be incorrect or false.
Huggingchat response (online version):
That error is raised by random.choice() function which is used for
generating random elements from iterables like lists, strings etc., and
it seems that there might be no element available to pick from. To fix
the issue you need to ensure that either pass some argument to the
function or check if any item exists before calling the function on that
object. You can refer to python documentation for more details :
Random
Functions
. In case you face similar issues please feel free to ask me , i am here
to help you :) . Also I am just starting so would love if you could rate
interact with me as well.
Do you need another answer? (y/n) n
IndexError: Cannot choose from an empty sequence
Metadata
Release files for explainable-exceptions 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| explainable-exceptions-1.0.2.tar.gz | 9.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| explainable_exceptions-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.8 kB
Release files / explainable-exceptions-1.0.2.tar.gz
| Download URL | explainable-exceptions-1.0.2.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8757045263b46726986695b04b70d0d33ad6732032507d77a2855e982a817707
|
|
BLAKE2b-256 checksum How to use checksums |
2159bc1d79409eb0060d55f169a9b00ee54856353b64bec4e2e7807545e188d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.13
|
Release files / explainable_exceptions-1.0.2-py3-none-any.whl
| Download URL | explainable_exceptions-1.0.2-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2612ce914a993c800240825cf77c00401da6d99fd0b0a0869f4f29aea11b7c9
|
|
BLAKE2b-256 checksum How to use checksums |
d160eebb9174587d2225355729622aa9ce0a96c2be36494feab3b677ca02316f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.13
|
Security for explainable-exceptions 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.