fix some stuff (#12292)

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Harrison Chase 2023-10-26 13:30:36 -07:00 committed by GitHub
parent 6ce276e099
commit 9ce38726a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 17 additions and 3033 deletions

View File

@ -16,8 +16,6 @@ Install a package
`langchain serve add extraction-summary` `langchain serve add extraction-summary`
(Activate virtualenv)
Install langserve Install langserve
`pip install "langserve[all]"` `pip install "langserve[all]"`
@ -38,6 +36,18 @@ app = FastAPI()
add_routes(app, chain) add_routes(app, chain)
``` ```
Set env vars
```shell
export OPENAI_API_KEY=...
```
```shell
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
export LANGCHAIN_API_KEY="<your-api-key>"
export LANGCHAIN_PROJECT="extraction-summary"
```
Run the app Run the app
`python app/server.py` `python app/server.py`

View File

@ -1,3 +1,4 @@
DEFAULT_GIT_REPO = "https://github.com/langchain-ai/langchain.git" DEFAULT_GIT_REPO = "https://github.com/langchain-ai/langchain.git"
DEFAULT_GIT_REF = "langserve-templates"
DEFAULT_GIT_SUBDIRECTORY = "templates" DEFAULT_GIT_SUBDIRECTORY = "templates"
DEFAULT_GIT_REF = "master" DEFAULT_GIT_REF = "master"

View File

@ -30,7 +30,7 @@ def new(
destination_dir = Path.cwd() / name if name != "." else Path.cwd() destination_dir = Path.cwd() / name if name != "." else Path.cwd()
# copy over template from ../package_template # copy over template from ../package_template
project_template_dir = Path(__file__).parent.parent.parent / "package_template" project_template_dir = Path(__file__).parents[1] / "package_template"
shutil.copytree(project_template_dir, destination_dir, dirs_exist_ok=name == ".") shutil.copytree(project_template_dir, destination_dir, dirs_exist_ok=name == ".")
package_name_split = computed_name.split("/") package_name_split = computed_name.split("/")

View File

@ -42,7 +42,7 @@ def new(
Create a new LangServe application. Create a new LangServe application.
""" """
# copy over template from ../project_template # copy over template from ../project_template
project_template_dir = Path(__file__).parent.parent.parent / "project_template" project_template_dir = Path(__file__).parents[1] / "project_template"
destination_dir = Path.cwd() / name if name != "." else Path.cwd() destination_dir = Path.cwd() / name if name != "." else Path.cwd()
shutil.copytree(project_template_dir, destination_dir, dirs_exist_ok=name == ".") shutil.copytree(project_template_dir, destination_dir, dirs_exist_ok=name == ".")

View File

@ -13,8 +13,8 @@ fastapi = "^0.104.0"
sse-starlette = "^1.6.5" sse-starlette = "^1.6.5"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
langchain-cli = {git = "https://github.com/langchain-ai/langchain.git", rev = "erick/cli", subdirectory = "libs/cli"}
poethepoet = "^0.24.1" poethepoet = "^0.24.1"
langchain-cli = ">=0.0.1rc2"
[tool.langserve] [tool.langserve]
export_module = "__package_name__.chain" export_module = "__package_name__.chain"

View File

@ -11,7 +11,7 @@ sse-starlette = "^1.6.5"
tomli-w = "^1.0.0" tomli-w = "^1.0.0"
uvicorn = "^0.23.2" uvicorn = "^0.23.2"
fastapi = "^0.103.2" fastapi = "^0.103.2"
langserve = {git = "https://github.com/langchain-ai/langserve"} langserve = ">=0.0.16"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
poethepoet = "^0.24.1" poethepoet = "^0.24.1"

View File

@ -67,7 +67,6 @@ def parse_dependency_string(package_string: str) -> DependencySource:
raise NotImplementedError("url dependencies are not supported yet") raise NotImplementedError("url dependencies are not supported yet")
else: else:
# it's a default git repo dependency # it's a default git repo dependency
gitstring = DEFAULT_GIT_REPO
subdirectory = str(Path(DEFAULT_GIT_SUBDIRECTORY) / package_string) subdirectory = str(Path(DEFAULT_GIT_SUBDIRECTORY) / package_string)
return DependencySource( return DependencySource(
git=gitstring, ref=DEFAULT_GIT_REF, subdirectory=subdirectory git=gitstring, ref=DEFAULT_GIT_REF, subdirectory=subdirectory

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,6 @@ version = "0.0.3"
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"
include = [
{path="project_template/**/*", format="wheel"},
{path="package_template/**/*", format="wheel"}
]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.8.1,<4.0" python = ">=3.8.1,<4.0"