MCPcopy
hub / github.com/HKUDS/DeepCode / _generate_mock_response

Method _generate_mock_response

tools/code_indexer.py:468–517  ·  view source on GitHub ↗

Generate mock LLM response for testing

(self, prompt: str)

Source from the content-addressed store, hash-verified

466 return f"Error in LLM analysis: {error_msg}"
467
468 def _generate_mock_response(self, prompt: str) -> str:
469 """Generate mock LLM response for testing"""
470 if "JSON format" in prompt and "file_type" in prompt:
471 # File analysis mock
472 return """
473 {
474 "file_type": "Python module",
475 "main_functions": ["main_function", "helper_function"],
476 "key_concepts": ["data_processing", "algorithm"],
477 "dependencies": ["numpy", "pandas"],
478 "summary": "Mock analysis of code file functionality."
479 }
480 """
481 elif "relationships" in prompt:
482 # Relationship analysis mock
483 return """
484 {
485 "relationships": [
486 {
487 "target_file_path": "src/core/mock.py",
488 "relationship_type": "partial_match",
489 "confidence_score": 0.8,
490 "helpful_aspects": ["algorithm implementation", "data structures"],
491 "potential_contributions": ["core functionality", "utility methods"],
492 "usage_suggestions": "Mock relationship suggestion for testing."
493 }
494 ]
495 }
496 """
497 elif "relevant_files" in prompt:
498 # File filtering mock
499 return """
500 {
501 "relevant_files": [
502 {
503 "file_path": "mock_file.py",
504 "relevance_reason": "Mock relevance reason",
505 "confidence": 0.9,
506 "expected_contribution": "Mock contribution"
507 }
508 ],
509 "summary": {
510 "total_files_analyzed": "10",
511 "relevant_files_count": "1",
512 "filtering_strategy": "Mock filtering strategy"
513 }
514 }
515 """
516 else:
517 return "Mock LLM response for testing purposes."
518
519 def _save_debug_response(self, provider: str, prompt: str, response: str):
520 """Save LLM response for debugging"""

Callers 1

_call_llmMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected