Spaces:
Running
Running
GitHub Action
commited on
Commit
·
cda4322
1
Parent(s):
875b439
Sync ling-space changes from GitHub commit b26afb3
Browse files- i18n/recommended_inputs.py +25 -79
- recommand_config.py +29 -46
i18n/recommended_inputs.py
CHANGED
|
@@ -1,87 +1,33 @@
|
|
| 1 |
# ling-space/i18n/recommended_inputs.py
|
| 2 |
|
| 3 |
ui_translations = {
|
| 4 |
-
#
|
| 5 |
-
"
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
},
|
| 9 |
-
"rec_creative_writing_system_prompt": {
|
| 10 |
-
"en": "You are a talented writer, skilled in crafting imaginative stories.",
|
| 11 |
-
"zh": "你是一位才华横溢的作家,擅长创作富有想象力的故事。"
|
| 12 |
-
},
|
| 13 |
-
"rec_creative_writing_user_message": {
|
| 14 |
-
"en": "Write a short story about a talking cat and its robot friend.",
|
| 15 |
-
"zh": "写一个关于一只会说话的猫和它的机器人朋友的短篇故事。"
|
| 16 |
-
},
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
"
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
},
|
| 23 |
-
"rec_code_generation_system_prompt": {
|
| 24 |
-
"en": "You are an AI programming assistant proficient in multiple programming languages.",
|
| 25 |
-
"zh": "你是一个精通多种编程语言的 AI 编程助手。"
|
| 26 |
-
},
|
| 27 |
-
"rec_code_generation_user_message": {
|
| 28 |
-
"en": "Write a Python function to calculate the Fibonacci sequence in a list.",
|
| 29 |
-
"zh": "用 Python 写一个函数,计算一个列表中的斐波那契数列。"
|
| 30 |
-
},
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
"
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
},
|
| 41 |
-
"rec_email_drafting_user_message": {
|
| 42 |
-
"en": "Help me write an email to my team members announcing a project kick-off meeting next Friday afternoon.",
|
| 43 |
-
"zh": "帮我写一封邮件,向我的团队成员宣布我们下周五下午将举行一个项目启动会议。"
|
| 44 |
-
},
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
"
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
},
|
| 51 |
-
"rec_study_plan_system_prompt": {
|
| 52 |
-
"en": "You are an experienced learning mentor who can tailor study plans for users.",
|
| 53 |
-
"zh": "你是一位经验丰富的学习导师,能够为用户量身定制学习计划。"
|
| 54 |
-
},
|
| 55 |
-
"rec_study_plan_user_message": {
|
| 56 |
-
"en": "I want to learn to play the guitar. Please create a one-month beginner's introductory plan for me.",
|
| 57 |
-
"zh": "我想学习弹吉他,请为我制定一个为期一个月的初学者入门计划。"
|
| 58 |
-
},
|
| 59 |
|
| 60 |
-
#
|
| 61 |
-
"
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
},
|
| 65 |
-
"rec_role_play_system_prompt": {
|
| 66 |
-
"en": "You are Shakespeare. Please answer questions in his style and language.",
|
| 67 |
-
"zh": "你现在是莎士比亚,请用他的风格和语言来回答问题。"
|
| 68 |
-
},
|
| 69 |
-
"rec_role_play_user_message": {
|
| 70 |
-
"en": "To be or not to be, that is the question.",
|
| 71 |
-
"zh": "生存还是毁灭,这是一个值得考虑的问题。"
|
| 72 |
-
},
|
| 73 |
-
|
| 74 |
-
# Tech Q&A
|
| 75 |
-
"rec_tech_qa_task": {
|
| 76 |
-
"en": "Tech Q&A",
|
| 77 |
-
"zh": "技术问答"
|
| 78 |
-
},
|
| 79 |
-
"rec_tech_qa_system_prompt": {
|
| 80 |
-
"en": "You are a senior software engineer, proficient in various tech stacks.",
|
| 81 |
-
"zh": "你是一位资深的软件工程师,精通各种技术栈。"
|
| 82 |
-
},
|
| 83 |
-
"rec_tech_qa_user_message": {
|
| 84 |
-
"en": "Please explain 'containerization' and how it differs from 'virtualization'?",
|
| 85 |
-
"zh": "请解释一下什么是“容器化”,以及它与“虚拟化”有什么区别?"
|
| 86 |
-
}
|
| 87 |
}
|
|
|
|
| 1 |
# ling-space/i18n/recommended_inputs.py
|
| 2 |
|
| 3 |
ui_translations = {
|
| 4 |
+
# 1. Ring-1T: Complex Reasoning
|
| 5 |
+
"rec_complex_reasoning_task": { "en": "Complex Reasoning", "zh": "复杂推理" },
|
| 6 |
+
"rec_complex_reasoning_system_prompt": { "en": "You are a logical reasoning expert. Analyze the user's complex query, break it down into smaller parts, and provide a step-by-step, evidence-based conclusion.", "zh": "你是一位逻辑推理专家。请分析用户提出的复杂问题,将其分解为更小的部分,并提供一个循序渐进、有理有据的结论。" },
|
| 7 |
+
"rec_complex_reasoning_user_message": { "en": "Analyze the pros and cons of transitioning a mid-sized e-commerce company's infrastructure from on-premise servers to a fully cloud-based solution. Consider cost, security, scalability, and employee training.", "zh": "请分析一家中型电商公司将其基础设施从本地服务器迁移到完全基于云的解决方案的利弊。需要考虑成本、安全性、可伸缩性和员工培训等方面。" },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
# 2. Ling-1T: Long-form Creative
|
| 10 |
+
"rec_long_form_creative_task": { "en": "Story Generation", "zh": "故事生成" },
|
| 11 |
+
"rec_long_form_creative_system_prompt": { "en": "You are a world-class novelist. Write a rich, detailed, and engaging story based on the user's prompt.", "zh": "你是一位世界级的小说家。请根据用户的提示,创作一个内容丰富、细节详实、引人入胜的故事。" },
|
| 12 |
+
"rec_long_form_creative_user_message": { "en": "Write the opening chapter of a science fiction novel where humanity discovers an ancient, silent artifact in the Kuiper Belt.", "zh": "写一部科幻小说的开篇章节,描述人类在柯伊伯带发现了一个古老而沉寂的人造物。" },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# 3. Ring-Flash: Technical Analysis
|
| 15 |
+
"rec_technical_analysis_task": { "en": "Code Review", "zh": "代码审查" },
|
| 16 |
+
"rec_technical_analysis_system_prompt": { "en": "You are a senior software engineer. Review the provided code snippet for potential bugs, style issues, and performance bottlenecks. Provide a concise summary of your findings.", "zh": "你是一位资深软件工程师。请审查所提供的代码片段,找出潜在的错误、风格问题和性能瓶颈,并提供一份简洁的审查报告。" },
|
| 17 |
+
"rec_technical_analysis_user_message": { "en": "Review this Python function: \n```python\ndef get_user_data(user_id):\n # Assume db is a global database connection\n data = db.query(f\"SELECT * FROM users WHERE id = {user_id}\")\n return data\n```", "zh": "审查以下 Python 函数:\n```python\ndef get_user_data(user_id):\n # 假设 db 是一个全局数据库连接\n data = db.query(f\"SELECT * FROM users WHERE id = {user_id}\")\n return data\n```" },
|
| 18 |
+
|
| 19 |
+
# 4. Ling-Flash: Short-form Creative
|
| 20 |
+
"rec_short_form_creative_task": { "en": "Ad Copy Generation", "zh": "广告文案生成" },
|
| 21 |
+
"rec_short_form_creative_system_prompt": { "en": "You are a creative marketing copywriter. Generate three catchy and persuasive ad headlines for the user's product.", "zh": "你是一位富有创意的营销文案撰写人。请为用户的产品生成三个引人注目且有说服力的广告标题。" },
|
| 22 |
+
"rec_short_form_creative_user_message": { "en": "The product is a new brand of sparkling water made with natural fruit flavors and zero sugar.", "zh": "我们的产品是一款全新的气泡水,采用天然水果风味,零糖。" },
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# 5. Ring-Mini: Quick Q&A
|
| 25 |
+
"rec_quick_qa_task": { "en": "Factual Question", "zh": "事实问答" },
|
| 26 |
+
"rec_quick_qa_system_prompt": { "en": "You are a helpful AI assistant. Provide a direct and accurate answer to the user's question.", "zh": "你是一个乐于助人的人工智能助手。请直接并准确地回答用户的问题。" },
|
| 27 |
+
"rec_quick_qa_user_message": { "en": "What is the capital of Australia?", "zh": "澳大利亚的首都是哪里?" },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
# 6. Ling-Mini: Simple Email
|
| 30 |
+
"rec_simple_email_task": { "en": "Quick Email Reply", "zh": "快速邮件回复" },
|
| 31 |
+
"rec_simple_email_system_prompt": { "en": "You are a helpful assistant. Draft a short, polite email reply based on the user's instructions.", "zh": "你是一位乐于助人的助手。请根据用户的指示,起草一封简短、礼貌的电子邮件回复。" },
|
| 32 |
+
"rec_simple_email_user_message": { "en": "Draft a reply to an email confirming I will attend the meeting on Tuesday at 10 AM.", "zh": "请草拟一封邮件回复,确认我将参加周二上午10点的会议。" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
}
|
recommand_config.py
CHANGED
|
@@ -3,51 +3,34 @@ from i18n import get_text
|
|
| 3 |
|
| 4 |
def get_recommended_inputs(lang: str):
|
| 5 |
"""
|
| 6 |
-
Generates the list of recommended inputs based on the selected language
|
|
|
|
| 7 |
"""
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
},
|
| 24 |
-
{
|
| 25 |
-
"task": get_text("rec_email_drafting_task", lang),
|
| 26 |
-
"model": get_model_display_name(LING_FLASH_2_0),
|
| 27 |
-
"system_prompt": get_text("rec_email_drafting_system_prompt", lang),
|
| 28 |
-
"user_message": get_text("rec_email_drafting_user_message", lang),
|
| 29 |
-
"temperature": 0.7,
|
| 30 |
-
},
|
| 31 |
-
{
|
| 32 |
-
"task": get_text("rec_study_plan_task", lang),
|
| 33 |
-
"model": get_model_display_name(LING_MINI_2_0),
|
| 34 |
-
"system_prompt": get_text("rec_study_plan_system_prompt", lang),
|
| 35 |
-
"user_message": get_text("rec_study_plan_user_message", lang),
|
| 36 |
-
"temperature": 0.6,
|
| 37 |
-
},
|
| 38 |
-
{
|
| 39 |
-
"task": get_text("rec_role_play_task", lang),
|
| 40 |
-
"model": get_model_display_name(RING_FLASH_2_0),
|
| 41 |
-
"system_prompt": get_text("rec_role_play_system_prompt", lang),
|
| 42 |
-
"user_message": get_text("rec_role_play_user_message", lang),
|
| 43 |
-
"temperature": 0.9,
|
| 44 |
-
},
|
| 45 |
-
{
|
| 46 |
-
"task": get_text("rec_tech_qa_task", lang),
|
| 47 |
-
"model": get_model_display_name(RING_MINI_2_0),
|
| 48 |
-
"system_prompt": get_text("rec_tech_qa_system_prompt", lang),
|
| 49 |
-
"user_message": get_text("rec_tech_qa_user_message", lang),
|
| 50 |
-
"temperature": 0.4,
|
| 51 |
-
}
|
| 52 |
]
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
def get_recommended_inputs(lang: str):
|
| 5 |
"""
|
| 6 |
+
Generates the list of recommended inputs based on the selected language,
|
| 7 |
+
ordered by model complexity.
|
| 8 |
"""
|
| 9 |
+
|
| 10 |
+
# Structure: (key_prefix, model, temperature)
|
| 11 |
+
recommendation_setup = [
|
| 12 |
+
# Complex "Thinking" Model
|
| 13 |
+
("complex_reasoning", RING_1T, 0.3),
|
| 14 |
+
# Complex "Creative" Model
|
| 15 |
+
("long_form_creative", LING_1T, 0.6), # Lower temp for Ling
|
| 16 |
+
# Mid-tier "Thinking" Model
|
| 17 |
+
("technical_analysis", RING_FLASH_2_0, 0.5),
|
| 18 |
+
# Mid-tier "Creative" Model
|
| 19 |
+
("short_form_creative", LING_FLASH_2_0, 0.7), # Lower temp for Ling
|
| 20 |
+
# Quick "Thinking" Model
|
| 21 |
+
("quick_qa", RING_MINI_2_0, 0.4),
|
| 22 |
+
# Quick "Creative" Model
|
| 23 |
+
("simple_email", LING_MINI_2_0, 0.6), # Lower temp for Ling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
]
|
| 25 |
+
|
| 26 |
+
result = []
|
| 27 |
+
for key_prefix, model, temp in recommendation_setup:
|
| 28 |
+
result.append({
|
| 29 |
+
"task": get_text(f"rec_{key_prefix}_task", lang),
|
| 30 |
+
"model": get_model_display_name(model),
|
| 31 |
+
"system_prompt": get_text(f"rec_{key_prefix}_system_prompt", lang),
|
| 32 |
+
"user_message": get_text(f"rec_{key_prefix}_user_message", lang),
|
| 33 |
+
"temperature": temp,
|
| 34 |
+
})
|
| 35 |
+
|
| 36 |
+
return result
|