fuzy-jon


Namefuzy-jon JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/livingbio/fuzzy-json
SummaryNone
upload_time2024-07-23 03:22:27
maintainerNone
docs_urlNone
authorlucemia
requires_python<4.0,>=3.10
licenseMIT
keywords openai json llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fuzzy-json
[![CI](https://github.com/livingbio/fuzzy-json/workflows/python-unittest/badge.svg?branch=main)](https://github.com/livingbio/fuzzy-json/actions?query=workflow%3Apython-unittest++branch%3Amain++)
[![Coverage Status](https://coveralls.io/repos/github/livingbio/fuzzy-json/badge.svg?branch=main)](https://coveralls.io/github/livingbio/gpt-fn?branch=main)
[![pypi](https://img.shields.io/pypi/v/fuzy-jon.svg)](https://pypi.python.org/pypi/fuzy-jon)
<!-- [![downloads](https://pepy.tech/badge/fuzy-jon/month)](https://pepy.tech/project/fuzy-jon) -->
[![versions](https://img.shields.io/pypi/pyversions/fuzy-jon.svg)](https://github.com/livingbio/fuzy-jon)
[![license](https://img.shields.io/github/license/livingbio/fuzzy-json.svg)](https://github.com/livingbio/fuzzy-json/blob/main/LICENSE)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)


![logo](./static/276545475-2f7178c0-70d9-4ebd-8ca2-b6a317062944.png)

- Fuzzy-JSON is a compact Python package with no dependencies, designed to address the pesky `JSONDecodeError` that sometimes occurs when utilizing OpenAI's powerful `call function`.
- These errors, although small, can be quite bothersome. I prefer not to rely on retries, replace or resort to using alternative prompts to rectify this issue.
- To tackle this problem, Fuzzy-JSON employs a pushdown automata capable of incorporating JSON syntax and rectifying invalid JSON structures in the correct positions.
- It boasts user-friendliness, making it exceptionally easy to use.
- Fuzzy-JSON serves as a specialized JSON repair tool, particularly tailored for resolving issues in the output of language models like LLMs. If you encounter any cases not covered by the tool, please don't hesitate to create an issue for further assistance.

> The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

https://platform.openai.com/docs/api-reference/chat/object


## Installation

You can install fuzy-jon using pip, the Python package manager:

```bash
pip install fuzy-jon
```

## Getting Started

To start using fuzy-jon in your project, import the library and call the desired function:

```python
from fuzzy_json import loads

...

response = await openai.ChatCompletion.acreate(**kwargs)
args = response.choices[0].message.function_call.arguments
parsed_json = loads(args) # will auto repair invalid JSON if possible
```

## Why fuz[z]y-j[s]on?

- Today marks the 3rd birthday of my beloved daughter, Patty, and I'm eager to make it a memorable day for her.
- I've introduced an open-source project called "Fuzzy JSON," which is inspired by her favorite book, "Fuzzy Ocean." You can find the book here: https://www.amazon.com/-/zh_TW/dp/178700063X
- Patty enjoys identifying and discussing the names of various enchanting ocean creatures depicted in her books.
- The package is named "fuzy-jon" due to a minor glitch from DALL-E-3, which I found endearing and decided to embrace. I believe it aligns perfectly with the package's intended purpose.
- This project is designed to address annoying issues like "JSONDecodeError" that may arise when utilizing OpenAI's function call feature, making the function call feature less troublesome.
- With these adjustments, I hope to bring joy to everyone's day.

![fuzy-jon](./static/393729620_10228059130956650_7731223954878062302_n.jpg)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/livingbio/fuzzy-json",
    "name": "fuzy-jon",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "openai, json, llm",
    "author": "lucemia",
    "author_email": "lucemia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/06/72/7c31962b021bbdff32332b638a687ac1eefce2510ee89d1579de6c1333ae/fuzy_jon-0.1.0.tar.gz",
    "platform": null,
    "description": "# fuzzy-json\n[![CI](https://github.com/livingbio/fuzzy-json/workflows/python-unittest/badge.svg?branch=main)](https://github.com/livingbio/fuzzy-json/actions?query=workflow%3Apython-unittest++branch%3Amain++)\n[![Coverage Status](https://coveralls.io/repos/github/livingbio/fuzzy-json/badge.svg?branch=main)](https://coveralls.io/github/livingbio/gpt-fn?branch=main)\n[![pypi](https://img.shields.io/pypi/v/fuzy-jon.svg)](https://pypi.python.org/pypi/fuzy-jon)\n<!-- [![downloads](https://pepy.tech/badge/fuzy-jon/month)](https://pepy.tech/project/fuzy-jon) -->\n[![versions](https://img.shields.io/pypi/pyversions/fuzy-jon.svg)](https://github.com/livingbio/fuzy-jon)\n[![license](https://img.shields.io/github/license/livingbio/fuzzy-json.svg)](https://github.com/livingbio/fuzzy-json/blob/main/LICENSE)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n\n\n![logo](./static/276545475-2f7178c0-70d9-4ebd-8ca2-b6a317062944.png)\n\n- Fuzzy-JSON is a compact Python package with no dependencies, designed to address the pesky `JSONDecodeError` that sometimes occurs when utilizing OpenAI's powerful `call function`.\n- These errors, although small, can be quite bothersome. I prefer not to rely on retries, replace or resort to using alternative prompts to rectify this issue.\n- To tackle this problem, Fuzzy-JSON employs a pushdown automata capable of incorporating JSON syntax and rectifying invalid JSON structures in the correct positions.\n- It boasts user-friendliness, making it exceptionally easy to use.\n- Fuzzy-JSON serves as a specialized JSON repair tool, particularly tailored for resolving issues in the output of language models like LLMs. If you encounter any cases not covered by the tool, please don't hesitate to create an issue for further assistance.\n\n> The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.\n\nhttps://platform.openai.com/docs/api-reference/chat/object\n\n\n## Installation\n\nYou can install fuzy-jon using pip, the Python package manager:\n\n```bash\npip install fuzy-jon\n```\n\n## Getting Started\n\nTo start using fuzy-jon in your project, import the library and call the desired function:\n\n```python\nfrom fuzzy_json import loads\n\n...\n\nresponse = await openai.ChatCompletion.acreate(**kwargs)\nargs = response.choices[0].message.function_call.arguments\nparsed_json = loads(args) # will auto repair invalid JSON if possible\n```\n\n## Why fuz[z]y-j[s]on?\n\n- Today marks the 3rd birthday of my beloved daughter, Patty, and I'm eager to make it a memorable day for her.\n- I've introduced an open-source project called \"Fuzzy JSON,\" which is inspired by her favorite book, \"Fuzzy Ocean.\" You can find the book here: https://www.amazon.com/-/zh_TW/dp/178700063X\n- Patty enjoys identifying and discussing the names of various enchanting ocean creatures depicted in her books.\n- The package is named \"fuzy-jon\" due to a minor glitch from DALL-E-3, which I found endearing and decided to embrace. I believe it aligns perfectly with the package's intended purpose.\n- This project is designed to address annoying issues like \"JSONDecodeError\" that may arise when utilizing OpenAI's function call feature, making the function call feature less troublesome.\n- With these adjustments, I hope to bring joy to everyone's day.\n\n![fuzy-jon](./static/393729620_10228059130956650_7731223954878062302_n.jpg)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/livingbio/fuzzy-json",
        "Repository": "https://github.com/livingbio/fuzzy-json"
    },
    "split_keywords": [
        "openai",
        " json",
        " llm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "428aaa9c364adf83456f9bcc42f807497f6755f3f9b28e654191e412fe8948e5",
                "md5": "798a4cebe1eca3a6678e0dd62ad51187",
                "sha256": "cf57027932158d9288cd4d40eab8c8bfce8289f01c1457d300e1837d504c297d"
            },
            "downloads": -1,
            "filename": "fuzy_jon-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "798a4cebe1eca3a6678e0dd62ad51187",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 5624,
            "upload_time": "2024-07-23T03:22:25",
            "upload_time_iso_8601": "2024-07-23T03:22:25.978563Z",
            "url": "https://files.pythonhosted.org/packages/42/8a/aa9c364adf83456f9bcc42f807497f6755f3f9b28e654191e412fe8948e5/fuzy_jon-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06727c31962b021bbdff32332b638a687ac1eefce2510ee89d1579de6c1333ae",
                "md5": "453540ad18c2aec231e533be4fed05d2",
                "sha256": "d57f75d4bc067b362eaf83b3f9199672cd0dadc8263470a169c9b374d5d89ff6"
            },
            "downloads": -1,
            "filename": "fuzy_jon-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "453540ad18c2aec231e533be4fed05d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 5182,
            "upload_time": "2024-07-23T03:22:27",
            "upload_time_iso_8601": "2024-07-23T03:22:27.251678Z",
            "url": "https://files.pythonhosted.org/packages/06/72/7c31962b021bbdff32332b638a687ac1eefce2510ee89d1579de6c1333ae/fuzy_jon-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-23 03:22:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "livingbio",
    "github_project": "fuzzy-json",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fuzy-jon"
}
        
Elapsed time: 0.29388s