-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathmain.py
More file actions
58 lines (44 loc) · 1.29 KB
/
main.py
File metadata and controls
58 lines (44 loc) · 1.29 KB
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
import argparse
import sys
from redisvl.cli.index import Index
from redisvl.cli.stats import Stats
from redisvl.cli.version import Version
from redisvl.utils.log import get_logger
logger = get_logger(__name__)
def _usage():
usage = [
"rvl <command> [<args>]\n",
"Commands:",
"\tindex Index manipulation (create, delete, etc.)",
"\tmcp Run the RedisVL MCP server",
"\tversion Obtain the version of RedisVL",
"\tstats Obtain statistics about an index",
]
return "\n".join(usage) + "\n"
class RedisVlCLI:
def __init__(self):
parser = argparse.ArgumentParser(
description="Redis Vector Library CLI", usage=_usage()
)
parser.add_argument("command", help="Subcommand to run")
if len(sys.argv) < 2:
parser.print_help()
exit(0)
args = parser.parse_args(sys.argv[1:2])
if not hasattr(self, args.command):
parser.print_help()
exit(0)
getattr(self, args.command)()
def index(self):
Index()
exit(0)
def mcp(self):
from redisvl.cli.mcp import MCP
MCP()
exit(0)
def version(self):
Version()
exit(0)
def stats(self):
Stats()
exit(0)