explainable-exceptions


Nameexplainable-exceptions JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/ruescog/explainable-exceptions
SummaryA Python module to explain exceptions in execution-time using a magic cell
upload_time2023-07-13 07:59:18
maintainer
docs_urlNone
authorruescog
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            explainable-exceptions
================

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

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](https://huggingface.co/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:

``` sh
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`](https://ruescog.github.io/explainable-exceptions/core.html#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.

``` python
from explainable_exceptions.core import explain
```

A usage example could be:

``` javascript
%%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.

``` python
#%%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)](https://huggingface.co/chat):

*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](https://docs.python.org/3/library/random.html#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



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ruescog/explainable-exceptions",
    "name": "explainable-exceptions",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "nbdev jupyter notebook python",
    "author": "ruescog",
    "author_email": "ruescog@unirioja.es",
    "download_url": "https://files.pythonhosted.org/packages/21/59/bc1d79409eb0060d55f169a9b00ee54856353b64bec4e2e7807545e188d3/explainable-exceptions-1.0.2.tar.gz",
    "platform": null,
    "description": "explainable-exceptions\n================\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\nArtificial Intelligence is being used in several fields, including\ncomputer engineering and programming.\n\nDuring this work, we pretend to facilitate the process of programming as\nmuch as possible adding the option to use a NLP (Natural Language\nProcessing) model to help the user to understand and solve the\nexceptions that may appear while programming.\n\nAs simple as using a magic cell, the user will be able to send the\nexception to the [huggingface chat](https://huggingface.co/chat/) and\nobtain a possible solution to solve the exception. In this process, the\nuser must be logged in his huggingchat account. Credentials can be saved\nto be requested only once.\n\nAfter receiving the response, the user will be able to request another\nresponse if the given one is not helpful enough.\n\n## Install\n\nTo install `explainable_exceptions` you must use the following pip\ncommand:\n\n``` sh\npip install explainable_exceptions\n```\n\n## How to use\n\nIn order to use the magic cell, we need to import it from the `core` of\n`explainable_exceptions`. The cell is called\n[`explain`](https://ruescog.github.io/explainable-exceptions/core.html#explain).\n\nAfter that, we can label cells using the magic cell command (%%). We can\nprovide a huggingchat user or we can just use the command (if there are\nnot credentials, then it will ask to generate them).\n\nIf an exception is raised inside a magic cell, it will be sent to the\nhuggingchat model to generate a possible solution. This response will be\nshown by the jupyter standard output.\n\n``` python\nfrom explainable_exceptions.core import explain\n```\n\nA usage example could be:\n\n``` javascript\n%%explain `username`\n\nimport random\nrandom.choice([])\n```\n\nWhere `username` must be replaced (if provided) by the username of the\nhuggingchat account that will be used to request information.\n\n``` python\n#%%explain ruescog\n\nimport random\nrandom.choice([])\n```\n\n    CRITICAL:root:Traceback (most recent call last):\n      File \"/home/ruescog/explainable-exceptions/explainable_exceptions/core.py\", line 81, in explain\n        exec(cell, globals(), local_ns)\n      File \"<string>\", line 5, in <module>\n      File \"/grupoa/config/miniconda3/lib/python3.8/random.py\", line 290, in choice\n        raise IndexError('Cannot choose from an empty sequence') from None\n    IndexError: Cannot choose from an empty sequence\n\n    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.\n\n## Huggingchat response [(online version)](https://huggingface.co/chat):\n\n*That error is raised by `random.choice()` function which is used for\ngenerating random elements from iterables like lists, strings etc., and\nit seems that there might be no element available to pick from.* *To fix\nthe issue you need to ensure that either pass some argument to the\nfunction or check if any item exists before calling the function on that\nobject.* *You can refer to python documentation for more details :\n[Random\nFunctions](https://docs.python.org/3/library/random.html#random-functions)\n. In case you face similar issues please feel free to ask me , i am here\nto help you :) . Also I am just starting so would love if you could rate\ninteract with me as well.*\n\n------------------------------------------------------------------------\n\n\n    Do you need another answer? (y/n) n\n\n    IndexError: Cannot choose from an empty sequence\n\n\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "A Python module to explain exceptions in execution-time using a magic cell",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/ruescog/explainable-exceptions"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d160eebb9174587d2225355729622aa9ce0a96c2be36494feab3b677ca02316f",
                "md5": "71aca60e650dcb8cb39b6c86d3e24e89",
                "sha256": "c2612ce914a993c800240825cf77c00401da6d99fd0b0a0869f4f29aea11b7c9"
            },
            "downloads": -1,
            "filename": "explainable_exceptions-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "71aca60e650dcb8cb39b6c86d3e24e89",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8714,
            "upload_time": "2023-07-13T07:59:15",
            "upload_time_iso_8601": "2023-07-13T07:59:15.501653Z",
            "url": "https://files.pythonhosted.org/packages/d1/60/eebb9174587d2225355729622aa9ce0a96c2be36494feab3b677ca02316f/explainable_exceptions-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2159bc1d79409eb0060d55f169a9b00ee54856353b64bec4e2e7807545e188d3",
                "md5": "f517771a1884df5c0113bda336d27e2a",
                "sha256": "8757045263b46726986695b04b70d0d33ad6732032507d77a2855e982a817707"
            },
            "downloads": -1,
            "filename": "explainable-exceptions-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f517771a1884df5c0113bda336d27e2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9038,
            "upload_time": "2023-07-13T07:59:18",
            "upload_time_iso_8601": "2023-07-13T07:59:18.790957Z",
            "url": "https://files.pythonhosted.org/packages/21/59/bc1d79409eb0060d55f169a9b00ee54856353b64bec4e2e7807545e188d3/explainable-exceptions-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-13 07:59:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ruescog",
    "github_project": "explainable-exceptions",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "explainable-exceptions"
}
        
Elapsed time: 0.12139s