From 5852504667083a01b10fbb280473e2d69cc9870a Mon Sep 17 00:00:00 2001 From: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:09:38 -0700 Subject: [PATCH 1/2] Add js license bits --- js/src/cli/docker-compose.beta.yaml | 1 + js/src/cli/docker-compose.dev.yaml | 2 ++ js/src/cli/docker-compose.yaml | 3 +++ 3 files changed, 6 insertions(+) diff --git a/js/src/cli/docker-compose.beta.yaml b/js/src/cli/docker-compose.beta.yaml index 3b4796ce3..8d5ecc31f 100644 --- a/js/src/cli/docker-compose.beta.yaml +++ b/js/src/cli/docker-compose.beta.yaml @@ -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: diff --git a/js/src/cli/docker-compose.dev.yaml b/js/src/cli/docker-compose.dev.yaml index 90541d585..6e480093f 100644 --- a/js/src/cli/docker-compose.dev.yaml +++ b/js/src/cli/docker-compose.dev.yaml @@ -1,11 +1,13 @@ version: '3' services: + # TODO: Move to the regular docker-compose.yaml once deployed 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: diff --git a/js/src/cli/docker-compose.yaml b/js/src/cli/docker-compose.yaml index b5824a798..7bd152d44 100644 --- a/js/src/cli/docker-compose.yaml +++ b/js/src/cli/docker-compose.yaml @@ -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: @@ -26,6 +27,7 @@ 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 @@ -33,6 +35,7 @@ services: - PORT=1985 - LANGCHAIN_ENV=local_docker - LOG_LEVEL=warning + - LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY} ports: - 1985:1985 depends_on: From 635ad84aa9f645076a7dca894cd724534d46e200 Mon Sep 17 00:00:00 2001 From: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:37:41 -0700 Subject: [PATCH 2/2] Add license key to js --- js/src/cli/main.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/js/src/cli/main.ts b/js/src/cli/main.ts index 873f9f94f..099d5c93b 100644 --- a/js/src/cli/main.ts +++ b/js/src/cli/main.ts @@ -1,13 +1,15 @@ +import * as child_process from "child_process"; import * as fs from "fs"; import * as path from "path"; import * as util from "util"; -import { Command } from "commander"; -import * as child_process from "child_process"; + import { getLangChainEnvVars, getRuntimeEnvironment, setEnvironmentVariable, } from "../utils/env.js"; + +import { Command } from "commander"; import { spawn } from "child_process"; const currentFileName = __filename; @@ -330,6 +332,12 @@ const startCommand = new Command("start") " from the OPENAI_API_KEY environment variable. If neither are provided," + " some features of LangSmith will not be available." ) + .option( + "--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, the Langsmith application will not spin up." + ) .action(async (args) => { const smith = await SmithCommand.create(); if (args.stage === "dev") { @@ -340,6 +348,9 @@ const startCommand = new Command("start") if (args.openaiApiKey) { setEnvironmentVariable("OPENAI_API_KEY", args.openaiApiKey); } + if (args.langsmithLicenseKey) { + setEnvironmentVariable("LANGSMITH_LICENSE_KEY", args.langsmithLicenseKey); + } await smith.pull({ stage: args.stage }); if (args.expose) { await smith.startAndExpose(args.ngrokAuthtoken, args.stage);