MCPcopy
hub / github.com/volcengine/OpenViking / process_question

Function process_question

benchmark/locomo/claudecode/eval.py:355–457  ·  view source on GitHub ↗
(
    qa: dict,
    project_root: str,
    home_dir: str,
    api_url: Optional[str],
    api_key: Optional[str],
    auth_token: Optional[str],
    model: Optional[str],
    output_path: str,
    timeout_sec: int,
    hooks_settings: Optional[str] = None,
    mcp_config: Optional[str] = None,
    ov_config: Optional[str] = None,
    ov_cli_config: Optional[str] = None,
    ov_shared_id: Optional[str] = None,
    ov_preamble_override: Optional[str] = None,
    shared_cwd: bool = False,
)

Source from the content-addressed store, hash-verified

353
354
355def process_question(
356 qa: dict,
357 project_root: str,
358 home_dir: str,
359 api_url: Optional[str],
360 api_key: Optional[str],
361 auth_token: Optional[str],
362 model: Optional[str],
363 output_path: str,
364 timeout_sec: int,
365 hooks_settings: Optional[str] = None,
366 mcp_config: Optional[str] = None,
367 ov_config: Optional[str] = None,
368 ov_cli_config: Optional[str] = None,
369 ov_shared_id: Optional[str] = None,
370 ov_preamble_override: Optional[str] = None,
371 shared_cwd: bool = False,
372) -> dict:
373 sample_id = qa["sample_id"]
374 qi = qa["question_index"]
375 question = qa["question"]
376 question_time = qa.get("question_time")
377
378 project_dir = project_root if shared_cwd else os.path.join(project_root, sample_id)
379
380 if ov_preamble_override is not None:
381 ov_preamble = ov_preamble_override + "\n\n" if ov_preamble_override else ""
382 elif ov_config:
383 ov_preamble = "If context is insufficient, use OpenViking MCP tools or auto-memory files to find more information.\n\n"
384 else:
385 ov_preamble = ""
386
387 if question_time:
388 prompt = (
389 f"{ov_preamble}Current date: {question_time}. Answer the question directly: {question}"
390 )
391 else:
392 prompt = f"{ov_preamble}Answer the question directly: {question}"
393
394 print(
395 f" [{sample_id}] Q{qi}: {question[:60]}{'...' if len(question) > 60 else ''}",
396 file=sys.stderr,
397 )
398
399 hook_log = os.path.join(home_dir, ".openviking", "logs", "cc-hooks.log") if ov_config else ""
400 hook_before = _count_file_lines(hook_log) if hook_log else 0
401 mcp_before = _count_file_lines(OV_MCP_LOG) if ov_config else 0
402
403 t0 = time.perf_counter()
404 result = run_claude_code(
405 prompt,
406 project_dir,
407 home_dir,
408 api_url=api_url,
409 api_key=api_key,
410 auth_token=auth_token,
411 model=model,
412 timeout_sec=timeout_sec,

Callers

nothing calls this directly

Calls 6

_count_file_linesFunction · 0.85
run_claude_codeFunction · 0.85
append_rowFunction · 0.85
dumpsMethod · 0.80
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected