Skip to content

Commit

Permalink
Merge branch 'main' into Feature/#959
Browse files Browse the repository at this point in the history
  • Loading branch information
vkehfdl1 committed Dec 3, 2024
2 parents 42df1fc + cf2df95 commit 476a510
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autorag/autorag/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.11
0.3.11rc1
7 changes: 5 additions & 2 deletions autorag/autorag/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,17 @@ def evaluate(config, qa_data_path, corpus_data_path, project_dir, skip_validatio
@click.option(
"--project_dir", help="Path to project directory.", type=str, default=None
)
def run_api(config_path, host, port, trial_dir, project_dir):
@click.option(
"--remote", help="Run the API server in remote mode.", type=bool, default=False
)
def run_api(config_path, host, port, trial_dir, project_dir, remote: bool):
if trial_dir is None:
runner = ApiRunner.from_yaml(config_path, project_dir=project_dir)
else:
runner = ApiRunner.from_trial_folder(trial_dir)
logger.info(f"Running API server at {host}:{port}...")
nest_asyncio.apply()
runner.run_api_server(host, port)
runner.run_api_server(host, port, remote=remote)


@click.command()
Expand Down
3 changes: 2 additions & 1 deletion autorag/autorag/deploy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Dict, Optional, List, Union, Literal

import pandas as pd
from pyngrok import ngrok
from quart import Quart, request, jsonify
from quart.helpers import stream_with_context
from pydantic import BaseModel, ValidationError
Expand Down Expand Up @@ -255,6 +254,8 @@ def run_api_server(
"""
logger.info(f"Run api server at {host}:{port}")
if remote:
from pyngrok import ngrok

http_tunnel = ngrok.connect(str(port), "http")
public_url = http_tunnel.public_url
logger.info(f"Public API URL: {public_url}")
Expand Down

0 comments on commit 476a510

Please sign in to comment.