mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
API: Don't fallback to default values on model load request
It's best to pass them down the config stack. API/User config.yml -> model config.yml -> model config.json -> fallback. Doing this allows for seamless flow and yielding control to each member in the stack. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -149,7 +149,7 @@ async def unload_embedding_model():
|
||||
embeddings_container = None
|
||||
|
||||
|
||||
def get_config_default(key: str, fallback=None, model_type: str = "model"):
|
||||
def get_config_default(key: str, model_type: str = "model"):
|
||||
"""Fetches a default value from model config if allowed by the user."""
|
||||
|
||||
model_config = config.model_config()
|
||||
@@ -162,14 +162,12 @@ def get_config_default(key: str, fallback=None, model_type: str = "model"):
|
||||
# Is this a draft model load parameter?
|
||||
if model_type == "draft":
|
||||
draft_config = config.draft_model_config()
|
||||
return unwrap(draft_config.get(key), fallback)
|
||||
return draft_config.get(key)
|
||||
elif model_type == "embedding":
|
||||
embeddings_config = config.embeddings_config()
|
||||
return unwrap(embeddings_config.get(key), fallback)
|
||||
return embeddings_config.get(key)
|
||||
else:
|
||||
return unwrap(model_config.get(key), fallback)
|
||||
else:
|
||||
return fallback
|
||||
return model_config.get(key)
|
||||
|
||||
|
||||
async def check_model_container():
|
||||
|
||||
Reference in New Issue
Block a user