cli updates, 0.0.16 (#13034)

- confirm flags, serve detection
- 0.0.16
- always gen code
- pip bool
This commit is contained in:
Erick Friis
2023-11-08 07:47:30 -08:00
committed by GitHub
parent 1f27104626
commit a9b70baef9
3 changed files with 75 additions and 42 deletions

View File

@@ -5,8 +5,9 @@ from typing_extensions import Annotated
from langchain_cli.namespaces import app as app_namespace
from langchain_cli.namespaces import template as template_namespace
from langchain_cli.utils.packages import get_langserve_export, get_package_root
__version__ = "0.0.15"
__version__ = "0.0.16"
app = typer.Typer(no_args_is_help=True, add_completion=False)
app.add_typer(
@@ -49,11 +50,17 @@ def serve(
Start the LangServe app, whether it's a template or an app.
"""
# try starting template package, if error, try langserve
# see if is a template
try:
template_namespace.serve(port=port, host=host)
project_dir = get_package_root()
pyproject = project_dir / "pyproject.toml"
get_langserve_export(pyproject)
except KeyError:
# not a template
app_namespace.serve(port=port, host=host)
else:
# is a template
template_namespace.serve(port=port, host=host)
if __name__ == "__main__":