Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/minicpm4/MCP/eval_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def evaluate_function_calls(test_data: list, eval_data: list) :
pred_data = test_data[i]

gt_data = eval_data[i]
except:
except Exception:
breakpoint()

if not validate_prediction(pred_data):
Expand Down
2 changes: 1 addition & 1 deletion demo/minicpm4/MCP/generate_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def parse_tool_for_minicpm3(
return tool_calls
else:
return []
except:
except Exception:
return []

def generate(
Expand Down
32 changes: 16 additions & 16 deletions demo/minicpm4/SurveyGeneration/src/generation/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ def convert_survey_dict_to_str(current_survey):
try:
content = SurveyManager._to_one_line(current_survey["title"])
string += f"# {content}\n"
except:
except Exception:
string += f"# Title: None\n"

# abstract
try:
content = SurveyManager._to_one_line(current_survey["abstract"])
string += f"## Abstract\n{content}\n"
except:
except Exception:
string += f"## Abstract\nNone\n"

# introduction
try:
content = SurveyManager._to_one_line(current_survey["introduction"])
string += f"## Introduction\n{content}\n"
except:
except Exception:
string += f"## Introduction\nNone\n"

# sections
Expand Down Expand Up @@ -122,7 +122,7 @@ def convert_survey_dict_to_str(current_survey):
try:
content = SurveyManager._to_one_line(current_survey["conclusion"])
string += f"## Conclusion\n{content}\n"
except:
except Exception:
string += f"## Conclusion:\nNone\n"

return string
Expand Down Expand Up @@ -154,20 +154,20 @@ def convert_survey_dict_to_abbr_str(current_survey):
try:
content = SurveyManager._abbr_one_line(current_survey["title"], abbr=False)
string += f"# Title: {content}\n"
except:
except Exception:
string += f"# Title: None\n"
# abstract
try:
content = SurveyManager._abbr_one_line(current_survey["abstract"], abbr=False)
string += f"# Abstract: {content}\n"
except:
except Exception:
string += f"# Abstract: None\n"

# introduction
try:
content = SurveyManager._abbr_one_line(current_survey["introduction"])
string += f"# Introduction: {content}\n"
except:
except Exception:
string += f"# Introduction: None\n"

# sections
Expand All @@ -191,7 +191,7 @@ def convert_survey_dict_to_abbr_str(current_survey):
try:
content = SurveyManager._abbr_one_line(current_survey["conclusion"])
string += f"# Conclusion: {content}\n"
except:
except Exception:
string += f"# Conclusion: None\n"

return string
Expand Down Expand Up @@ -246,7 +246,7 @@ def update_current_survey(current_survey, answer) -> bool:
j = int(keys[1].lower().split("subsection-")[-1])-1
try:
return SurveyManager.update_one_section(current_survey["sections"][i]["subsections"], j, content)
except:
except Exception:
# print("update fail!")
return False

Expand All @@ -256,15 +256,15 @@ def update_current_survey(current_survey, answer) -> bool:
k = int(keys[2].lower().split("subsubsection-")[-1])-1
try:
return SurveyManager.update_one_section(current_survey["sections"][i]["subsections"][j]["subsubsections"], k, content) # 禁用第四级
except:
except Exception:
# print("update fail!")
return False
else:
# print("update fail!")
# print("unsupported update_pos keys")
return False
# raise ValueError("unsupported update_pos keys")
except:
except Exception:
# print("update fail!")
return False
# print("answer is not a valid json object.")
Expand Down Expand Up @@ -659,7 +659,7 @@ def parse_generator_response(response):

try:
current_update = response.split("Current Update:")[-1].split("Next Plan:")[0]
except:
except Exception:
current_update = response

# pattern
Expand Down Expand Up @@ -733,7 +733,7 @@ def parse_generator_response(response):
else:
assert isinstance(answer["content"], str)
has_answer = True
except:
except Exception:
answer = {}
else:
answer = {}
Expand All @@ -743,10 +743,10 @@ def parse_generator_response(response):

try:
next_plan = response.split("Next Plan:")[1]
except:
except Exception:
try:
next_plan = response.split("</answer>")[1]
except:
except Exception:
next_plan = response

think_match = re.search(think_pattern, next_plan, re.DOTALL) # 多行提取
Expand All @@ -768,7 +768,7 @@ def parse_generator_response(response):
if tool_call["name"] == "search_engine":
assert isinstance(tool_call["arguments"]["query"], list)
has_tool_call = True
except:
except Exception:
tool_call = {}
else:

Expand Down
2 changes: 1 addition & 1 deletion demo/minicpm4/SurveyGeneration/src/retriever/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def search_text_batch(request:MessageRequest):
title = abstract.split("\n")[1]
title = title.split(":")[1].strip()
titles.append(title)
except:
except Exception:
titles.append("")
results.append({ "search_keywords":search_keywords, "summarys":abstracts, "done":done, "score":score, "titles":titles, "bibkeys":bibkeys})

Expand Down