Merge pull request #14017 from athoik/title_tags

feat: read max_tokens from model config with fallback to 1000 for title and tag generation
This commit is contained in:
Tim Jaeryang Baek
2025-05-19 00:43:05 +04:00
committed by GitHub

View File

@@ -192,15 +192,19 @@ async def generate_title(
},
)
max_tokens = (
models[task_model_id].get("info", {}).get("params", {}).get("max_tokens", 1000)
)
payload = {
"model": task_model_id,
"messages": [{"role": "user", "content": content}],
"stream": False,
**(
{"max_tokens": 1000}
{"max_tokens": max_tokens}
if models[task_model_id].get("owned_by") == "ollama"
else {
"max_completion_tokens": 1000,
"max_completion_tokens": max_tokens,
}
),
"metadata": {