wu981526092 commited on
Commit
cac81df
·
1 Parent(s): 62133fa

🗑️ Remove Simple Q&A Demonstration - Keep Only Comprehensive Example

Browse files

✅ **Removed Content:**
- simple_qa_demonstration.txt trace (second trace)
- kg_simple_qa_demo.json knowledge graph (second KG)
- References to 2 examples in documentation

✅ **Now Contains:**
- Single comprehensive Python Documentation Assistant example
- Multi-step RAG workflow (4 observations)
- Extended educational conversation with code examples
- Complete knowledge graph with failures and optimizations

✅ **Benefits:**
- Focused on single high-quality example
- Reduced complexity for users
- Maintained all advanced features in one comprehensive sample
- Cleaner sample data structure

**Result**: Sample data now contains one production-quality, feature-complete example that fully demonstrates AgentGraph capabilities without redundancy.

backend/database/README_sample_data.md CHANGED
@@ -14,21 +14,14 @@ The enhanced sample data system automatically inserts curated examples showcasin
14
 
15
  ### 🎯 Enhanced Examples
16
 
17
- The system includes 2 carefully selected examples showcasing AgentGraph's advanced capabilities:
18
 
19
- 1. **Python Documentation Assistant** (Enhanced)
20
 
21
  - Type: `documentation_search`
22
- - Example: RAG-powered assistant processing programming inquiry with knowledge search and failure detection
23
  - 6 entities, 5 relations, 1 failure, 2 optimizations
24
- - Features: Content references, quality scoring, system summary
25
-
26
- 2. **Simple Q&A Demonstration** (Basic)
27
-
28
- - Type: `conversation`
29
- - Example: Basic Python programming concept inquiry
30
- - 4 entities, 4 relations, 0 failures, 1 optimization
31
- - Features: Streamlined structure, clear interaction flow
32
 
33
  ### 🕸️ Enhanced Knowledge Graph Examples
34
 
@@ -123,7 +116,7 @@ To disable automatic sample data insertion, modify `init_db.py`:
123
  ## Benefits for Users
124
 
125
  1. **Immediate Value**: New users see AgentGraph's complete capabilities immediately
126
- 2. **Learning**: Examples demonstrate RAG search, failure detection, optimization suggestions, and advanced features
127
  3. **Testing**: Users can test all AgentGraph features including quality assessment and content referencing
128
  4. **Reference**: Examples serve as high-quality templates showcasing best practices
129
  5. **Feature Discovery**: Users understand the full potential of knowledge graph enhancement
@@ -146,7 +139,7 @@ To disable automatic sample data insertion, modify `init_db.py`:
146
  To update sample data:
147
 
148
  1. Modify `SAMPLE_TRACES` and `SAMPLE_KNOWLEDGE_GRAPHS` in `sample_data.py`
149
- 2. Ensure trace_index links are correct between traces and KGs
150
  3. Test with a fresh database initialization
151
  4. Update this documentation if needed
152
 
 
14
 
15
  ### 🎯 Enhanced Examples
16
 
17
+ The system includes a carefully selected example showcasing AgentGraph's advanced capabilities:
18
 
19
+ **Python Documentation Assistant** (Comprehensive)
20
 
21
  - Type: `documentation_search`
22
+ - Example: RAG-powered assistant processing multi-turn programming inquiry with knowledge search and failure detection
23
  - 6 entities, 5 relations, 1 failure, 2 optimizations
24
+ - Features: Multi-step workflow, educational interactions, content references, quality scoring
 
 
 
 
 
 
 
25
 
26
  ### 🕸️ Enhanced Knowledge Graph Examples
27
 
 
116
  ## Benefits for Users
117
 
118
  1. **Immediate Value**: New users see AgentGraph's complete capabilities immediately
119
+ 2. **Learning**: Example demonstrates RAG search, failure detection, optimization suggestions, and advanced features
120
  3. **Testing**: Users can test all AgentGraph features including quality assessment and content referencing
121
  4. **Reference**: Examples serve as high-quality templates showcasing best practices
122
  5. **Feature Discovery**: Users understand the full potential of knowledge graph enhancement
 
139
  To update sample data:
140
 
141
  1. Modify `SAMPLE_TRACES` and `SAMPLE_KNOWLEDGE_GRAPHS` in `sample_data.py`
142
+ 2. Ensure trace_index links are correct between trace and KG
143
  3. Test with a fresh database initialization
144
  4. Update this documentation if needed
145
 
backend/database/sample_data.py CHANGED
@@ -115,93 +115,6 @@ SAMPLE_TRACES = [
115
  }
116
  ]
117
  }"""
118
- },
119
- {
120
- "filename": "simple_qa_demonstration.txt",
121
- "title": "Simple Q&A: Basic Programming Help",
122
- "description": "Extended example showing interactive programming assistant with multi-turn educational conversation, step-by-step explanations, and performance comparisons",
123
- "trace_type": "conversation",
124
- "trace_source": "sample_data",
125
- "tags": ["detailed", "qa", "educational", "interactive", "performance"],
126
- "content": """User: Hello, can you help me understand what Python list comprehensions are used for?
127
-
128
- Assistant: Certainly! Python list comprehensions are a powerful and concise way to create lists. Here are their main uses:
129
-
130
- 1. **Creating Lists from Iterables**: Transform elements from existing sequences
131
- 2. **Filtering Data**: Include only elements that meet certain conditions
132
- 3. **Mathematical Operations**: Apply calculations to each element efficiently
133
- 4. **Nested Iterations**: Handle complex data transformations in readable syntax
134
-
135
- For example: `[x**2 for x in range(10) if x % 2 == 0]` creates a list of squares of even numbers.
136
-
137
- Would you like to see more specific examples or learn about related Python features?
138
-
139
- User: Yes, that example looks interesting! Can you break down how that specific example works step by step?
140
-
141
- Assistant: Absolutely! Let me break down `[x**2 for x in range(10) if x % 2 == 0]` step by step:
142
-
143
- **Step 1: The iterable**
144
- - `range(10)` generates numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
145
-
146
- **Step 2: The condition (filter)**
147
- - `if x % 2 == 0` keeps only even numbers
148
- - This filters to: 0, 2, 4, 6, 8
149
-
150
- **Step 3: The expression (transformation)**
151
- - `x**2` squares each remaining number
152
- - Results in: 0², 2², 4², 6², 8² = 0, 4, 16, 36, 64
153
-
154
- **Final result**: `[0, 4, 16, 36, 64]`
155
-
156
- **Equivalent traditional loop:**
157
- ```python
158
- result = []
159
- for x in range(10):
160
- if x % 2 == 0:
161
- result.append(x**2)
162
- ```
163
-
164
- The list comprehension does the same thing in just one readable line!
165
-
166
- User: That makes so much sense now! Are there any performance differences between the two approaches?
167
-
168
- Assistant: Great question! Yes, there are notable performance differences:
169
-
170
- **Performance Benefits of List Comprehensions:**
171
-
172
- 1. **Speed**: List comprehensions are typically 20-30% faster than equivalent for loops
173
- - They're implemented in C under the hood
174
- - Less Python bytecode overhead
175
-
176
- 2. **Memory efficiency**: More memory-efficient during creation
177
- - Pre-allocates the result list size when possible
178
- - Fewer intermediate steps
179
-
180
- **Quick benchmark example:**
181
- ```python
182
- import timeit
183
-
184
- # List comprehension
185
- time1 = timeit.timeit('[x**2 for x in range(1000)]', number=10000)
186
-
187
- # Traditional loop
188
- code = '''
189
- result = []
190
- for x in range(1000):
191
- result.append(x**2)
192
- '''
193
- time2 = timeit.timeit(code, number=10000)
194
-
195
- print(f"List comprehension: {time1:.4f}s")
196
- print(f"Traditional loop: {time2:.4f}s")
197
- # Typical result: comprehension is ~25% faster
198
- ```
199
-
200
- **When to use each:**
201
- - **List comprehensions**: Simple transformations, filtering, mathematical operations
202
- - **Traditional loops**: Complex logic, multiple statements, debugging needs
203
-
204
- The key is readability - if your logic fits nicely in one line, list comprehensions are usually the way to go!"""
205
  }
206
  ]
207
 
@@ -422,156 +335,6 @@ SAMPLE_KNOWLEDGE_GRAPHS = [
422
  "domain": "programming_documentation"
423
  }
424
  }
425
- },
426
- {
427
- "filename": "kg_simple_qa_demo.json",
428
- "trace_index": 1, # Links to second trace
429
- "graph_data": {
430
- "system_name": "Python Q&A Assistant",
431
- "system_summary": "An interactive educational system designed to provide comprehensive information about Python programming concepts. The system processes user questions and delivers detailed multi-turn responses including step-by-step explanations, code examples, performance analysis, and practical guidance.",
432
- "entities": [
433
- {
434
- "id": "user_001",
435
- "type": "Human",
436
- "name": "User",
437
- "importance": "HIGH",
438
- "raw_prompt": "Hello, can you help me understand what Python list comprehensions are used for? [Extended multi-turn conversation with detailed examples and performance comparisons]",
439
- "raw_prompt_ref": [
440
- {
441
- "line_start": 1,
442
- "line_end": 1
443
- }
444
- ]
445
- },
446
- {
447
- "id": "assistant_001",
448
- "type": "Agent",
449
- "name": "Q&A Assistant",
450
- "importance": "HIGH",
451
- "raw_prompt": "RAG-powered assistant specialized in searching knowledge base and providing accurate information about Python programming concepts and capabilities.",
452
- "raw_prompt_ref": [
453
- {
454
- "line_start": 3,
455
- "line_end": 3
456
- }
457
- ]
458
- },
459
- {
460
- "id": "inquiry_task",
461
- "type": "Task",
462
- "name": "Service Information Request",
463
- "importance": "HIGH",
464
- "raw_prompt": "Process user inquiry about Python programming concepts and provide comprehensive response.",
465
- "raw_prompt_ref": [
466
- {
467
- "line_start": 1,
468
- "line_end": 1
469
- }
470
- ]
471
- },
472
- {
473
- "id": "response_output",
474
- "type": "Output",
475
- "name": "Service Overview Response",
476
- "importance": "HIGH",
477
- "raw_prompt": "Comprehensive explanation covering list comprehension syntax, use cases, step-by-step breakdowns, performance comparisons with traditional loops, and practical coding examples with benchmarks.",
478
- "raw_prompt_ref": [
479
- {
480
- "line_start": 3,
481
- "line_end": 10
482
- }
483
- ]
484
- }
485
- ],
486
- "relations": [
487
- {
488
- "id": "user_inquiry",
489
- "source": "user_001",
490
- "target": "assistant_001",
491
- "type": "CONSUMED_BY",
492
- "importance": "HIGH",
493
- "interaction_prompt": "User asks about Python programming concepts",
494
- "interaction_prompt_ref": [
495
- {
496
- "line_start": 1,
497
- "line_end": 1
498
- }
499
- ]
500
- },
501
- {
502
- "id": "assistant_processes",
503
- "source": "assistant_001",
504
- "target": "inquiry_task",
505
- "type": "PERFORMS",
506
- "importance": "HIGH",
507
- "interaction_prompt": "Assistant processes the programming concept request",
508
- "interaction_prompt_ref": [
509
- {
510
- "line_start": 3,
511
- "line_end": 3
512
- }
513
- ]
514
- },
515
- {
516
- "id": "task_generates",
517
- "source": "inquiry_task",
518
- "target": "response_output",
519
- "type": "PRODUCES",
520
- "importance": "HIGH",
521
- "interaction_prompt": "Task generates comprehensive programming concept overview",
522
- "interaction_prompt_ref": [
523
- {
524
- "line_start": 3,
525
- "line_end": 10
526
- }
527
- ]
528
- },
529
- {
530
- "id": "response_delivered",
531
- "source": "response_output",
532
- "target": "user_001",
533
- "type": "DELIVERS_TO",
534
- "importance": "HIGH",
535
- "interaction_prompt": "Comprehensive programming information delivered to user",
536
- "interaction_prompt_ref": [
537
- {
538
- "line_start": 3,
539
- "line_end": 10
540
- }
541
- ]
542
- }
543
- ],
544
- "failures": [],
545
- "optimizations": [
546
- {
547
- "id": "opt_simple_001",
548
- "recommendation_type": "PROMPT_REFINEMENT",
549
- "description": "Add interactive code playground integration and personalized learning paths based on user's demonstrated understanding level throughout the conversation.",
550
- "affected_ids": ["assistant_001"],
551
- "raw_text_ref": [
552
- {
553
- "line_start": 12,
554
- "line_end": 12
555
- }
556
- ]
557
- }
558
- ],
559
- "metadata": {
560
- "creation_timestamp": "2025-01-27T12:00:00Z",
561
- "schema_version": "2.1.0",
562
- "quality_score": 0.92,
563
- "entity_count": 4,
564
- "relation_count": 4,
565
- "failure_count": 0,
566
- "optimization_count": 1,
567
- "interaction_depth": "extended",
568
- "educational_value": "comprehensive",
569
- "processing_method": "simplified_demonstration",
570
- "content_source": "conversation_trace",
571
- "language": "en",
572
- "domain": "programming_documentation"
573
- }
574
- }
575
  }
576
  ]
577
 
@@ -676,5 +439,5 @@ def get_sample_data_info():
676
  "trace_types": list(set(t["trace_type"] for t in SAMPLE_TRACES)),
677
  "complexity_levels": ["enhanced", "simple"],
678
  "features": ["rag_search", "failure_detection", "optimization_recommendations", "content_references", "quality_scoring"],
679
- "description": "Comprehensive AgentGraph examples showcasing Python Documentation RAG-powered assistant with multi-turn interactions, detailed knowledge search, educational content delivery, failure detection, optimization suggestions, and advanced knowledge graph features"
680
  }
 
115
  }
116
  ]
117
  }"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
  ]
120
 
 
335
  "domain": "programming_documentation"
336
  }
337
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
  ]
340
 
 
439
  "trace_types": list(set(t["trace_type"] for t in SAMPLE_TRACES)),
440
  "complexity_levels": ["enhanced", "simple"],
441
  "features": ["rag_search", "failure_detection", "optimization_recommendations", "content_references", "quality_scoring"],
442
+ "description": "Comprehensive AgentGraph example showcasing Python Documentation RAG-powered assistant with multi-turn interactions, detailed knowledge search, educational content delivery, failure detection, optimization suggestions, and advanced knowledge graph features"
443
  }