jan
jan copied to clipboard
bug: API - Error when listing models using "openai" python package
trafficstars
Describe the bug incompatibility between Jan’s /v1/models endpoint and OpenAI’s.
Steps to reproduce
- When running this code in python:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:1337/v1",
api_key="Not used"
)
print(client.models.list())
Expected behavior
{
"object": "list",
"data": [
{
"type": "model",
"version": "1",
"id": "zephyr-7b",
"name": "Zephyr 7B",
"owned_by": "",
"created": 0,
"description": "string",
"state": null,
"format": "ggufv3",
"source": [
{
"url": "https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf",
"filename": "zephyr-7b-beta.Q4_K_M.gguf"
}
],
"settings": {
"ctx_len": "4096",
"ngl": "100",
"embedding": "true",
"n_parallel": "4"
},
"parameters": {
"temperature": "0.7",
"token_limit": "4096",
"top_k": "0",
"top_p": "1",
"stream": "true"
},
"metadata": {},
"assets": [
"string"
]
}
]
}
Additional context Currently, we are returning this:
[
{
"source": [
{
"filename": "ggml-model-q5_k.gguf",
"url": "https://huggingface.co/mys/ggml_bakllava-1/resolve/main/ggml-model-q5_k.gguf"
},
{
"filename": "mmproj-model-f16.gguf",
"url": "https://huggingface.co/mys/ggml_bakllava-1/resolve/main/mmproj-model-f16.gguf"
}
],
"id": "bakllava-1",
"object": "model",
"name": "BakLlava 1",
"version": "1.0",
"description": "BakLlava 1 can bring vision understanding to Jan",
"format": "gguf",
"settings": {
"ctx_len": 4096,
"prompt_template": "\n### Instruction:\n{prompt}\n### Response:\n",
"llama_model_path": "ggml-model-q5_k.gguf",
"mmproj": "mmproj-model-f16.gguf"
},
"parameters": {
"max_tokens": 4096
},
"metadata": {
"author": "Mys",
"tags": [
"Vision"
],
"size": 6200000000
},
"engine": "nitro"
},
Same problem with the /v1/threads/{thread_id}/messages for listing messages in a thread.
Tested and looking good on Jan v0.4.6-279 ✅