mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-18 08:02:09 +03:00
882910c1d5
g4f.Provider.FastGpt & g4f.Provider.Equing gpt-3.5-turbo-0613
33 lines
795 B
Python
33 lines
795 B
Python
from abc import ABC, abstractmethod
|
|
|
|
from ..typing import Any, CreateResult
|
|
|
|
|
|
class BaseProvider(ABC):
|
|
url: str
|
|
working = False
|
|
needs_auth = False
|
|
supports_stream = False
|
|
supports_gpt_35_turbo = False
|
|
supports_gpt_4 = False
|
|
|
|
@staticmethod
|
|
@abstractmethod
|
|
def create_completion(
|
|
model: str,
|
|
messages: list[dict[str, str]],
|
|
stream: bool,
|
|
**kwargs: Any,
|
|
) -> CreateResult:
|
|
raise NotImplementedError()
|
|
|
|
@classmethod
|
|
@property
|
|
def params(cls):
|
|
params = [
|
|
("model", "str"),
|
|
("messages", "list[dict[str, str]]"),
|
|
("stream", "bool"),
|
|
]
|
|
param = ", ".join([": ".join(p) for p in params])
|
|
return f"g4f.provider.{cls.__name__} supports: ({param})" |