43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
|
|
"""CLI entry point that launches the evaluation console web server.
|
||
|
|
|
||
|
|
Run alongside the existing main.py CLI; both share the same rag_eval library
|
||
|
|
and the same runs/ artifacts. Example:
|
||
|
|
|
||
|
|
python webmain.py
|
||
|
|
python webmain.py --host 0.0.0.0 --port 8800
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import argparse
|
||
|
|
|
||
|
|
import uvicorn
|
||
|
|
|
||
|
|
|
||
|
|
def parse_args() -> argparse.Namespace:
|
||
|
|
"""Parse host/port/reload options for the console server."""
|
||
|
|
parser = argparse.ArgumentParser(description="Launch the RAGAS evaluation console.")
|
||
|
|
parser.add_argument("--host", default="127.0.0.1", help="Bind host (default 127.0.0.1).")
|
||
|
|
parser.add_argument("--port", type=int, default=8800, help="Bind port (default 8800).")
|
||
|
|
parser.add_argument(
|
||
|
|
"--reload",
|
||
|
|
action="store_true",
|
||
|
|
help="Enable auto-reload for local development.",
|
||
|
|
)
|
||
|
|
return parser.parse_args()
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> None:
|
||
|
|
"""Start uvicorn with the configured application."""
|
||
|
|
args = parse_args()
|
||
|
|
uvicorn.run(
|
||
|
|
"webapp.server:app",
|
||
|
|
host=args.host,
|
||
|
|
port=args.port,
|
||
|
|
reload=args.reload,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|