From ecad7a4ac8e0493efbb09be26e73b0d747d49e0f Mon Sep 17 00:00:00 2001 From: razrab Date: Sun, 22 Oct 2023 12:45:18 +0300 Subject: Added code to ignore certain providers in the API --- g4f_api/ApiInterface.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 g4f_api/ApiInterface.py (limited to 'g4f_api/ApiInterface.py') diff --git a/g4f_api/ApiInterface.py b/g4f_api/ApiInterface.py new file mode 100644 index 00000000..f6572912 --- /dev/null +++ b/g4f_api/ApiInterface.py @@ -0,0 +1,12 @@ +import g4f +from g4f.api import Api + +create_chat_completion_original = g4f.ChatCompletion.create +list_ignored_providers=[] + +def create_chat_completion(*args, **kwargs): + kwargs['ignored']=list_ignored_providers + return create_chat_completion_original(*args, **kwargs) + +g4f.ChatCompletion.create=create_chat_completion +api=Api(g4f, debug=False) -- cgit v1.2.3