File size: 26,554 Bytes
0d0811c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "874cd58e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "workding dir: /home/inflaton/code/chat-with-orca-2\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import sys\n",
    "from pathlib import Path\n",
    "\n",
    "workding_dir = str(Path.cwd().parent)\n",
    "os.chdir(workding_dir)\n",
    "sys.path.append(workding_dir)\n",
    "print(\"workding dir:\", workding_dir)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "19f967ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
    "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"microsoft/Orca-2-7b\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "a6d96660",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
      "Running on:  Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
      "MPS is NOT available\n",
      "CUDA is  available\n",
      "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
      "CUDA is available, we have found  1  GPU(s)\n",
      "NVIDIA GeForce RTX 4090\n",
      "CUDA version: 12.1\n",
      "hf_embeddings_device_type: cuda:0\n",
      "hf_pipeline_device_type: cuda:0\n",
      "load INSTRUCTOR_Transformer\n",
      "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
      "  return self.fget.__get__(instance, owner)()\n",
      "max_seq_length  512\n",
      "Completed in 0.428s\n",
      "Load index from ./data/faiss_1024_512/ with FAISS\n",
      "Completed in 0.013s\n",
      "initializing LLM: huggingface\n",
      "  hf_pipeline_device_type: cuda:0\n",
      "     load_quantized_model: None\n",
      "              torch_dtype: torch.bfloat16\n",
      "                 n_threds: 4\n",
      "            loading model: microsoft/Orca-2-7b\n",
      "            HF auth token: None\n",
      "       repetition_penalty: 1.05\n",
      "Loading checkpoint shards: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3/3 [00:08<00:00,  2.71s/it]\n",
      "initialization complete\n",
      "Completed in 12.199s\n",
      "\n",
      "Question: What's PCI DSS?\n",
      "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
      "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 33.511s\n",
      "\n",
      "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
      "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
      "What are the main differences between PCI DSS version 3.2.1 and version 4.0?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 4.836s\n",
      "\n",
      "Question: new requirements for vulnerability assessments\n",
      "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.')]}\n",
      "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\n",
      "\n",
      "- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\n",
      "- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\n",
      "- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 4.869s\n",
      "\n",
      "Question: more on penetration testing\n",
      "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.'), ('new requirements for vulnerability assessments', 'The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\\n\\n- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\\n- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\\n- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.')]}\n",
      "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "The new requirements for penetration testing in PCI DSS version 4.0 include defining a penetration testing methodology, covering the entire CDE perimeter and critical systems, testing from both inside and outside the network, testing to validate any segmentation and scope-reduction controls, and performing application-layer and network-layer penetration testing.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 2.903s\n",
      "Total time used: 46.121 s\n",
      "Number of tokens generated: 536\n",
      "Average generation speed: 11.622 tokens/s\n",
      "CPU times: user 561 ms, sys: 240 ms, total: 801 ms\n",
      "Wall time: 1min 1s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "os.environ[\"HF_RP\"] = \"1.05\"\n",
    "!python qa_chain_test.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8a022a7b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
      "Running on:  Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
      "MPS is NOT available\n",
      "CUDA is  available\n",
      "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
      "CUDA is available, we have found  1  GPU(s)\n",
      "NVIDIA GeForce RTX 4090\n",
      "CUDA version: 12.1\n",
      "hf_embeddings_device_type: cuda:0\n",
      "hf_pipeline_device_type: cuda:0\n",
      "load INSTRUCTOR_Transformer\n",
      "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
      "  return self.fget.__get__(instance, owner)()\n",
      "max_seq_length  512\n",
      "Completed in 0.503s\n",
      "Load index from ./data/faiss_1024_512/ with FAISS\n",
      "Completed in 0.016s\n",
      "initializing LLM: huggingface\n",
      "  hf_pipeline_device_type: cuda:0\n",
      "     load_quantized_model: None\n",
      "              torch_dtype: torch.bfloat16\n",
      "                 n_threds: 4\n",
      "            loading model: microsoft/Orca-2-7b\n",
      "            HF auth token: None\n",
      "       repetition_penalty: 1.1\n",
      "Loading checkpoint shards: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3/3 [00:13<00:00,  4.58s/it]\n",
      "initialization complete\n",
      "Completed in 17.662s\n",
      "\n",
      "Question: What's PCI DSS?\n",
      "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
      "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 3.039s\n",
      "\n",
      "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
      "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
      "What are the main differences between PCI DSS versions 3.2.1 and 4.0?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 1.769s\n",
      "\n",
      "Question: new requirements for vulnerability assessments\n",
      "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.')]}\n",
      "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some of them include:\n",
      "\n",
      "1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\n",
      "2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\n",
      "3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\n",
      "4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\n",
      "5. Requirement 11.3.1.1 and 11.3.1.2, which require internal vulnerability scans to be performed using authenticated scanning and to manage all applicable vulnerabilities, including those not ranked as high-risk or critical.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 7.887s\n",
      "\n",
      "Question: more on penetration testing\n",
      "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.'), ('new requirements for vulnerability assessments', 'There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some of them include:\\n\\n1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\\n2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\\n3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\\n4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\\n5. Requirement 11.3.1.1 and 11.3.1.2, which require internal vulnerability scans to be performed using authenticated scanning and to manage all applicable vulnerabilities, including those not ranked as high-risk or critical.')]}\n",
      "What are some key differences between penetration testing and vulnerability assessments in the context of PCI DSS?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Some key differences between penetration testing and vulnerability assessments in the context of PCI DSS include:\n",
      "\n",
      "1. Scope: Penetration testing involves simulated attacks on the network and systems to identify vulnerabilities that could be exploited, while vulnerability assessments focus on identifying and classifying existing vulnerabilities in the system.\n",
      "\n",
      "2. Methodology: Penetration testing uses a more aggressive approach, attempting to exploit vulnerabilities and gain access to sensitive data or systems, whereas vulnerability assessments use a more passive approach, scanning for known vulnerabilities without actually exploiting them.\n",
      "\n",
      "3. Frequency: Penetration testing is typically conducted annually, while vulnerability assessments may be conducted more frequently, depending on the organization's risk profile and compliance requirements.\n",
      "\n",
      "4. Qualified individuals: Penetration testing requires a qualified individual to perform the test, while vulnerability assessments can be performed by internal staff or external third parties, as long as they have the necessary skills and knowledge.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 7.499s\n",
      "Total time used: 20.195 s\n",
      "Number of tokens generated: 652\n",
      "Average generation speed: 32.286 tokens/s\n",
      "CPU times: user 380 ms, sys: 213 ms, total: 593 ms\n",
      "Wall time: 41.7 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "os.environ[\"HF_RP\"] = \"1.10\"\n",
    "!python qa_chain_test.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "db48dcc4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
      "Running on:  Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
      "MPS is NOT available\n",
      "CUDA is  available\n",
      "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
      "CUDA is available, we have found  1  GPU(s)\n",
      "NVIDIA GeForce RTX 4090\n",
      "CUDA version: 12.1\n",
      "hf_embeddings_device_type: cuda:0\n",
      "hf_pipeline_device_type: cuda:0\n",
      "load INSTRUCTOR_Transformer\n",
      "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
      "  return self.fget.__get__(instance, owner)()\n",
      "max_seq_length  512\n",
      "Completed in 0.456s\n",
      "Load index from ./data/faiss_1024_512/ with FAISS\n",
      "Completed in 0.016s\n",
      "initializing LLM: huggingface\n",
      "  hf_pipeline_device_type: cuda:0\n",
      "     load_quantized_model: None\n",
      "              torch_dtype: torch.bfloat16\n",
      "                 n_threds: 4\n",
      "            loading model: microsoft/Orca-2-7b\n",
      "            HF auth token: None\n",
      "       repetition_penalty: 1.15\n",
      "Loading checkpoint shards: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3/3 [00:01<00:00,  1.59it/s]\n",
      "initialization complete\n",
      "Completed in 6.345s\n",
      "\n",
      "Question: What's PCI DSS?\n",
      "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
      "PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 3.256s\n",
      "\n",
      "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
      "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.')]}\n",
      "How has the latest version of PCI DSS, version 4.0, differed from the previous version, 3.2.1?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "The latest version of PCI DSS, version 4.0, differs from the previous version, 3.2.1, by including updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 2.222s\n",
      "\n",
      "Question: new requirements for vulnerability assessments\n",
      "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The latest version of PCI DSS, version 4.0, differs from the previous version, 3.2.1, by including updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.')]}\n",
      "What are some new requirements for vulnerability assessments introduced in PCI DSS version 4.0?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Some new requirements for vulnerability assessments introduced in PCI DSS version 4.0 include:\n",
      "\n",
      "- Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (Requirement 10.4.2.1)\n",
      "- Ensuring failures of critical security control systems are detected, alerted, and addressed promptly (Requirement 10.7.2), and responded to promptly (Requirement 10.7.3)\n",
      "- Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (Requirement 11.1.2)\n",
      "- Managing all applicable vulnerabilities not ranked as high-risk or critical (Requirement 11.3.1.1)\n",
      "- Performing internal vulnerability scans via authenticated scanning (Requirement 11.3.1.2)\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 5.732s\n",
      "\n",
      "Question: more on penetration testing\n",
      "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The latest version of PCI DSS, version 4.0, differs from the previous version, 3.2.1, by including updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.'), ('new requirements for vulnerability assessments', 'Some new requirements for vulnerability assessments introduced in PCI DSS version 4.0 include:\\n\\n- Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (Requirement 10.4.2.1)\\n- Ensuring failures of critical security control systems are detected, alerted, and addressed promptly (Requirement 10.7.2), and responded to promptly (Requirement 10.7.3)\\n- Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (Requirement 11.1.2)\\n- Managing all applicable vulnerabilities not ranked as high-risk or critical (Requirement 11.3.1.1)\\n- Performing internal vulnerability scans via authenticated scanning (Requirement 11.3.1.2)')]}\n",
      "What are some best practices for conducting effective penetration tests?\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Some best practices for conducting effective penetration tests include performing the testing according to a defined methodology, ensuring the tester has organizational independence, validating segmentation and scope reduction controls, testing both inside and outside the network, considering the latest threats and vulnerabilities, and documenting the approach to addressing risks identified during the testing.\n",
      "\n",
      "\n",
      "\n",
      "<on_llm_end>\n",
      "\n",
      "\n",
      "Completed in 2.461s\n",
      "Total time used: 13.672 s\n",
      "Number of tokens generated: 454\n",
      "Average generation speed: 33.208 tokens/s\n",
      "CPU times: user 322 ms, sys: 44.4 ms, total: 366 ms\n",
      "Wall time: 23.7 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "os.environ[\"HF_RP\"] = \"1.15\"\n",
    "!python qa_chain_test.py"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}