File size: 874 Bytes
837e221
e4c7240
 
837e221
 
 
e4c7240
837e221
 
 
e4c7240
837e221
e4c7240
 
 
 
 
 
 
 
 
 
837e221
e4c7240
837e221
 
e4c7240
837e221
 
 
 
 
 
 
e4c7240
837e221
e4c7240
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
import argparse
import os

from dotenv import load_dotenv
from tool import WikipediaRAGTool


def main():
    # Load environment variables
    load_dotenv()

    # Set up argument parser
    parser = argparse.ArgumentParser(description="Run Wikipedia RAG Tool")
    parser.add_argument(
        "--query", type=str, required=True, help="Search query for Wikipedia articles"
    )
    parser.add_argument(
        "--dataset-path",
        type=str,
        default="wikipedia-structured-contents",
        help="Path to the Wikipedia dataset",
    )
    args = parser.parse_args()

    # Initialize the tool
    tool = WikipediaRAGTool(dataset_path=args.dataset_path)

    # Run the query
    print(f"\nQuery: {args.query}")
    print("-" * 50)
    result = tool.forward(args.query)
    print(f"Result: {result}")
    print("-" * 50)


if __name__ == "__main__":
    main()