cli[patch]: release 0.0.22rc0, chat playground (#19614)

This commit is contained in:
Erick Friis
2024-03-26 15:08:56 -07:00
committed by GitHub
parent a3d24bc10b
commit bf8ba00520
5 changed files with 103 additions and 87 deletions

View File

@@ -8,7 +8,7 @@ from langchain_cli.namespaces import integration as integration_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.20"
__version__ = "0.0.22rc0"
app = typer.Typer(no_args_is_help=True, add_completion=False)
app.add_typer(

View File

@@ -13,6 +13,7 @@ from langchain_cli.utils.packages import get_langserve_export, get_package_root
def create_demo_server(
*,
config_keys: Sequence[str] = (),
playground_type: str = "default",
):
"""
Creates a demo server for the current template.
@@ -30,6 +31,7 @@ def create_demo_server(
app,
chain,
config_keys=config_keys,
playground_type=playground_type,
)
except KeyError as e:
raise KeyError("Missing fields from pyproject.toml") from e
@@ -41,3 +43,7 @@ def create_demo_server(
def create_demo_server_configurable():
return create_demo_server(config_keys=["configurable"])
def create_demo_server_chat():
return create_demo_server(playground_type="chat")

View File

@@ -95,12 +95,19 @@ def serve(
Optional[str], typer.Option(help="The host to run the server on")
] = None,
configurable: Annotated[
bool,
Optional[bool],
typer.Option(
"--configurable/--no-configurable",
help="Whether to include a configurable route",
),
] = True,
] = None, # defaults to `not chat_playground`
chat_playground: Annotated[
bool,
typer.Option(
"--chat-playground/--no-chat-playground",
help="Whether to include a chat playground route",
),
] = False,
) -> None:
"""
Starts a demo app for this template.
@@ -115,9 +122,13 @@ def serve(
host_str = host if host is not None else "127.0.0.1"
script = (
"langchain_cli.dev_scripts:create_demo_server"
if not configurable
else "langchain_cli.dev_scripts:create_demo_server_configurable"
"langchain_cli.dev_scripts:create_demo_server_chat_playground"
if chat_playground
else (
"langchain_cli.dev_scripts:create_demo_server_configurable"
if configurable
else "langchain_cli.dev_scripts:create_demo_server"
)
)
import uvicorn