Skip to content

The agent engineering platform.

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

Erick Friis7db49d3842d0
diff --git a/libs/cli/langchain_cli/cli.py b/libs/cli/langchain_cli/cli.py
index 17ce601043..3317ff0160 100644
--- a/libs/cli/langchain_cli/cli.py
+++ b/libs/cli/langchain_cli/cli.py
@@ -6,7 +6,7 @@ from typing_extensions import Annotated
from langchain_cli.namespaces import app as app_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.add_typer(
diff --git a/libs/cli/langchain_cli/namespaces/app.py b/libs/cli/langchain_cli/namespaces/app.py
index ef971fce6e..69bbfe4bcf 100644
--- a/libs/cli/langchain_cli/namespaces/app.py
+++ b/libs/cli/langchain_cli/namespaces/app.py
@@ -4,6 +4,7 @@ Manage LangChain apps
import shutil
import subprocess
+import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
@@ -219,6 +220,9 @@ def serve(
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"
host_str = host if host is not None else "127.0.0.1"
diff --git a/libs/cli/pyproject.toml b/libs/cli/pyproject.toml
index d678a48a85..4dad556919 100644
--- a/libs/cli/pyproject.toml
+++ b/libs/cli/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langchain-cli"
-version = "0.0.14"
+version = "0.0.15"
description = "CLI for interacting with LangChain"
authors = ["Erick Friis <[email protected]>"]
readme = "README.md"