Skip to content

Commit

Permalink
Infra/add license cli (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
langchain-infra authored Oct 19, 2023
1 parent 672720f commit 42da6ea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/langsmith/cli/docker-compose.beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
- PORT=1985
- LANGCHAIN_ENV=local_docker
- LOG_LEVEL=warning
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
ports:
- 1985:1985
depends_on:
Expand Down
1 change: 1 addition & 0 deletions python/langsmith/cli/docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
- PORT=1985
- LANGCHAIN_ENV=local_docker
- LOG_LEVEL=warning
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
ports:
- 1985:1985
depends_on:
Expand Down
3 changes: 3 additions & 0 deletions python/langsmith/cli/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
- LANGCHAIN_ENV=local_docker
- LOG_LEVEL=warning
- OPENAI_API_KEY=${OPENAI_API_KEY}
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
ports:
- 1984:1984
depends_on:
Expand All @@ -26,13 +27,15 @@ services:
environment:
- LANGCHAIN_ENV=local_docker
- LOG_LEVEL=warning
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
entrypoint: "rq worker --with-scheduler -u redis://langchain-redis:6379 --serializer lc_database.queue.serializer.ORJSONSerializer --worker-class lc_database.queue.worker.Worker --connection-class lc_database.queue.connection.RedisRetry --job-class lc_database.queue.job.AsyncJob"
langchain-hub:
image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainhub-backend:latest
environment:
- PORT=1985
- LANGCHAIN_ENV=local_docker
- LOG_LEVEL=warning
- LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
ports:
- 1985:1985
depends_on:
Expand Down
16 changes: 16 additions & 0 deletions python/langsmith/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def start(
auth_token: Optional[str] = None,
stage: Union[Literal["prod"], Literal["dev"], Literal["beta"]] = "prod",
openai_api_key: Optional[str] = None,
langsmith_license_key: str,
) -> None:
"""Run the LangSmith server locally.
Expand All @@ -275,13 +276,19 @@ def start(
If not provided, the OpenAI API Key will be read from the
OPENAI_API_KEY environment variable. If neither are provided,
some features of LangSmith will not be available.
langsmith_license_key: The LangSmith license key to use for LangSmith
If not provided, the LangSmith license key will be read from the
LANGSMITH_LICENSE_KEY environment variable. If neither are provided,
Langsmith will not start up.
"""
if stage == "dev":
os.environ["_LANGSMITH_IMAGE_PREFIX"] = "dev-"
elif stage == "beta":
os.environ["_LANGSMITH_IMAGE_PREFIX"] = "rc-"
if openai_api_key is not None:
os.environ["OPENAI_API_KEY"] = openai_api_key
if langsmith_license_key is not None:
os.environ["LANGSMITH_LICENSE_KEY"] = langsmith_license_key
self.pull(stage=stage)
if expose:
self._start_and_expose(auth_token=auth_token, stage=stage)
Expand Down Expand Up @@ -406,12 +413,21 @@ def main() -> None:
" OPENAI_API_KEY environment variable. If neither are provided,"
" some features of LangSmith will not be available.",
)
server_start_parser.add_argument(
"--langsmith-license-key",
default=os.getenv("LANGSMITH_LICENSE_KEY"),
help="The LangSmith license key to use for LangSmith."
" If not provided, the LangSmith License Key will be read from the"
" LANGSMITH_LICENSE_KEY environment variable. If neither are provided,"
" the Langsmith application will not spin up.",
)
server_start_parser.set_defaults(
func=lambda args: server_command.start(
expose=args.expose,
auth_token=args.ngrok_authtoken,
stage=args.stage,
openai_api_key=args.openai_api_key,
langsmith_license_key=args.langsmith_license_key,
)
)

Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langsmith"
version = "0.0.46"
version = "0.0.47"
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
authors = ["LangChain <support@langchain.dev>"]
license = "MIT"
Expand Down

0 comments on commit 42da6ea

Please sign in to comment.