diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index 06e86bb86..4a8b556d7 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -737,6 +737,7 @@ def related_questions(tenant_id): if not req.get("question"): return get_error_data_result("`question` is required.") question = req["question"] + industry = req.get("industry", "") chat_mdl = LLMBundle(tenant_id, LLMType.CHAT) prompt = """ Objective: To generate search terms related to the user's search keywords, helping users find more valuable information. @@ -746,7 +747,10 @@ Instructions: - Use common, general terms as much as possible, avoiding obscure words or technical jargon. - Keep the term length between 2-4 words, concise and clear. - DO NOT translate, use the language of the original keywords. - +""" + if industry: + prompt += f" - Ensure all search terms are relevant to the industry: {industry}.\n" + prompt += """ ### Example: Keywords: Chinese football Related search terms: diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index 4b642c849..83cb70ee7 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -3371,6 +3371,7 @@ The chat model autonomously determines the number of questions to generate based - `'Authorization: Bearer '` - Body: - `"question"`: `string` + - `"industry"`: `string` ##### Request example @@ -3381,7 +3382,8 @@ curl --request POST \ --header 'Authorization: Bearer ' \ --data ' { - "question": "What are the key advantages of Neovim over Vim?" + "question": "What are the key advantages of Neovim over Vim?", + "industry": "software_development" }' ``` @@ -3389,6 +3391,8 @@ curl --request POST \ - `"question"`: (*Body Parameter*), `string` The original user question. +- `"industry"`: (*Body Parameter*), `string` + Industry of the question. #### Response