class RemoteHttpRuntime(BaseRuntime):
A runtime that runs functions in a remote HTTP server. You need to run the API server in the remote server first.
Parameters:
8000
) (default: 8000)python3
)def __init__(
self,
host: str,
port: int = 8000,
python_exec: str = 'python3'
):
def build(self):
Returns:
RemoteHttpRuntime: The current runtime.
def _cleanup(self):
Clean up the API server when exiting.
def add(
self,
funcs: Union[FunctionTool, List[FunctionTool]],
entrypoint: str,
redirect_stdout: bool = False,
arguments: Optional[Dict[str, Any]] = None
):
Add a function or list of functions to the runtime.
Parameters:
False
)None
)Returns:
RemoteHttpRuntime: The current runtime.
def ok(self):
Returns:
bool: Whether the API Server is running.
def wait(self, timeout: int = 10):
Wait for the API Server to be ready.
Parameters:
10
) (default: 10)Returns:
bool: Whether the API Server is ready.
def __del__(self):
Clean up the API server when the object is deleted.
def stop(self):
Returns:
RemoteHttpRuntime: The current runtime.
def reset(self):
Returns:
RemoteHttpRuntime: The current runtime.
def docs(self):
Returns:
str: The URL for the API documentation.