-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix #8 add readme * fix #8 add readme * auto calibreapp image * pre-commit * Optimised images with calibre/image-actions * fix --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b5acdac
commit d668a09
Showing
4 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Compress Images | ||
on: | ||
pull_request: | ||
# Run Image Actions when JPG, JPEG, PNG or WebP files are added or changed. | ||
# See https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths for reference. | ||
paths: | ||
- '**.jpg' | ||
- '**.jpeg' | ||
- '**.png' | ||
- '**.webp' | ||
jobs: | ||
build: | ||
# Only run on Pull Requests within the same repository, and not from forks. | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
name: calibreapp/image-actions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Compress Images | ||
uses: calibreapp/image-actions@main | ||
with: | ||
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories. | ||
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,57 @@ | ||
# fuzzy-json | ||
![logo2](https://github.com/livingbio/fuzzy-json/assets/432851/2f7178c0-70d9-4ebd-8ca2-b6a317062944) | ||
![logo1](https://github.com/livingbio/fuzzy-json/assets/432851/af26b437-e183-4a3e-aa98-15a2377a7cc3) | ||
[![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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.