Skip to main content

No project description provided

Project description

fuzzy-json

CI Coverage Status pypi

versions license Checked with mypy Code style: black Imports: isort

logo

  • 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:

pip install fuzy-jon

Getting Started

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fuzy_jon-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

fuzy_jon-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file fuzy_jon-0.1.0.tar.gz.

File metadata

  • Download URL: fuzy_jon-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fuzy_jon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d57f75d4bc067b362eaf83b3f9199672cd0dadc8263470a169c9b374d5d89ff6
MD5 453540ad18c2aec231e533be4fed05d2
BLAKE2b-256 06727c31962b021bbdff32332b638a687ac1eefce2510ee89d1579de6c1333ae

See more details on using hashes here.

File details

Details for the file fuzy_jon-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fuzy_jon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fuzy_jon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf57027932158d9288cd4d40eab8c8bfce8289f01c1457d300e1837d504c297d
MD5 798a4cebe1eca3a6678e0dd62ad51187
BLAKE2b-256 428aaa9c364adf83456f9bcc42f807497f6755f3f9b28e654191e412fe8948e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page