summaryrefslogtreecommitdiffstats
path: root/g4f/providers/response.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/providers/response.py')
-rw-r--r--g4f/providers/response.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/g4f/providers/response.py b/g4f/providers/response.py
new file mode 100644
index 00000000..a4d1467a
--- /dev/null
+++ b/g4f/providers/response.py
@@ -0,0 +1,26 @@
+from __future__ import annotations
+
+from abc import abstractmethod
+
+class ResponseType:
+ @abstractmethod
+ def __str__(self) -> str:
+ pass
+
+class FinishReason():
+ def __init__(self, reason: str):
+ self.reason = reason
+
+ def __str__(self) -> str:
+ return ""
+
+class Sources(ResponseType):
+ def __init__(self, sources: list[dict[str, str]]) -> None:
+ self.list = sources
+
+ def __str__(self) -> str:
+ return "\n\n" + ("\n".join([f"{idx+1}. [{link['title']}]({link['url']})" for idx, link in enumerate(self.list)]))
+
+class BaseConversation(ResponseType):
+ def __str__(self) -> str:
+ return "" \ No newline at end of file