summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
Diffstat (limited to 'g4f')
-rw-r--r--g4f/api/__init__.py5
-rw-r--r--g4f/client/stubs.py2
-rw-r--r--g4f/typing.py2
3 files changed, 7 insertions, 2 deletions
diff --git a/g4f/api/__init__.py b/g4f/api/__init__.py
index 9772f8d7..7296a542 100644
--- a/g4f/api/__init__.py
+++ b/g4f/api/__init__.py
@@ -120,7 +120,10 @@ class Api:
'created': 0,
'owned_by': model.base_provider
} for model_id, model in model_list.items()]
- return JSONResponse(model_list)
+ return JSONResponse({
+ "object": "list",
+ "data": model_list,
+ })
@self.app.get("/v1/models/{model_name}")
async def model_info(model_name: str):
diff --git a/g4f/client/stubs.py b/g4f/client/stubs.py
index 2441e287..ceb51b83 100644
--- a/g4f/client/stubs.py
+++ b/g4f/client/stubs.py
@@ -78,12 +78,14 @@ class ChatCompletionDelta(Model):
def __init__(self, content: Union[str, None]):
if content is not None:
self.content = content
+ self.role = "assistant"
def to_json(self):
return self.__dict__
class ChatCompletionDeltaChoice(Model):
def __init__(self, delta: ChatCompletionDelta, finish_reason: Union[str, None]):
+ self.index = 0
self.delta = delta
self.finish_reason = finish_reason
diff --git a/g4f/typing.py b/g4f/typing.py
index 5d1bc959..710fde4b 100644
--- a/g4f/typing.py
+++ b/g4f/typing.py
@@ -14,7 +14,7 @@ else:
SHA256 = NewType('sha_256_hash', str)
CreateResult = Iterator[str]
AsyncResult = AsyncIterator[str]
-Messages = List[Dict[str, str]]
+Messages = List[Dict[str, Union[str,List[Dict[str,Union[str,Dict[str,str]]]]]]]
Cookies = Dict[str, str]
ImageType = Union[str, bytes, IO, Image, None]