To get started with LegalSearch-R1, follow these steps:
Install the required packages using pip:
pip install -r requirements.txtEdit the configuration files ./user/tools/config.yaml to include your OpenAI API key and Serper API key.
openai_api_key: "your_openai_api_key"
serper_api_key: "your_serper_api_key"
For recording the experimental logs, set the Wandb API key in your ./user/train.sh and ./user/evaluate.sh and ./user/evaluate_ood.sh scripts:
export WANDB_API_KEY="your_wandb_api_key"If you want to customize the dataset, please modify ./user/legalsearch_data_process.py and run the data processing script:
python ./user/legalsearch_data_process.pyTo train the LegalSearch-R1 model, run the training script:
bash ./user/train.shTo evaluate the trained model, use the evaluation script:
bash ./user/evaluate.shTo evaluate the model on out-of-domain data, use the following script:
bash ./user/evaluate_ood.shIf you find this work useful in your research, please consider citing: