Skip to content

[KDD'2026] "VideoRAG: Chat with Your Videos"

make llm module configurable in videorag_expiriment

Gerald Hewes9e2c229910f7
diff --git a/longervideos/videorag_experiment.py b/longervideos/videorag_experiment.py
index 1c7067a..99e15a8 100644
--- a/longervideos/videorag_experiment.py
+++ b/longervideos/videorag_experiment.py
@@ -15,6 +15,7 @@ import argparse
parser = argparse.ArgumentParser(description="Set sub-category and CUDA device.")
parser.add_argument('--collection', type=str, default='4-rag-lecture')
parser.add_argument('--cuda', type=str, default='0')
+parser.add_argument('--config', type=str, choices=['openai', 'azure', 'ollama'], default='openai')
args = parser.parse_args()
sub_category = args.collection
@@ -24,6 +25,14 @@ os.environ["OPENAI_API_KEY"] = ""
from videorag._llm import openai_config, azure_openai_config, ollama_config
from videorag.videorag import VideoRAG, QueryParam
+config_map = {
+ 'openai': openai_config,
+ 'azure': azure_openai_config,
+ 'ollama': ollama_config
+}
+
+llm_config = config_map[args.config]
+
if __name__ == '__main__':
multiprocessing.set_start_method('spawn')
@@ -31,14 +40,14 @@ if __name__ == '__main__':
video_base_path = f'longervideos/{sub_category}/videos/'
video_files = sorted(os.listdir(video_base_path))
video_paths = [os.path.join(video_base_path, f) for f in video_files]
- videorag = VideoRAG(llm=ollama_config, working_dir=f"./videorag-workdir/{sub_category}")
+ videorag = VideoRAG(llm=llm_config, working_dir=f"./videorag-workdir/{sub_category}")
videorag.insert_video(video_path_list=video_paths)
## inference
with open(f'longervideos/dataset.json', 'r') as f:
longervideos = json.load(f)
- videorag = VideoRAG(llm=ollama_config, working_dir=f"./videorag-workdir/{sub_category}")
+ videorag = VideoRAG(llm=llm_config, working_dir=f"./videorag-workdir/{sub_category}")
videorag.load_caption_model(debug=False)
answer_folder = f'./videorag-answers/{sub_category}'