mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 05:25:04 +00:00
CLI 0.0.14, Uvicorn update and no more [serve] (#12845)
Calls uvicorn directly from cli: Reload works if you define app by import string instead of object. (was doing subprocess in order to get reloading) Version bump to 0.0.14 Remove the need for [serve] for simplicity. Readmes are updated in #12847 to avoid cluttering this PR
This commit is contained in:
@@ -220,8 +220,10 @@ def serve(
|
||||
"""
|
||||
|
||||
app_str = app if app is not None else "app.server:app"
|
||||
port_str = str(port) if port is not None else "8000"
|
||||
host_str = host if host is not None else "127.0.0.1"
|
||||
|
||||
cmd = ["uvicorn", app_str, "--reload", "--port", port_str, "--host", host_str]
|
||||
subprocess.run(cmd)
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(
|
||||
app_str, host=host_str, port=port if port is not None else 8000, reload=True
|
||||
)
|
||||
|
Reference in New Issue
Block a user