summaryrefslogtreecommitdiffstats
path: root/g4f/stubs.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-14 09:22:32 +0100
committerGitHub <noreply@github.com>2024-02-14 09:22:32 +0100
commit51686409f86e187d9c13cbea9388f31f567a118c (patch)
treec4291ff5375b77d70622cfa25490f5a02a5ee970 /g4f/stubs.py
parentUpdate client.md (diff)
parentAdd unitests for the client (diff)
downloadgpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar
gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.gz
gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.bz2
gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.lz
gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.xz
gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.zst
gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.zip
Diffstat (limited to 'g4f/stubs.py')
-rw-r--r--g4f/stubs.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/g4f/stubs.py b/g4f/stubs.py
new file mode 100644
index 00000000..1cbbb134
--- /dev/null
+++ b/g4f/stubs.py
@@ -0,0 +1,44 @@
+
+from __future__ import annotations
+
+class Model():
+ def __getitem__(self, item):
+ return getattr(self, item)
+
+class ChatCompletion(Model):
+ def __init__(self, content: str, finish_reason: str):
+ self.choices = [ChatCompletionChoice(ChatCompletionMessage(content, finish_reason))]
+
+class ChatCompletionChunk(Model):
+ def __init__(self, content: str, finish_reason: str):
+ self.choices = [ChatCompletionDeltaChoice(ChatCompletionDelta(content, finish_reason))]
+
+class ChatCompletionMessage(Model):
+ def __init__(self, content: str, finish_reason: str):
+ self.content = content
+ self.finish_reason = finish_reason
+
+class ChatCompletionChoice(Model):
+ def __init__(self, message: ChatCompletionMessage):
+ self.message = message
+
+class ChatCompletionDelta(Model):
+ def __init__(self, content: str, finish_reason: str):
+ self.content = content
+ self.finish_reason = finish_reason
+
+class ChatCompletionDeltaChoice(Model):
+ def __init__(self, delta: ChatCompletionDelta):
+ self.delta = delta
+
+class Image(Model):
+ url: str
+
+ def __init__(self, url: str) -> None:
+ self.url = url
+
+class ImagesResponse(Model):
+ data: list[Image]
+
+ def __init__(self, data: list) -> None:
+ self.data = data \ No newline at end of file