|
|
||
|---|---|---|
| .. | ||
| findjsonl.sh | ||
| load_to_pentestr1.py | ||
| readme.MD | ||
readme.MD
Convert CAI-logs to walkthroughs to be loaded on Pentest-R1
Overview
This tool converts CAI logs with "history from jsonl format" into pentestR1 "walkthroughs" files. Then is possible to load the CAI walkthroughs on pentest-R1 and convert the files to the final text string for embeddings. The "history from jsonl format" of CAI were generated using the function in dataset.py
messages = cai.sdk.agents.run_to_json.load_history_from_jsonl(jsonl_path, system_prompt=True)
Quick Start
These commands use the paths in dev container where the main repository of cai is in /workspace folder
-
Find the path logs of caiextensions-memory. A logs.txt file will be generated in the current folder.
bash findjsonl.sh --path /path/to/caiextensions/caiextensions-memory -
Convert CAI-messages to walkthroughs with datasets.py. a folder called data with a subfolder called walkthroughs will be created.
python3 /workspace/datasets/dataset.py --logs-path logs.txt --num-logs 5 --walkthroughs*Note: --num-logs optional parameter
-
Run the load function of pentest r1 to visualize the CAI walkthrough in pentest-r1 step format:
python load_to_pentestr1.py