Skip to content

Commit

Permalink
cli[patch]: release 0.0.22rc0, chat playground (langchain-ai#19614)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Mar 26, 2024
1 parent a3d24bc commit bf8ba00
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 87 deletions.
2 changes: 1 addition & 1 deletion libs/cli/langchain_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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(
Expand Down
6 changes: 6 additions & 0 deletions libs/cli/langchain_cli/dev_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
def create_demo_server(
*,
config_keys: Sequence[str] = (),
playground_type: str = "default",
):
"""
Creates a demo server for the current template.
Expand All @@ -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
Expand All @@ -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")
21 changes: 16 additions & 5 deletions libs/cli/langchain_cli/namespaces/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
Loading

0 comments on commit bf8ba00

Please sign in to comment.