Will run all CI because of _test change, but future PRs against CLI will
only trigger the new CLI one

Has a bunch of file changes related to formatting/linting.

No mypy yet - coming soon
This commit is contained in:
Erick Friis
2023-10-26 17:01:31 -07:00
committed by GitHub
parent 231d553824
commit 4db8d82c55
14 changed files with 150 additions and 48 deletions

View File

@@ -1,10 +1,10 @@
import typer
import subprocess
from typing import Optional
import typer
from typing_extensions import Annotated
from langchain_cli.namespaces import hub
from langchain_cli.namespaces import serve
from langchain_cli.namespaces import hub, serve
app = typer.Typer(no_args_is_help=True, add_completion=False)
app.add_typer(hub.hub, name="hub", help=hub.__doc__)

View File

@@ -4,6 +4,7 @@ Development Scripts for Hub Packages
from fastapi import FastAPI
from langserve.packages import add_package_route
from langchain_cli.utils.packages import get_package_root

View File

@@ -2,13 +2,14 @@
Manage installable hub packages.
"""
import typer
from typing import Optional
from typing_extensions import Annotated
from pathlib import Path
import re
import shutil
import subprocess
import re
from pathlib import Path
from typing import Optional
import typer
from typing_extensions import Annotated
hub = typer.Typer(no_args_is_help=True, add_completion=False)

View File

@@ -2,21 +2,23 @@
Manage LangServe application projects.
"""
import typer
from typing import Optional, List
from typing_extensions import Annotated
from pathlib import Path
import shutil
import subprocess
from pathlib import Path
from typing import List, Optional
import tomli
import typer
from langserve.packages import get_langserve_export, list_packages
from typing_extensions import Annotated
from langchain_cli.utils.events import create_events
from langchain_cli.utils.git import (
copy_repo,
update_repo,
parse_dependency_string,
update_repo,
)
from langchain_cli.utils.packages import get_package_root
from langchain_cli.utils.events import create_events
from langserve.packages import list_packages, get_langserve_export
import tomli
REPO_DIR = Path(typer.get_app_dir("langchain")) / "git_repos"
@@ -101,7 +103,8 @@ def add(
if len(repo) != 0:
if len(dependencies) != 0:
raise typer.BadParameter(
"Cannot specify both repo and dependencies. Please specify one or the other."
"Cannot specify both repo and dependencies. "
"Please specify one or the other."
)
dependencies = [f"git+https://github.com/{r}" for r in repo]
@@ -144,7 +147,8 @@ def add(
# detect name conflict
if langserve_export["package_name"] in installed_names:
typer.echo(
f"Package with name {langserve_export['package_name']} already installed. Skipping...",
f"Package with name {langserve_export['package_name']} already "
"installed. Skipping...",
)
continue
@@ -154,7 +158,8 @@ def add(
destination_path = package_dir / inner_api_path
if destination_path.exists():
typer.echo(
f"Endpoint {langserve_export['package_name']} already exists. Skipping...",
f"Endpoint {langserve_export['package_name']} already exists. "
"Skipping...",
)
continue
copy_repo(source_path, destination_path)

View File

@@ -1,6 +1,5 @@
from langchain.prompts import ChatPromptTemplate
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
_prompt = ChatPromptTemplate.from_messages(
[

View File

@@ -1,6 +1,7 @@
import urllib3
import json
from typing import List, Dict, Any, Optional, TypedDict
from typing import Any, Dict, List, Optional, TypedDict
import urllib3
WRITE_KEY = "310apTK0HUFl4AOv"

View File

@@ -1,15 +1,16 @@
from typing import Optional, TypedDict
from pathlib import Path
import shutil
import hashlib
import re
import shutil
from pathlib import Path
from typing import Optional, TypedDict
from git import Repo
from langchain_cli.constants import (
DEFAULT_GIT_REF,
DEFAULT_GIT_REPO,
DEFAULT_GIT_SUBDIRECTORY,
DEFAULT_GIT_REF,
)
import hashlib
from git import Repo
class DependencySource(TypedDict):

View File

@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Set, Optional
from typing import Optional, Set
def get_package_root(cwd: Optional[Path] = None) -> Path: