summaryrefslogtreecommitdiffstats
path: root/g4f/providers
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/providers')
-rw-r--r--g4f/providers/base_provider.py4
-rw-r--r--g4f/providers/response.py13
2 files changed, 15 insertions, 2 deletions
diff --git a/g4f/providers/base_provider.py b/g4f/providers/base_provider.py
index b6df48e8..c6d0d950 100644
--- a/g4f/providers/base_provider.py
+++ b/g4f/providers/base_provider.py
@@ -11,7 +11,7 @@ from typing import Callable, Union
from ..typing import CreateResult, AsyncResult, Messages
from .types import BaseProvider
-from .response import FinishReason, BaseConversation
+from .response import FinishReason, BaseConversation, SynthesizeData
from ..errors import NestAsyncioError, ModelNotSupportedError
from .. import debug
@@ -259,7 +259,7 @@ class AsyncGeneratorProvider(AsyncProvider):
"""
return "".join([
str(chunk) async for chunk in cls.create_async_generator(model, messages, stream=False, **kwargs)
- if not isinstance(chunk, (Exception, FinishReason, BaseConversation))
+ if not isinstance(chunk, (Exception, FinishReason, BaseConversation, SynthesizeData))
])
@staticmethod
diff --git a/g4f/providers/response.py b/g4f/providers/response.py
index a4d1467a..3fddbf4f 100644
--- a/g4f/providers/response.py
+++ b/g4f/providers/response.py
@@ -23,4 +23,17 @@ class Sources(ResponseType):
class BaseConversation(ResponseType):
def __str__(self) -> str:
+ return ""
+
+class SynthesizeData(ResponseType):
+ def __init__(self, provider: str, data: dict):
+ self.provider = provider
+ self.data = data
+
+ def to_json(self) -> dict:
+ return {
+ **self.__dict__
+ }
+
+ def __str__(self) -> str:
return "" \ No newline at end of file