Skip to content

Commit 31e7f71

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 8a154ca commit 31e7f71

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,13 +581,13 @@ Instead of using `fastmcp install`, you can manually configure Cursor to use the
581581
{
582582
"input_path": "test/data/test_local_jsonl.jsonl",
583583
"evaluation_type": "llm",
584-
"eval_group_name": "custom_llm_eval",
585-
"kwargs": {
584+
"eval_group_name": "custom_llm_eval",
585+
"kwargs": {
586586
"column_content": "content",
587587
"custom_config": "examples/mcp/config_mcp_example.json"
588588
// data_format="jsonl" and dataset="local" will be inferred
589589
}
590590
}
591591
</arguments>
592592
</use_mcp_tool>
593-
```
593+
```

examples/mcp/config_mcp_example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"api_url": "enter your local llm api url, such as:http://127.0.0.1:8080/v1"
77
}
88
}
9-
}
9+
}

mcp_server.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import json
12
import os
23
import uuid
3-
import json
44
from typing import Literal, Optional
55

6-
from fastmcp import FastMCP
76
from dingo.exec import Executor
87
from dingo.io import InputArgs
98
from dingo.utils import log
9+
from fastmcp import FastMCP
1010

1111
# Dingo log level can be set via InputArgs('log_level') if needed
1212

@@ -23,7 +23,7 @@ def run_dingo_evaluation(
2323
task_name: Optional[str] = None,
2424
save_data: bool = True,
2525
save_correct: bool = True,
26-
kwargs: dict = {}
26+
kwargs: dict = {}
2727
) -> str:
2828
"""Runs a Dingo evaluation (rule-based or LLM-based).
2929
@@ -41,14 +41,14 @@ def run_dingo_evaluation(
4141
save_data: Whether to save the detailed JSONL output (default: True).
4242
save_correct: Whether to save correct data (default: True).
4343
kwargs: Dictionary containing additional arguments compatible with dingo.io.InputArgs.
44-
Use for: dataset, data_format, column_content, column_id,
44+
Use for: dataset, data_format, column_content, column_id,
4545
column_prompt, column_image, custom_config, max_workers, etc.
4646
API keys for LLMs should be set via environment variables in mcp.json.
4747
4848
Returns:
4949
The absolute path to the primary output file (summary.json or first .jsonl).
5050
"""
51-
log.info(f"Received Dingo request: type={evaluation_type}, group={eval_group_name}, input={input_path}")
51+
log.info(f"Received Dingo request: type={evaluation_type}, group={eval_group_name}, input={input_path}")
5252

5353
# --- Path Resolution ---
5454
abs_input_path = None
@@ -109,7 +109,7 @@ def run_dingo_evaluation(
109109
original_config = loaded_custom_config
110110
normalized_config = {}
111111
llm_eval_section = original_config.get('llm_eval', {})
112-
112+
113113
# Extract prompts
114114
prompts = []
115115
evaluations = llm_eval_section.get('evaluations', [])
@@ -123,7 +123,7 @@ def run_dingo_evaluation(
123123
log.info(f"Normalized prompt_list: {prompts}")
124124
else:
125125
log.warning("Could not extract prompt name(s) for normalization.")
126-
126+
127127
# Extract llm_config
128128
models_section = llm_eval_section.get('models', {})
129129
if models_section and isinstance(models_section, dict):
@@ -138,7 +138,7 @@ def run_dingo_evaluation(
138138
log.info(f"Normalized llm_config for model '{model_name}': {model_details}")
139139
else:
140140
log.warning("Could not extract model details for normalization.")
141-
141+
142142
if 'prompt_list' in normalized_config and 'llm_config' in normalized_config:
143143
loaded_custom_config = normalized_config
144144
log.info("Successfully normalized custom_config structure.")
@@ -160,9 +160,9 @@ def run_dingo_evaluation(
160160
raise ValueError("Cannot determine default output directory without an input_path.")
161161
input_parent_dir = os.path.dirname(abs_input_path)
162162
abs_output_dir = os.path.join(input_parent_dir, f"dingo_output_{task_name_for_path}")
163-
abs_output_dir = abs_output_dir.replace("\\","/")
163+
abs_output_dir = abs_output_dir.replace("\\","/")
164164
log.info(f"Using default output directory relative to input: {abs_output_dir}")
165-
165+
166166
os.makedirs(abs_output_dir, exist_ok=True)
167167

168168
# --- Prepare Dingo InputArgs Data ---
@@ -229,18 +229,18 @@ def run_dingo_evaluation(
229229
log.error(f"Evaluation result missing valid 'output_path' attribute.")
230230
raise RuntimeError("Dingo execution finished, but couldn't determine output path.")
231231

232-
result_output_dir = result.output_path
232+
result_output_dir = result.output_path
233233
log.info(f"Dingo reported output directory: {result_output_dir}")
234234

235235
if not os.path.isdir(result_output_dir):
236236
log.error(f"Output directory from Dingo ({result_output_dir}) does not exist.")
237237
# Fallback: Return the parent dir used in InputArgs
238238
log.warning(f"Returning the base output directory used in InputArgs: {abs_output_dir}")
239-
return abs_output_dir
240-
239+
return abs_output_dir
240+
241241
# --- Find Primary Output File ---
242242
# Priority 1: summary.json
243-
summary_path = os.path.join(result_output_dir, "summary.json")
243+
summary_path = os.path.join(result_output_dir, "summary.json")
244244
if os.path.isfile(summary_path):
245245
summary_path_abs = os.path.abspath(summary_path).replace("\\", "/")
246246
log.info(f"Found summary.json. Returning path: {summary_path_abs}")
@@ -256,7 +256,7 @@ def run_dingo_evaluation(
256256
log.info(f"Found first .jsonl: {first_jsonl_path}. Returning this path.")
257257
break
258258
if first_jsonl_path: break
259-
259+
260260
if first_jsonl_path:
261261
return first_jsonl_path
262262
else:
@@ -271,4 +271,4 @@ def run_dingo_evaluation(
271271

272272

273273
if __name__ == "__main__":
274-
mcp.run()
274+
mcp.run()

0 commit comments

Comments
 (0)