File size: 52,526 Bytes
8a2dcce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
2026-08-02 13:43:39,527 | INFO     | dsa_chatbot.__main__ | Loading embedding model: all-MiniLM-L6-v2
2026-08-02 13:44:07,549 | WARNING  | dsa_chatbot.__main__ | The following KB files have no topic_metadata.json entry and will be skipped: ['01_knapsack.txt', 'activity_selection_problem.txt', 'backtracking_overview.txt', 'bit_manipulation_basics.txt', 'coin_change_problem.txt', 'dijkstras_algorithm.txt', 'dynamic_programming_overview.txt', 'edit_distance.txt', 'fractional_knapsack.txt', 'greedy_algorithms_overview.txt', 'hash_set_vs_hash_map.txt', 'hash_table.txt', 'kruskals_algorithm_mst.txt', 'longest_common_subsequence.txt', 'longest_increasing_subsequence.txt', 'n-queens_problem.txt', 'prims_algorithm_mst.txt', 'recursion_overview.txt', 'subset_sum_power_set_generation.txt', 'xor_tricks.txt']
2026-08-02 13:44:08,102 | INFO     | dsa_chatbot.__main__ | Built 98 chunks from 54 knowledge-base files.
2026-08-02 13:44:08,102 | INFO     | dsa_chatbot.__main__ | Embedding 98 chunks...
2026-08-02 13:44:13,562 | INFO     | dsa_chatbot.__main__ | Index build complete. Collection 'dsa_knowledge_base' now has 98 chunks.
2026-08-02 13:45:19,505 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how binary search works' | topic=Binary Search
2026-08-02 13:45:19,648 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how binary search works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:19,658 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is the time complexity of merge sort?' | topic=Insertion Sort
2026-08-02 13:45:19,680 | INFO     | dsa_chatbot.rag.retriever | Query='What is the time complexity of merge sort?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:19,681 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is the time complexity of merge sort?'
2026-08-02 13:45:19,688 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain quick sort with an example' | topic=Bucket Sort
2026-08-02 13:45:19,718 | INFO     | dsa_chatbot.rag.retriever | Query='Explain quick sort with an example' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:19,727 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a Trie used for?' | topic=Insertion Sort
2026-08-02 13:45:19,752 | INFO     | dsa_chatbot.rag.retriever | Query='What is a Trie used for?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:19,753 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is a Trie used for?'
2026-08-02 13:45:19,763 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a doubly linked list?' | topic=Doubly Linked List
2026-08-02 13:45:19,791 | INFO     | dsa_chatbot.rag.retriever | Query='What is a doubly linked list?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:19,796 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how a stack works' | topic=Stack
2026-08-02 13:45:19,817 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how a stack works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:19,825 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is topological sort used for?' | topic=Insertion Sort
2026-08-02 13:45:19,848 | INFO     | dsa_chatbot.rag.retriever | Query='What is topological sort used for?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:19,852 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: "Explain Dijkstra's Algorithm" | topic=Dijkstra's Algorithm
2026-08-02 13:45:19,899 | INFO     | dsa_chatbot.rag.retriever | Query="Explain Dijkstra's Algorithm" | candidates=0 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:19,899 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: "Explain Dijkstra's Algorithm"
2026-08-02 13:45:19,905 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a segment tree?' | topic=Insertion Sort
2026-08-02 13:45:19,929 | INFO     | dsa_chatbot.rag.retriever | Query='What is a segment tree?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:19,929 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is a segment tree?'
2026-08-02 13:45:19,935 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain the sliding window technique' | topic=Sliding Window Technique
2026-08-02 13:45:19,958 | INFO     | dsa_chatbot.rag.retriever | Query='Explain the sliding window technique' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:19,966 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'What is the difference between BFS and DFS?' | topics=['Breadth-First Search', 'Depth-First Search', 'Insertion Sort']
2026-08-02 13:45:19,995 | INFO     | dsa_chatbot.rag.retriever | Query='Breadth-First Search' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 13:45:20,013 | INFO     | dsa_chatbot.rag.retriever | Query='Depth-First Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,033 | INFO     | dsa_chatbot.rag.retriever | Query='Insertion Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,042 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare merge sort vs quick sort' | topics=['Bucket Sort', 'Merge Sort', 'Quick Sort']
2026-08-02 13:45:20,062 | INFO     | dsa_chatbot.rag.retriever | Query='Bucket Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,087 | INFO     | dsa_chatbot.rag.retriever | Query='Merge Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,107 | INFO     | dsa_chatbot.rag.retriever | Query='Quick Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,115 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Difference between a stack and a queue' | topics=['Queue', 'Stack']
2026-08-02 13:45:20,168 | INFO     | dsa_chatbot.rag.retriever | Query='Queue' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 13:45:20,190 | INFO     | dsa_chatbot.rag.retriever | Query='Stack' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,215 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: "Which one is better, Prim's Algorithm or Kruskal's Algorithm, for MST?" | topics=["Dijkstra's Algorithm", 'Insertion Sort', "Kruskal's Algorithm (MST)", "Prim's Algorithm (MST)"]
2026-08-02 13:45:20,245 | INFO     | dsa_chatbot.rag.retriever | Query="Dijkstra's Algorithm" | candidates=0 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:20,271 | INFO     | dsa_chatbot.rag.retriever | Query='Insertion Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,305 | INFO     | dsa_chatbot.rag.retriever | Query="Kruskal's Algorithm (MST)" | candidates=0 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:20,330 | INFO     | dsa_chatbot.rag.retriever | Query="Prim's Algorithm (MST)" | candidates=0 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:20,330 | WARNING  | dsa_chatbot.agents.comparison | Comparison agent: no chunks passed the similarity threshold for topic "Dijkstra's Algorithm"
2026-08-02 13:45:20,330 | WARNING  | dsa_chatbot.agents.comparison | Comparison agent: no chunks passed the similarity threshold for topic "Kruskal's Algorithm (MST)"
2026-08-02 13:45:20,330 | WARNING  | dsa_chatbot.agents.comparison | Comparison agent: no chunks passed the similarity threshold for topic "Prim's Algorithm (MST)"
2026-08-02 13:45:20,331 | WARNING  | dsa_chatbot.agents.router | COMPARISON query missing sufficient context for one or more topics: ["Dijkstra's Algorithm", 'Insertion Sort', "Kruskal's Algorithm (MST)", "Prim's Algorithm (MST)"]
2026-08-02 13:45:20,341 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare AVL Tree and Binary Search Tree' | topics=['AVL Tree', 'Binary Search', 'Binary Search Tree', 'Linear Search', 'Trie']
2026-08-02 13:45:20,362 | INFO     | dsa_chatbot.rag.retriever | Query='AVL Tree' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 13:45:20,380 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,403 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search Tree' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,426 | INFO     | dsa_chatbot.rag.retriever | Query='Linear Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 13:45:20,448 | INFO     | dsa_chatbot.rag.retriever | Query='Trie' | candidates=5 | passed_threshold=4 | threshold=0.45
2026-08-02 13:45:20,459 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'Who won the football World Cup in 2022?'
2026-08-02 13:45:20,466 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: "What's a good recipe for chocolate cake?"
2026-08-02 13:45:20,474 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is the capital of France?' | topic=Insertion Sort
2026-08-02 13:45:20,495 | INFO     | dsa_chatbot.rag.retriever | Query='What is the capital of France?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 13:45:20,495 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is the capital of France?'
2026-08-02 13:45:20,499 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'Can you explain that again?'
2026-08-02 13:45:20,517 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Merge Sort', 'Insertion Sort']); skipping fresh retrieval.
2026-08-02 13:45:20,530 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'Give me another example'
2026-08-02 13:45:20,531 | INFO     | dsa_chatbot.__main__ | Evaluation complete: {'total_questions': 20, 'route_accuracy': 0.9, 'avg_topic_recall': 0.65, 'retrieval_latency_ms_avg': 51.74, 'retrieval_latency_ms_p95': 140.89}
2026-08-02 13:59:25,086 | INFO     | dsa_chatbot.__main__ | Loading embedding model: all-MiniLM-L6-v2
2026-08-02 13:59:31,186 | INFO     | dsa_chatbot.__main__ | Existing collection 'dsa_knowledge_base' deleted.
2026-08-02 13:59:31,554 | INFO     | dsa_chatbot.__main__ | Built 150 chunks from 54 knowledge-base files.
2026-08-02 13:59:31,555 | INFO     | dsa_chatbot.__main__ | Embedding 150 chunks...
2026-08-02 13:59:39,737 | INFO     | dsa_chatbot.__main__ | Index build complete. Collection 'dsa_knowledge_base' now has 150 chunks.
2026-08-02 14:00:37,066 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how binary search works' | topic=Binary Search
2026-08-02 14:00:37,234 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how binary search works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,248 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is the time complexity of merge sort?' | topic=Insertion Sort
2026-08-02 14:00:37,273 | INFO     | dsa_chatbot.rag.retriever | Query='What is the time complexity of merge sort?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 14:00:37,274 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is the time complexity of merge sort?'
2026-08-02 14:00:37,288 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain quick sort with an example' | topic=Bucket Sort
2026-08-02 14:00:37,310 | INFO     | dsa_chatbot.rag.retriever | Query='Explain quick sort with an example' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,321 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a Trie used for?' | topic=Insertion Sort
2026-08-02 14:00:37,345 | INFO     | dsa_chatbot.rag.retriever | Query='What is a Trie used for?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 14:00:37,346 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is a Trie used for?'
2026-08-02 14:00:37,357 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a doubly linked list?' | topic=Doubly Linked List
2026-08-02 14:00:37,378 | INFO     | dsa_chatbot.rag.retriever | Query='What is a doubly linked list?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,386 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how a stack works' | topic=Stack
2026-08-02 14:00:37,405 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how a stack works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,415 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is topological sort used for?' | topic=Insertion Sort
2026-08-02 14:00:37,433 | INFO     | dsa_chatbot.rag.retriever | Query='What is topological sort used for?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,439 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: "Explain Dijkstra's Algorithm" | topic=Dijkstra's Algorithm
2026-08-02 14:00:37,463 | INFO     | dsa_chatbot.rag.retriever | Query="Explain Dijkstra's Algorithm" | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,471 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a segment tree?' | topic=Insertion Sort
2026-08-02 14:00:37,493 | INFO     | dsa_chatbot.rag.retriever | Query='What is a segment tree?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 14:00:37,494 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is a segment tree?'
2026-08-02 14:00:37,501 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain the sliding window technique' | topic=Sliding Window Technique
2026-08-02 14:00:37,521 | INFO     | dsa_chatbot.rag.retriever | Query='Explain the sliding window technique' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,539 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'What is the difference between BFS and DFS?' | topics=['Breadth-First Search', 'Depth-First Search', 'Insertion Sort']
2026-08-02 14:00:37,597 | INFO     | dsa_chatbot.rag.retriever | Query='Breadth-First Search' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:00:37,624 | INFO     | dsa_chatbot.rag.retriever | Query='Depth-First Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,647 | INFO     | dsa_chatbot.rag.retriever | Query='Insertion Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,666 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare merge sort vs quick sort' | topics=['Bucket Sort', 'Merge Sort', 'Quick Sort']
2026-08-02 14:00:37,699 | INFO     | dsa_chatbot.rag.retriever | Query='Bucket Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,725 | INFO     | dsa_chatbot.rag.retriever | Query='Merge Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,751 | INFO     | dsa_chatbot.rag.retriever | Query='Quick Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,767 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Difference between a stack and a queue' | topics=['Queue', 'Stack']
2026-08-02 14:00:37,821 | INFO     | dsa_chatbot.rag.retriever | Query='Queue' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:00:37,851 | INFO     | dsa_chatbot.rag.retriever | Query='Stack' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,892 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: "Which one is better, Prim's Algorithm or Kruskal's Algorithm, for MST?" | topics=["Dijkstra's Algorithm", 'Insertion Sort', "Kruskal's Algorithm (MST)", "Prim's Algorithm (MST)"]
2026-08-02 14:00:37,919 | INFO     | dsa_chatbot.rag.retriever | Query="Dijkstra's Algorithm" | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,944 | INFO     | dsa_chatbot.rag.retriever | Query='Insertion Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:37,977 | INFO     | dsa_chatbot.rag.retriever | Query="Kruskal's Algorithm (MST)" | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:00:38,005 | INFO     | dsa_chatbot.rag.retriever | Query="Prim's Algorithm (MST)" | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:00:38,022 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare AVL Tree and Binary Search Tree' | topics=['AVL Tree', 'Binary Search', 'Binary Search Tree', 'Linear Search', 'Trie']
2026-08-02 14:00:38,043 | INFO     | dsa_chatbot.rag.retriever | Query='AVL Tree' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:00:38,058 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:38,081 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search Tree' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:38,109 | INFO     | dsa_chatbot.rag.retriever | Query='Linear Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:00:38,126 | INFO     | dsa_chatbot.rag.retriever | Query='Trie' | candidates=5 | passed_threshold=4 | threshold=0.45
2026-08-02 14:00:38,138 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'Who won the football World Cup in 2022?'
2026-08-02 14:00:38,152 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: "What's a good recipe for chocolate cake?"
2026-08-02 14:00:38,164 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is the capital of France?' | topic=Insertion Sort
2026-08-02 14:00:38,186 | INFO     | dsa_chatbot.rag.retriever | Query='What is the capital of France?' | candidates=1 | passed_threshold=0 | threshold=0.45
2026-08-02 14:00:38,186 | WARNING  | dsa_chatbot.agents.router | SINGLE_TOPIC query had no chunks pass the similarity threshold: 'What is the capital of France?'
2026-08-02 14:00:38,195 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'Can you explain that again?'
2026-08-02 14:00:38,226 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Merge Sort', 'Insertion Sort']); skipping fresh retrieval.
2026-08-02 14:00:38,236 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'Give me another example'
2026-08-02 14:00:38,237 | INFO     | dsa_chatbot.__main__ | Evaluation complete: {'total_questions': 20, 'route_accuracy': 0.9, 'avg_topic_recall': 0.75, 'retrieval_latency_ms_avg': 59.26, 'retrieval_latency_ms_p95': 155.61}
2026-08-02 14:03:52,099 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how binary search works' | topic=Binary Search
2026-08-02 14:03:52,274 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how binary search works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,288 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is the time complexity of merge sort?' | topic=Merge Sort
2026-08-02 14:03:52,311 | INFO     | dsa_chatbot.rag.retriever | Query='What is the time complexity of merge sort?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,324 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain quick sort with an example' | topic=Quick Sort
2026-08-02 14:03:52,350 | INFO     | dsa_chatbot.rag.retriever | Query='Explain quick sort with an example' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,362 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a Trie used for?' | topic=Trie
2026-08-02 14:03:52,384 | INFO     | dsa_chatbot.rag.retriever | Query='What is a Trie used for?' | candidates=5 | passed_threshold=4 | threshold=0.45
2026-08-02 14:03:52,398 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a doubly linked list?' | topic=Doubly Linked List
2026-08-02 14:03:52,419 | INFO     | dsa_chatbot.rag.retriever | Query='What is a doubly linked list?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,430 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how a stack works' | topic=Stack
2026-08-02 14:03:52,450 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how a stack works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,462 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is topological sort used for?' | topic=Topological Sort
2026-08-02 14:03:52,483 | INFO     | dsa_chatbot.rag.retriever | Query='What is topological sort used for?' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:03:52,490 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: "Explain Dijkstra's Algorithm" | topic=Dijkstra's Algorithm
2026-08-02 14:03:52,516 | INFO     | dsa_chatbot.rag.retriever | Query="Explain Dijkstra's Algorithm" | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,522 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a segment tree?' | topic=Segment Tree
2026-08-02 14:03:52,547 | INFO     | dsa_chatbot.rag.retriever | Query='What is a segment tree?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,561 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain the sliding window technique' | topic=Sliding Window Technique
2026-08-02 14:03:52,582 | INFO     | dsa_chatbot.rag.retriever | Query='Explain the sliding window technique' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,605 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'What is the difference between BFS and DFS?' | topics=['Breadth-First Search', 'Depth-First Search']
2026-08-02 14:03:52,627 | INFO     | dsa_chatbot.rag.retriever | Query='Breadth-First Search' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:03:52,649 | INFO     | dsa_chatbot.rag.retriever | Query='Depth-First Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,662 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare merge sort vs quick sort' | topics=['Merge Sort', 'Quick Sort']
2026-08-02 14:03:52,685 | INFO     | dsa_chatbot.rag.retriever | Query='Merge Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,706 | INFO     | dsa_chatbot.rag.retriever | Query='Quick Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,722 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Difference between a stack and a queue' | topics=['Queue', 'Stack']
2026-08-02 14:03:52,749 | INFO     | dsa_chatbot.rag.retriever | Query='Queue' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:03:52,767 | INFO     | dsa_chatbot.rag.retriever | Query='Stack' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,793 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: "Which one is better, Prim's Algorithm or Kruskal's Algorithm, for MST?"
2026-08-02 14:03:52,814 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare AVL Tree and Binary Search Tree' | topics=['AVL Tree', 'Binary Search', 'Binary Search Tree']
2026-08-02 14:03:52,836 | INFO     | dsa_chatbot.rag.retriever | Query='AVL Tree' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:03:52,852 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,873 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search Tree' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:03:52,886 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'Who won the football World Cup in 2022?'
2026-08-02 14:03:52,904 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: "What's a good recipe for chocolate cake?"
2026-08-02 14:03:52,917 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'What is the capital of France?'
2026-08-02 14:03:52,924 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'Can you explain that again?'
2026-08-02 14:03:52,949 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Merge Sort']); skipping fresh retrieval.
2026-08-02 14:03:52,950 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'Give me another example'
2026-08-02 14:03:52,973 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Merge Sort']); skipping fresh retrieval.
2026-08-02 14:03:52,974 | INFO     | dsa_chatbot.__main__ | Evaluation complete: {'total_questions': 20, 'route_accuracy': 0.95, 'avg_topic_recall': 0.95, 'retrieval_latency_ms_avg': 44.4, 'retrieval_latency_ms_p95': 85.11}
2026-08-02 14:06:23,677 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how binary search works' | topic=Binary Search
2026-08-02 14:06:23,808 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how binary search works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:23,820 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is the time complexity of merge sort?' | topic=Merge Sort
2026-08-02 14:06:23,838 | INFO     | dsa_chatbot.rag.retriever | Query='What is the time complexity of merge sort?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:23,848 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain quick sort with an example' | topic=Quick Sort
2026-08-02 14:06:23,872 | INFO     | dsa_chatbot.rag.retriever | Query='Explain quick sort with an example' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:23,881 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a Trie used for?' | topic=Trie
2026-08-02 14:06:23,904 | INFO     | dsa_chatbot.rag.retriever | Query='What is a Trie used for?' | candidates=5 | passed_threshold=4 | threshold=0.45
2026-08-02 14:06:23,917 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a doubly linked list?' | topic=Doubly Linked List
2026-08-02 14:06:23,938 | INFO     | dsa_chatbot.rag.retriever | Query='What is a doubly linked list?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:23,946 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain how a stack works' | topic=Stack
2026-08-02 14:06:23,968 | INFO     | dsa_chatbot.rag.retriever | Query='Explain how a stack works' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:23,980 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is topological sort used for?' | topic=Topological Sort
2026-08-02 14:06:24,001 | INFO     | dsa_chatbot.rag.retriever | Query='What is topological sort used for?' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:06:24,007 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: "Explain Dijkstra's Algorithm" | topic=Dijkstra's Algorithm
2026-08-02 14:06:24,029 | INFO     | dsa_chatbot.rag.retriever | Query="Explain Dijkstra's Algorithm" | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,038 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'What is a segment tree?' | topic=Segment Tree
2026-08-02 14:06:24,065 | INFO     | dsa_chatbot.rag.retriever | Query='What is a segment tree?' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,076 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'Explain the sliding window technique' | topic=Sliding Window Technique
2026-08-02 14:06:24,099 | INFO     | dsa_chatbot.rag.retriever | Query='Explain the sliding window technique' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,113 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'What is the difference between BFS and DFS?' | topics=['Breadth-First Search', 'Depth-First Search']
2026-08-02 14:06:24,134 | INFO     | dsa_chatbot.rag.retriever | Query='Breadth-First Search' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:06:24,151 | INFO     | dsa_chatbot.rag.retriever | Query='Depth-First Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,166 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare merge sort vs quick sort' | topics=['Merge Sort', 'Quick Sort']
2026-08-02 14:06:24,190 | INFO     | dsa_chatbot.rag.retriever | Query='Merge Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,215 | INFO     | dsa_chatbot.rag.retriever | Query='Quick Sort' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,229 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Difference between a stack and a queue' | topics=['Queue', 'Stack']
2026-08-02 14:06:24,253 | INFO     | dsa_chatbot.rag.retriever | Query='Queue' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:06:24,281 | INFO     | dsa_chatbot.rag.retriever | Query='Stack' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,320 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: "Which one is better, Prim's Algorithm or Kruskal's Algorithm, for MST?" | topics=["Kruskal's Algorithm (MST)", "Prim's Algorithm (MST)"]
2026-08-02 14:06:24,354 | INFO     | dsa_chatbot.rag.retriever | Query="Kruskal's Algorithm (MST)" | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:06:24,380 | INFO     | dsa_chatbot.rag.retriever | Query="Prim's Algorithm (MST)" | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:06:24,395 | INFO     | dsa_chatbot.agents.router | Routed to COMPARISON: 'Compare AVL Tree and Binary Search Tree' | topics=['AVL Tree', 'Binary Search', 'Binary Search Tree']
2026-08-02 14:06:24,419 | INFO     | dsa_chatbot.rag.retriever | Query='AVL Tree' | candidates=5 | passed_threshold=5 | threshold=0.45
2026-08-02 14:06:24,444 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,465 | INFO     | dsa_chatbot.rag.retriever | Query='Binary Search Tree' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 14:06:24,489 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'Who won the football World Cup in 2022?'
2026-08-02 14:06:24,503 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: "What's a good recipe for chocolate cake?"
2026-08-02 14:06:24,521 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'What is the capital of France?'
2026-08-02 14:06:24,533 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'Can you explain that again?'
2026-08-02 14:06:24,565 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Merge Sort']); skipping fresh retrieval.
2026-08-02 14:06:24,566 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'Give me another example'
2026-08-02 14:06:24,590 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Merge Sort']); skipping fresh retrieval.
2026-08-02 14:06:24,590 | INFO     | dsa_chatbot.__main__ | Evaluation complete: {'total_questions': 20, 'route_accuracy': 1.0, 'avg_topic_recall': 1.0, 'retrieval_latency_ms_avg': 46.26, 'retrieval_latency_ms_p95': 101.1}
2026-08-02 16:00:13,397 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'explain binary search' | topic=Binary Search
2026-08-02 16:00:14,003 | INFO     | dsa_chatbot.rag.retriever | Query='explain binary search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 16:00:15,631 | INFO     | dsa_chatbot.llm.generate | LLM provider initialized: GroqProvider
2026-08-02 16:00:17,326 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=single_topic | topics=['Binary Search'] | session_id=None
2026-08-02 16:00:56,629 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: '2,3,1,6,5,4 find 5 this using this search step by step'
2026-08-02 16:00:57,493 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=out_of_scope | topics=[] | session_id=None
2026-08-02 16:07:37,423 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'explain binary search' | topic=Binary Search
2026-08-02 16:07:37,480 | INFO     | dsa_chatbot.rag.retriever | Query='explain binary search' | candidates=1 | passed_threshold=1 | threshold=0.45
2026-08-02 16:07:41,129 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:07:51,945 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 get_relevant_context failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 110, in get_relevant_context
    results = self._get_memory().search(query, user_id=user_id, limit=limit)
              ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:07:53,458 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:07:57,115 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 add_interaction failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 93, in add_interaction
    self._get_memory().add(messages, user_id=user_id, infer=self.infer)
    ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:07:57,120 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=1 | route=single_topic | topics=['Binary Search'] | session_id=1
2026-08-02 16:31:21,411 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'explain binary search' | topic=Binary Search
2026-08-02 16:31:21,670 | INFO     | dsa_chatbot.rag.retriever | Query='explain binary search' | candidates=1 | passed_threshold=1 | threshold=-1.00
2026-08-02 16:31:24,341 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:31:29,511 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 get_relevant_context failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 110, in get_relevant_context
    results = self._get_memory().search(query, user_id=user_id, limit=limit)
              ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:31:30,363 | INFO     | dsa_chatbot.llm.generate | LLM provider initialized: GroqProvider
2026-08-02 16:31:31,945 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:31:35,540 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 add_interaction failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 93, in add_interaction
    self._get_memory().add(messages, user_id=user_id, infer=self.infer)
    ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:31:35,545 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=1 | route=single_topic | topics=['Binary Search'] | session_id=2
2026-08-02 16:32:22,442 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'in this array [65,32,43,23,78,96] how will you find 23 using this search'
2026-08-02 16:32:24,207 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Binary Search', 'Linear Search']); skipping fresh retrieval.
2026-08-02 16:32:24,208 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:32:27,835 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 get_relevant_context failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 110, in get_relevant_context
    results = self._get_memory().search(query, user_id=user_id, limit=limit)
              ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:32:29,805 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:32:33,863 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 add_interaction failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 93, in add_interaction
    self._get_memory().add(messages, user_id=user_id, infer=self.infer)
    ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:32:33,869 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=1 | route=followup | topics=[] | session_id=2
2026-08-02 16:33:48,648 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'compare this search with linear search' | topic=Linear Search
2026-08-02 16:33:48,715 | INFO     | dsa_chatbot.rag.retriever | Query='compare this search with linear search' | candidates=1 | passed_threshold=1 | threshold=-1.00
2026-08-02 16:33:48,716 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:33:52,390 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 get_relevant_context failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 110, in get_relevant_context
    results = self._get_memory().search(query, user_id=user_id, limit=limit)
              ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:33:54,095 | INFO     | dsa_chatbot.memory.mem0_client | Initializing mem0 (local chroma + huggingface embedder)...
2026-08-02 16:33:58,206 | ERROR    | dsa_chatbot.memory.mem0_client | mem0 add_interaction failed for user_id=1
Traceback (most recent call last):
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 93, in add_interaction
    self._get_memory().add(messages, user_id=user_id, infer=self.infer)
    ~~~~~~~~~~~~~~~~^^
  File "D:\scratch\chatbot\chatbot\memory\mem0_client.py", line 72, in _get_memory
    self._memory = Memory.from_config(_build_config_dict())
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 59, in from_config
    return cls(config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\memory\main.py", line 37, in __init__
    self.llm = LlmFactory.create(self.config.llm.provider, self.config.llm.config)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\utils\factory.py", line 34, in create
    return llm_instance(base_config)
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\mem0\llms\openai.py", line 28, in __init__
    self.client = OpenAI(api_key=api_key, base_url=base_url)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\scratch\chatbot\chatbot\venv\Lib\site-packages\openai\_client.py", line 135, in __init__
    raise OpenAIError(
        "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    )
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2026-08-02 16:33:58,212 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=1 | route=single_topic | topics=['Linear Search'] | session_id=2
2026-08-02 19:53:48,973 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'how are you'
2026-08-02 19:53:49,894 | INFO     | dsa_chatbot.llm.generate | LLM provider initialized: GroqProvider
2026-08-02 19:53:51,450 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=out_of_scope | topics=[] | session_id=None
2026-08-02 22:34:22,716 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: "explain dijikstra's algorithm" | topic=Dijkstra's Algorithm
2026-08-02 22:34:23,350 | INFO     | dsa_chatbot.rag.retriever | Query="explain dijikstra's algorithm" | candidates=1 | passed_threshold=1 | threshold=-1.00
2026-08-02 22:34:24,785 | INFO     | dsa_chatbot.llm.generate | LLM provider initialized: GroqProvider
2026-08-02 22:34:26,608 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=single_topic | topics=["Dijkstra's Algorithm"] | session_id=None
2026-08-02 22:41:13,334 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'explain bfs' | topic=Breadth-First Search
2026-08-02 22:41:13,572 | INFO     | dsa_chatbot.rag.retriever | Query='explain bfs' | candidates=5 | passed_threshold=5 | threshold=-1.00
2026-08-02 22:41:14,419 | INFO     | dsa_chatbot.llm.generate | LLM provider initialized: GroqProvider
2026-08-02 22:41:15,798 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=single_topic | topics=['Breadth-First Search'] | session_id=None
2026-08-02 22:41:56,906 | INFO     | dsa_chatbot.agents.router | Routed to OUT_OF_SCOPE: 'compare with other graph parsing algorithms'
2026-08-02 22:41:57,470 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=out_of_scope | topics=[] | session_id=None
2026-08-02 22:51:55,471 | INFO     | dsa_chatbot.agents.router | Routed to SINGLE_TOPIC: 'explain dfs' | topic=Depth-First Search
2026-08-02 22:51:55,687 | INFO     | dsa_chatbot.rag.retriever | Query='explain dfs' | candidates=1 | passed_threshold=1 | threshold=-1.00
2026-08-02 22:51:56,559 | INFO     | dsa_chatbot.llm.generate | LLM provider initialized: GroqProvider
2026-08-02 22:51:57,814 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=single_topic | topics=['Depth-First Search'] | session_id=None
2026-08-02 22:52:27,161 | INFO     | dsa_chatbot.agents.router | Routed to FOLLOWUP: 'compare it with other graph traversal algorithms'
2026-08-02 22:52:28,250 | INFO     | dsa_chatbot.agents.followup | Follow-up query reuses existing conversation context (topics=['Depth-First Search', 'Stack']); skipping fresh retrieval.
2026-08-02 22:52:29,862 | INFO     | dsa_chatbot.chat_service | Chat turn complete | user_id=None | route=followup | topics=[] | session_id=None