-
Notifications
You must be signed in to change notification settings - Fork 393
Description
Initial Checks
- I have searched GitHub for a duplicate issue and I'm sure this is something new
- I have read and followed the docs & demos and still think this is a bug
- I am confident that the issue is with ms-agent (not my code, or another library in the ecosystem)
What happened + What you expected to happen
The parse_code() function currently only extracts content when it's wrapped in markdown code blocks (e.g., ```json...), but fails when given raw JSON text. This causes unnecessary errors when processing valid JSON inputs that don't use markdown formatting.
Error Log:
2025-07-11 16:55:48.083 - modelscope-agent - ERROR - | message: json.*?\s+(.*?)
not match following text:
2025-07-11 16:55:48.084 - modelscope-agent - ERROR - | message:
[
{
"task_id": "1",
"dependent_task_ids": [],
"instruction": "Load and inspect the train and eval datasets.",
"task_type": "eda"
},
{
"task_id": "2",
"dependent_task_ids": ["1"],
"instruction": "Handle missing values, encode categorical variables, and scale numerical features.",
"task_type": "data preprocessing"
},
{
"task_id": "3",
"dependent_task_ids": ["2"],
"instruction": "Create new features based on existing data (e.g., derived features, interactions).",
"task_type": "feature engineering"
},
{
"task_id": "4",
"dependent_task_ids": ["2", "3"],
"instruction": "Train a classification model on the preprocessed and engineered data.",
"task_type": "model train"
},
{
"task_id": "5",
"dependent_task_ids": ["4"],
"instruction": "Evaluate the model on the eval data and report the F1 score.",
"task_type": "model evaluate"
}
]
Versions / Dependencies
release/0.8
Reproduction script
rom modelscope_agent.agents.data_science_assistant import DataScienceAssistant
from modelscope_agent.tools.metagpt_tools.tool_recommend import TypeMatchToolRecommender
llm_config = {
'model': 'Qwen/Qwen3-8B',
'model_server': 'openai',
'api_base': 'https://api.siliconflow.cn/v1',
'api_key': '硅基流动api_key'
}
tool_recommender = TypeMatchToolRecommender(tools=[""])
ds_assistant = DataScienceAssistant(llm=llm_config, tool_recommender=tool_recommender)
question = "This is a medical dataset with over fifty anonymized health characteristics linked to three age-related conditions. Your goal is to predict whether a subject has or has not been diagnosed with one of these conditions. The target column is Class. Perform data analysis, data preprocessing, feature engineering, and modeling to predict the target. Report F1 Score on the eval data. Train data path: ‘/Users/hao0926.hu/pyproject/data_interpreter/di_dataset/ml_benchmark/04_titanic/split_train.csv', eval data path: ‘/Users/hao0926.hu/pyproject/data_interpreter/di_dataset/ml_benchmark/04_titanic/split_eval.csv' . It is only necessary to provide the relevant code, without actually running it to verify whether it can run successfully"
responses = ds_assistant.run(question)
for res in responses:
print(res)
Issue Severity
None