fuzy-jon


Namefuzy-jon JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/livingbio/fuzzy-json
Summary
upload_time2024-03-11 14:52:02
maintainer
docs_urlNone
authorlucemia
requires_python>=3.10,<4.0
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": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "openai,json,llm",
    "author": "lucemia",
    "author_email": "lucemia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/78/75/d95858327a8851df88e28469fd9a8ae08f04e3ab1f652e53841aceb1b116/fuzy_jon-0.0.9.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": "",
    "version": "0.0.9",
    "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": "1e07372f8fb5db068285b15275fba894310bc696b1a4db4179da287812bc0b64",
                "md5": "a3894386e4038f9c60516fc3bb719826",
                "sha256": "e47cf889e13260acd4ffcaaafb8789e9182ca7d15ff9bf1178feea63ada63f67"
            },
            "downloads": -1,
            "filename": "fuzy_jon-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a3894386e4038f9c60516fc3bb719826",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 5530,
            "upload_time": "2024-03-11T14:52:00",
            "upload_time_iso_8601": "2024-03-11T14:52:00.303483Z",
            "url": "https://files.pythonhosted.org/packages/1e/07/372f8fb5db068285b15275fba894310bc696b1a4db4179da287812bc0b64/fuzy_jon-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7875d95858327a8851df88e28469fd9a8ae08f04e3ab1f652e53841aceb1b116",
                "md5": "e1c075e0fa96a08581a508d398eb5136",
                "sha256": "d7eb4fce959d3d9f51e1d9db617f25127e8a6770cd5f94fe011044538c54c5d5"
            },
            "downloads": -1,
            "filename": "fuzy_jon-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "e1c075e0fa96a08581a508d398eb5136",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 5069,
            "upload_time": "2024-03-11T14:52:02",
            "upload_time_iso_8601": "2024-03-11T14:52:02.054597Z",
            "url": "https://files.pythonhosted.org/packages/78/75/d95858327a8851df88e28469fd9a8ae08f04e3ab1f652e53841aceb1b116/fuzy_jon-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-11 14:52:02",
    "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.20288s