diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-11-20 19:58:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 19:58:16 +0100 |
commit | ffb4b0d162cc29b1caa4539d854de37206804225 (patch) | |
tree | ea565c46ed908d2a6b4ef3fef1f100e68428aec3 /g4f/providers/response.py | |
parent | Update api.py (diff) | |
download | gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.gz gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.bz2 gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.lz gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.xz gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.zst gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/providers/response.py | 26 |
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 |