stochasticparrot


Namestochasticparrot JSON
Version 0.2 PyPI version JSON
download
home_pagehttps://github.com/yourusername/custom_error_handler
SummaryA package for handling errors with custom logging that lets OpenAI API make suggestions.
upload_time2023-08-11 23:59:15
maintainer
docs_urlNone
authorWes Ladd
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Custom Error Handler: Stochastic Parrot

Stochastic Parrot is a Python package that provides a robust way to handle uncaught exceptions in your Python scripts. It logs error details, displays them in a color-coded console output, and leverages OpenAI to suggest fixes.

## Features:

- Colored Console Logging: Utilizes different colors for log levels like DEBUG, INFO, WARNING, ERROR, and CRITICAL.
- File Logging: Automatically logs errors to a file named 'automated_error_handling.log'.
- Traceback Capture: Gathers detailed traceback information including surrounding lines of code where the error occurred.
- OpenAI Integration: Sends error information to OpenAI's GPT-4 model to get suggested fixes.

## How to Use:

1. Installation: Install the package using pip install stochastic-parrot.
2. Initialization: Import and initialize Stochastic Parrot in your script:
   import stochastic_parrot
   stochastic_parrot.initialize()

## Components:

- ColoredConsoleHandler: A custom logging handler class that extends logging.StreamHandler. It allows for log messages to be printed to the console in different colors based on the log level.
- custom_error_handler: A function to be set as sys.excepthook to handle uncaught exceptions. It captures the traceback, reads surrounding code, logs the details, and calls the OpenAI API to suggest fixes.
- openai_chat_completion_base_query: A function to query OpenAI's GPT-4 model. It sends the error details and receives a suggested code fix in response.
- initialize: A function to initialize Stochastic Parrot. It sets up the OpenAI API key and sys.excepthook.

## Requirements:

- openai: To interact with the OpenAI API.
- termcolor: To colorize the console output.
- getpass: To get the OpenAI API key from the user.
- logging: To log the error details.
- sys: To set the custom error handler as sys.excepthook.
- traceback: To capture the traceback.

## License:

This project is licensed under the MIT License. See the LICENSE.txt file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/custom_error_handler",
    "name": "stochasticparrot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Wes Ladd",
    "author_email": "wesladd@traingrc.com",
    "download_url": "https://files.pythonhosted.org/packages/79/2d/0f9501a55f40e45ede2687d36620122937fa16ec6242c28b57a7d34eccfb/stochasticparrot-0.2.tar.gz",
    "platform": null,
    "description": "# Custom Error Handler: Stochastic Parrot\n\nStochastic Parrot is a Python package that provides a robust way to handle uncaught exceptions in your Python scripts. It logs error details, displays them in a color-coded console output, and leverages OpenAI to suggest fixes.\n\n## Features:\n\n- Colored Console Logging: Utilizes different colors for log levels like DEBUG, INFO, WARNING, ERROR, and CRITICAL.\n- File Logging: Automatically logs errors to a file named 'automated_error_handling.log'.\n- Traceback Capture: Gathers detailed traceback information including surrounding lines of code where the error occurred.\n- OpenAI Integration: Sends error information to OpenAI's GPT-4 model to get suggested fixes.\n\n## How to Use:\n\n1. Installation: Install the package using pip install stochastic-parrot.\n2. Initialization: Import and initialize Stochastic Parrot in your script:\n   import stochastic_parrot\n   stochastic_parrot.initialize()\n\n## Components:\n\n- ColoredConsoleHandler: A custom logging handler class that extends logging.StreamHandler. It allows for log messages to be printed to the console in different colors based on the log level.\n- custom_error_handler: A function to be set as sys.excepthook to handle uncaught exceptions. It captures the traceback, reads surrounding code, logs the details, and calls the OpenAI API to suggest fixes.\n- openai_chat_completion_base_query: A function to query OpenAI's GPT-4 model. It sends the error details and receives a suggested code fix in response.\n- initialize: A function to initialize Stochastic Parrot. It sets up the OpenAI API key and sys.excepthook.\n\n## Requirements:\n\n- openai: To interact with the OpenAI API.\n- termcolor: To colorize the console output.\n- getpass: To get the OpenAI API key from the user.\n- logging: To log the error details.\n- sys: To set the custom error handler as sys.excepthook.\n- traceback: To capture the traceback.\n\n## License:\n\nThis project is licensed under the MIT License. See the LICENSE.txt file for details.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A package for handling errors with custom logging that lets OpenAI API make suggestions.",
    "version": "0.2",
    "project_urls": {
        "Homepage": "https://github.com/yourusername/custom_error_handler"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f02b35a9e0873c0408f22ccebae2e19b2df58ec5406fbb52ff24d1ed68e0330d",
                "md5": "7390527d8898a2bdf1c73c949fb43ecb",
                "sha256": "6e3976ef959e480f4660e95128d47b8e47d6000e2d98a0c6547c657f95fad286"
            },
            "downloads": -1,
            "filename": "stochasticparrot-0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7390527d8898a2bdf1c73c949fb43ecb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3883,
            "upload_time": "2023-08-11T23:59:13",
            "upload_time_iso_8601": "2023-08-11T23:59:13.709713Z",
            "url": "https://files.pythonhosted.org/packages/f0/2b/35a9e0873c0408f22ccebae2e19b2df58ec5406fbb52ff24d1ed68e0330d/stochasticparrot-0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "792d0f9501a55f40e45ede2687d36620122937fa16ec6242c28b57a7d34eccfb",
                "md5": "26bf9e710b22ef6542dd81f58d84b446",
                "sha256": "5a5d7d6cd1c0dbed19552fd6debc662636466bd617874f2f73afbf8218a523da"
            },
            "downloads": -1,
            "filename": "stochasticparrot-0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "26bf9e710b22ef6542dd81f58d84b446",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3662,
            "upload_time": "2023-08-11T23:59:15",
            "upload_time_iso_8601": "2023-08-11T23:59:15.227461Z",
            "url": "https://files.pythonhosted.org/packages/79/2d/0f9501a55f40e45ede2687d36620122937fa16ec6242c28b57a7d34eccfb/stochasticparrot-0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-11 23:59:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "custom_error_handler",
    "github_not_found": true,
    "lcname": "stochasticparrot"
}
        
Elapsed time: 0.13681s