Skip to content

Commit 3eb12b7

Browse files
author
Paweł Kędzia
committed
Merge branch 'features/fix_ollama'
2 parents 08883d3 + ed69a63 commit 3eb12b7

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

llm_router_api/endpoints/builtin/lmstudio.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ def prepare_payload(
7272
A response containing the object type ``"list"`` and a ``data``
7373
field with the available model tags.
7474
"""
75-
# models = self.__proper_models_list_format()
76-
models = self.__proper_models_list_format()
77-
# import json
78-
# print(json.dumps(models, indent=2, ensure_ascii=False))
79-
return {"models": models}
75+
return self.__proper_models_list_format()
8076

8177
def __proper_models_list_format(self):
8278
_models_data = self._api_type_dispatcher.tags(
@@ -86,17 +82,17 @@ def __proper_models_list_format(self):
8682
proper_models = []
8783
for m in _models_data:
8884
_model = {
85+
"id": m["id"],
86+
"object": "model",
8987
"type": "llm",
90-
"modelKey": m["id"],
91-
"format": "gguf",
92-
"displayName": m["id"],
93-
"path": m["id"],
94-
"sizeBytes": 4683073952,
95-
"paramsString": "7B",
96-
"architecture": "qwen2",
97-
"vision": False,
98-
"trainedForToolUse": True,
99-
"maxContextLength": 32768,
88+
"publisher": m["publisher"],
89+
"arch": m["arch"],
90+
"compatibility_type": "gguf",
91+
"quantization": "Q8_0",
92+
"state": "loaded",
93+
"max_context_length": m["max_context_length"],
10094
}
10195
proper_models.append(_model)
102-
return proper_models
96+
97+
_response = {"data": proper_models, "object": "list"}
98+
return _response

llm_router_api/endpoints/endpoint_i.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,9 @@ def _clear_payload(payload: Dict[str, Any]):
11211121
Dict[str, Any]
11221122
The payload with internal keys removed.
11231123
"""
1124+
if type(payload) is str:
1125+
return payload
1126+
11241127
for k in CLEAR_PREDEFINED_PARAMS:
11251128
payload.pop(k, None)
11261129
# If stream param is not given, then set as False

0 commit comments

Comments
 (0)