No project description provided
Project description
fuzzy-json
- Fuzzy-JSON is a compact Python package with no dependencies, designed to address the pesky
JSONDecodeError
that sometimes occurs when utilizing OpenAI's powerfulcall 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.
Project details
Release history Release notifications | RSS feed
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.0.6.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file fuzy_jon-0.0.6.tar.gz
.
File metadata
- Download URL: fuzy_jon-0.0.6.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c439d90130e982917538eceb3094dd6bc6cd9ee9681f798121dbc4a1a173dda9 |
|
MD5 | c2b0fe3d851a5863bfab0905da6a3420 |
|
BLAKE2b-256 | 406793635ebfbde187fcc872eeb9d9cc1bb1211f46cba04476b02abca7fd245a |
File details
Details for the file fuzy_jon-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: fuzy_jon-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb64f3217ab54d88f9f5b6f95f6260bac26118a0a00ea804a6c8173c592da906 |
|
MD5 | afad2cf6224e37054ffa1492c7ea0630 |
|
BLAKE2b-256 | d8e9e94e4170733d00c61907d74d4fa0531bcd5325e1782c4df6c1d1810416c0 |