feat: add ctx-size for llama-swap models to dashboard
This commit is contained in:
parent
aa8baebac5
commit
cef71df3df
2 changed files with 86 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ import pytest
|
|||
import router
|
||||
import backends.control as control
|
||||
import api.openai as openai_api
|
||||
import api.ollama as ollama_api
|
||||
|
||||
SWAP_EP = "http://swap:8080/v1"
|
||||
SERVER_EP = "http://server:8080/v1"
|
||||
|
|
@ -107,3 +108,24 @@ class TestUpstreamResolution:
|
|||
with patch.object(openai_api, "get_config", lambda: cfg):
|
||||
ep = await openai_api._resolve_llama_swap_endpoint("any")
|
||||
assert ep is None
|
||||
|
||||
|
||||
class TestCtxSizeFromCmd:
|
||||
"""ctx-size parsing from a /running worker's launch `cmd` string."""
|
||||
|
||||
def test_parses_long_flag(self):
|
||||
cmd = ("llama-server --port 5818\n -hf unsloth/gpt-oss-20b-GGUF:F16\n"
|
||||
" --ctx-size 131072\n --temp 1.0\n")
|
||||
assert ollama_api._ctx_size_from_cmd(cmd) == 131072
|
||||
|
||||
def test_parses_short_flag(self):
|
||||
assert ollama_api._ctx_size_from_cmd("llama-server -c 8192 --port 1") == 8192
|
||||
|
||||
def test_parses_equals_form(self):
|
||||
assert ollama_api._ctx_size_from_cmd("llama-server --ctx-size=4096") == 4096
|
||||
|
||||
def test_returns_none_when_absent(self):
|
||||
assert ollama_api._ctx_size_from_cmd("llama-server --port 5818") is None
|
||||
|
||||
def test_returns_none_for_empty(self):
|
||||
assert ollama_api._ctx_size_from_cmd("") is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue