Buckets:

download
raw
4.89 kB
import click
from aquiles.utils import create_config_cli
import os
import importlib.util
from aquiles.utils import checkout
@click.group()
def cli():
"""A sample CLI application."""
pass
@cli.command("hello")
@click.option("--name")
def greet(name):
"""Greets the given name."""
click.echo(f"Hello, {name}!")
@cli.command("configs")
def save_configs():
try:
create_config_cli(False)
except Exception as e:
click.echo(f"โŒ Error saving configuration: {e}")
@cli.command("serve")
@click.option("--host", default="0.0.0.0", help="Host where Aquiles-RAG will be executed")
@click.option("--port", type=int, default=5500, help="Port where Aquiles-RAG will be executed")
def serve(host, port):
"""Start the Aquiles-RAG FastAPI server."""
try:
import uvicorn
from aquiles.main import app
create_config_cli()
uvicorn.run(app, host=host, port=port)
finally:
up_to_date, latest = checkout()
if not up_to_date and latest:
click.secho(
f"๐Ÿš€ A new version is available: aquiles-rag=={latest}\n"
f"Update with:\n"
f" pip install aquiles-rag=={latest}",
fg="yellow",
)
@cli.command("deploy")
@click.option("--host", default="0.0.0.0", help="Host where Aquiles-RAG will be executed")
@click.option("--port", type=int, default=5500, help="Port where Aquiles-RAG will be executed")
@click.option("--workers", type=int, default=4, help="Number of uvicorn workers when casting Aquiles-RAG")
@click.argument("config", type=click.Path(exists=True))
def deploy_command(host, port, config, workers):
up_to_date, latest = checkout()
if not up_to_date and latest:
click.secho(
f"๐Ÿš€ A new version is available: aquiles-rag=={latest}\n"
f" Update with:\n"
f" pip install aquiles-rag=={latest}",
fg="yellow",
)
import subprocess
module_name = os.path.splitext(os.path.basename(config))[0]
spec = importlib.util.spec_from_file_location(module_name, config)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
if hasattr(module, "run"):
module.run()
else:
click.echo("The file does not have a 'run()' function")
cmd = [
"uvicorn",
"aquiles.main:app",
"--host", str(host),
"--port", str(port),
"--workers", str(workers)
]
subprocess.run(cmd, check=True)
@cli.command("deploy-mcp")
@click.option("--host", default="0.0.0.0", help="Host where Aquiles-RAG-MCP will be executed")
@click.option("--port", type=int, default=5500, help="Port where Aquiles-RAG-MCP will be executed")
@click.option("--transport", default="sse", help="Transport protocol")
@click.argument("config", type=click.Path(exists=True))
def deploy_command_mcp(host, port, transport, config):
up_to_date, latest = checkout()
if not up_to_date and latest:
click.secho(
f"๐Ÿš€ A new version is available: aquiles-rag=={latest}\n"
f" Update with:\n"
f" pip install aquiles-rag=={latest}",
fg="yellow",
)
module_name = os.path.splitext(os.path.basename(config))[0]
spec = importlib.util.spec_from_file_location(module_name, config)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
if hasattr(module, "run"):
module.run()
else:
click.echo("The file does not have a 'run()' function")
try:
from aquiles.utils import run_mcp_serve
run_mcp_serve(host, port, transport, click)
finally:
up_to_date, latest = checkout()
if not up_to_date and latest:
click.secho(
f"๐Ÿš€ A new version is available: aquiles-rag=={latest}\n"
f"Update with:\n"
f" pip install aquiles-rag=={latest}",
fg="yellow",
)
@cli.command("mcp-serve")
@click.option("--host", default="0.0.0.0", help="Host where Aquiles-RAG will be executed")
@click.option("--port", type=int, default=5500, help="Port where Aquiles-RAG will be executed")
@click.option("--transport", default="sse", help="Transport protocol")
def mcp_serve(host, port, transport):
"""Start the Aquiles-RAG MCP server."""
try:
from aquiles.utils import run_mcp_serve
create_config_cli()
run_mcp_serve(host, port, transport, click)
finally:
up_to_date, latest = checkout()
if not up_to_date and latest:
click.secho(
f"๐Ÿš€ A new version is available: aquiles-rag=={latest}\n"
f"Update with:\n"
f" pip install aquiles-rag=={latest}",
fg="yellow",
)
if __name__ == "__main__":
cli()

Xet Storage Details

Size:
4.89 kB
ยท
Xet hash:
0336f315602bc454f8deafe71e136e4c01c8b0b7bfa942462f5b3acd9bc0e3df

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.