Skip to content

Commit d3f9fb9

Browse files
committed
fix(graphrag): clarify architectural analysis JSON response format
- Add explicit JSON schema at end of prompt for clearer AI output structure - Improves consistency of relationship extraction responses
1 parent 50448b9 commit d3f9fb9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • src/indexer/graphrag

src/indexer/graphrag/ai.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,13 @@ impl AIEnhancements {
171171
"You are an expert software architect. Analyze these code files and identify ARCHITECTURAL relationships.\n\
172172
Focus on design patterns, dependency injection, factory patterns, observer patterns, etc.\n\
173173
Look for relationships that go beyond simple imports - identify architectural significance.\n\n\
174-
Respond with a JSON array of relationships. For each relationship, include:\n\
175-
- source_path: relative path of source file\n\
176-
- target_path: relative path of target file\n\
174+
For each relationship, provide:\n\
175+
- source_path: relative path of the source file\n\
176+
- target_path: relative path of the target file\n\
177177
- relation_type: one of 'implements_pattern', 'dependency_injection', 'factory_creates', 'observer_pattern', 'strategy_pattern', 'adapter_pattern', 'decorator_pattern', 'architectural_dependency'\n\
178178
- description: brief explanation of the architectural relationship\n\
179-
- confidence: 0.0-1.0 confidence score\n\n"
179+
- confidence: 0.0-1.0 confidence score\n\n\
180+
Respond with JSON: {\"relationships\": [{\"source_path\": \"...\", \"target_path\": \"...\", \"relation_type\": \"...\", \"description\": \"...\", \"confidence\": 0.0}]}\n\n"
180181
);
181182
let mut batch_prompt = String::from("");
182183

0 commit comments

Comments
 (0)