summaryrefslogtreecommitdiffstats
path: root/g4f/stubs.py
blob: 1cbbb13416acbbfd9c00a0af2563b13c8ffd7019 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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