Confirm sys.path includes current dir for app serve (#12851)

- Make sure sys.path is set properly for langchain app serve
- bump
This commit is contained in:
Erick Friis 2023-11-03 11:37:20 -07:00 committed by GitHub
parent 1bc35f61cb
commit 7db49d3842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -6,7 +6,7 @@ from typing_extensions import Annotated
from langchain_cli.namespaces import app as app_namespace from langchain_cli.namespaces import app as app_namespace
from langchain_cli.namespaces import template as template_namespace from langchain_cli.namespaces import template as template_namespace
__version__ = "0.0.14" __version__ = "0.0.15"
app = typer.Typer(no_args_is_help=True, add_completion=False) app = typer.Typer(no_args_is_help=True, add_completion=False)
app.add_typer( app.add_typer(

View File

@ -4,6 +4,7 @@ Manage LangChain apps
import shutil import shutil
import subprocess import subprocess
import sys
from pathlib import Path from pathlib import Path
from typing import Dict, List, Optional, Tuple from typing import Dict, List, Optional, Tuple
@ -219,6 +220,9 @@ def serve(
Starts the LangServe app. Starts the LangServe app.
""" """
# add current dir as first entry of path
sys.path.append(str(Path.cwd()))
app_str = app if app is not None else "app.server:app" app_str = app if app is not None else "app.server:app"
host_str = host if host is not None else "127.0.0.1" host_str = host if host is not None else "127.0.0.1"

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langchain-cli" name = "langchain-cli"
version = "0.0.14" version = "0.0.15"
description = "CLI for interacting with LangChain" description = "CLI for interacting with LangChain"
authors = ["Erick Friis <erick@langchain.dev>"] authors = ["Erick Friis <erick@langchain.dev>"]
readme = "README.md" readme = "README.md"