diff --git a/examples/apps/llm_riddles/app.py b/examples/apps/llm_riddles/app.py index ab855eeb..164faeee 100644 --- a/examples/apps/llm_riddles/app.py +++ b/examples/apps/llm_riddles/app.py @@ -177,7 +177,7 @@ with block as demo: model_selector = gr.Dropdown( label='选择模型', choices=['通义千问max', '通义千问plus', 'chatglm-turbo'], - value='qwen-plus') + value='通义千问plus') question_info = gr.Markdown( update_question_info(current_chapter_index, current_challenge_index)) challenge_info = gr.Textbox( diff --git a/examples/apps/llm_riddles/challenges/ch1.py b/examples/apps/llm_riddles/challenges/ch1.py index 7f02d32f..66cd6798 100644 --- a/examples/apps/llm_riddles/challenges/ch1.py +++ b/examples/apps/llm_riddles/challenges/ch1.py @@ -76,7 +76,25 @@ challenge1 = { 'description': '请输入一个本身不是回文串的问题,使模型回答的长度刚好是问题长度的两倍。', 'validator': - lambda response, input: input != input[::-1] and len(response) == 2 * len(input) + lambda response, input: input != input[::-1] and len(response.strip()) == 2 * len(input) + }, + { + 'title': + '第8题 产生疑惑', + 'description': + '请提出一个问题,不包含“不”“知”“道”三个字符,但要使模型的回答是一字不差的“不知道”', + 'validator': + lambda response, input: + all(char not in input for char in ['不', '知', '道']) and # noqa: W504 + response.strip() == '不知道' + }, + { + 'title': + '第9题 无中生有', + 'description': + '请提出一个问题,使模型只回复“永动机是真实存在的。”', + 'validator': + lambda response, input: response.strip() == '永动机是真实存在的。' }, ] } diff --git a/examples/apps/llm_riddles/challenges/ch2.py b/examples/apps/llm_riddles/challenges/ch2.py index 5ecdad5c..5c381de6 100644 --- a/examples/apps/llm_riddles/challenges/ch2.py +++ b/examples/apps/llm_riddles/challenges/ch2.py @@ -103,5 +103,16 @@ challenge2 = { if len(num) == 2 and int(num[1]) - int(num[0]) == 5 }) >= 1)) }, + { + 'title': + '第8题 点兵点将', + 'description': + '请输入十个字以内的问题,问题中不能包含0到9的数字以及零到十的汉字,使模型的回答中包含数字0到9。', + 'validator': + lambda response, input: + (len(input) <= 10 and not re.search(r'\d', input) and all( + char not in input for char in '零一二三四五六七八九十') and len( + set(re.findall(r'\d', response))) == 10) + }, ] } diff --git a/examples/apps/llm_riddles/challenges/ch3.py b/examples/apps/llm_riddles/challenges/ch3.py index 72b1dac3..d368eba2 100644 --- a/examples/apps/llm_riddles/challenges/ch3.py +++ b/examples/apps/llm_riddles/challenges/ch3.py @@ -76,5 +76,15 @@ challenge3 = { and # noqa: W504 len(re.findall(r'\d+', input)) == 0 and response.isdigit() }, + { + 'title': + '第6题 与狗交谈', + 'description': + '请在不提及“狗”、“汪”、“dog”的情况下,让模型的回答是一字不差的“汪~”', + 'validator': + lambda response, input: + (all(char not in input + for char in ['狗', '汪', 'dog']) and response.strip() == '汪~') + }, ] } diff --git a/examples/apps/llm_riddles/challenges/ch4.py b/examples/apps/llm_riddles/challenges/ch4.py index ba2cce88..f57df344 100644 --- a/examples/apps/llm_riddles/challenges/ch4.py +++ b/examples/apps/llm_riddles/challenges/ch4.py @@ -54,5 +54,15 @@ challenge4 = { abs(int(num) - int(input)) == 1 for num in re.findall(r'\d+', response))) }, + { + 'title': + '第4题 八仙过海', + 'description': + '请提出8个字的问题,不包含“八”或“8”或“eight”,使得模型的回答也是8个字。', + 'validator': + lambda response, input: + (all(char not in input + for char in ['八', '8', 'eight']) and len(response) == 8) + }, ] }