diff --git a/api/apps/sdk/chat.py b/api/apps/sdk/chat.py index 3e0213aed..435631af8 100644 --- a/api/apps/sdk/chat.py +++ b/api/apps/sdk/chat.py @@ -174,7 +174,9 @@ async def update(tenant_id, chat_id): req["llm_id"] = llm.pop("model_name") if req.get("llm_id") is not None: llm_name, llm_factory = TenantLLMService.split_model_name_and_factory(req["llm_id"]) - if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type="chat"): + model_type = llm.pop("model_type") + model_type = model_type if model_type in ["chat", "image2text"] else "chat" + if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type=model_type): return get_error_data_result(f"`model_name` {req.get('llm_id')} doesn't exist") req["llm_setting"] = req.pop("llm") e, tenant = TenantService.get_by_id(tenant_id) diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index 9ae72c818..b2197fc76 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -2529,6 +2529,19 @@ curl --request POST \ The LLM settings for the chat assistant to create. If it is not explicitly set, a JSON object with the following values will be generated as the default. An `llm` JSON object contains the following attributes: - `"model_name"`, `string` The chat model name. If not set, the user's default chat model will be used. + + :::caution WARNING + `model_type` is an *internal* parameter, serving solely as a temporary workaround for the current model-configuration design limitations. + + Its main purpose is to let *multimodal* models (stored in the database as `"image2text"`) pass backend validation/dispatching. Be mindful that: + + - Do *not* treat it as a stable public API. + - It is subject to change or removal in future releases. + ::: + + - `"model_type"`: `string` + A model type specifier. Only `"chat"` and `"image2text"` are recognized; any other inputs, or when omitted, are treated as `"chat"`. + - `"model_name"`, `string` - `"temperature"`: `float` Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. - `"top_p"`: `float`