AnonymousSpottedToad/securityPatternsRecovery / codebase /repos /python /Aquiles-ai_Aquiles-RAG /aquiles /cli /cli.py
| import click | |
| from aquiles.utils import create_config_cli | |
| import os | |
| import importlib.util | |
| from aquiles.utils import checkout | |
| def cli(): | |
| """A sample CLI application.""" | |
| pass | |
| def greet(name): | |
| """Greets the given name.""" | |
| click.echo(f"Hello, {name}!") | |
| def save_configs(): | |
| try: | |
| create_config_cli(False) | |
| except Exception as e: | |
| click.echo(f"โ Error saving configuration: {e}") | |
| 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", | |
| ) | |
| 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) | |
| 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", | |
| ) | |
| 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.