summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-06 20:24:39 +0200
committerGitHub <noreply@github.com>2024-04-06 20:24:39 +0200
commit8335359c96d16aa87ab31bb359f1d0e5798bb448 (patch)
treea5fa018e75ec09d9268994a094ad85991a721746
parentUpdate client (diff)
downloadgpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.tar
gpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.tar.gz
gpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.tar.bz2
gpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.tar.lz
gpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.tar.xz
gpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.tar.zst
gpt4free-8335359c96d16aa87ab31bb359f1d0e5798bb448.zip
-rw-r--r--g4f/client/async.py16
1 files changed, 1 insertions, 15 deletions
diff --git a/g4f/client/async.py b/g4f/client/async.py
index 7c421ee7..6b23a9d5 100644
--- a/g4f/client/async.py
+++ b/g4f/client/async.py
@@ -16,21 +16,7 @@ from . import get_model_and_provider, get_last_provider
from .Provider.BingCreateImages import BingCreateImages
from .Provider.needs_auth import Gemini, OpenaiChat
from .Provider.You import You
-
-def read_json(text: str) -> dict:
- """
- Parses JSON code block from a string.
-
- Args:
- text (str): A string containing a JSON code block.
-
- Returns:
- dict: A dictionary parsed from the JSON code block.
- """
- match = re.search(r"```(json|)\n(?P<code>[\S\s]+?)\n```", text)
- if match:
- return match.group("code")
- return text
+from .helper import read_json
def iter_response(
response: iter[str],