From c09fe78ce466bbe1f44636ab582b401ab3c574a7 Mon Sep 17 00:00:00 2001 From: isaac hershenson Date: Thu, 9 Jan 2025 18:26:52 -0800 Subject: [PATCH] wip --- .../create_account_api_key.mdx | 8 ++------ .../manage_organization_by_api.mdx | 8 ++++---- .../how_to_guides/evaluate_with_attachments.mdx | 4 ++-- docs/evaluation/how_to_guides/unit_testing.mdx | 10 +++++----- .../upload_existing_experiments.mdx | 2 +- docs/evaluation/index.mdx | 4 ++-- docs/evaluation/tutorials/agents.mdx | 4 ++-- docs/evaluation/tutorials/backtesting.mdx | 8 ++++---- docs/evaluation/tutorials/rag.mdx | 8 ++++---- .../how_to_guides/tracing/add_metadata_tags.mdx | 2 +- .../how_to_guides/tracing/annotate_code.mdx | 10 +++++----- .../tracing/log_traces_to_project.mdx | 10 +++++----- .../tracing/mask_inputs_outputs.mdx | 6 +++--- .../how_to_guides/tracing/sample_traces.mdx | 4 ++-- .../how_to_guides/tracing/toggle_tracing.mdx | 2 +- .../tracing/trace_with_instructor.mdx | 2 +- .../tracing/trace_with_langchain.mdx | 14 +++++++------- .../tracing/trace_with_vercel_ai_sdk.mdx | 6 +++--- .../tracing/trace_without_env_vars.mdx | 10 +++++----- docs/observability/tutorials/observability.mdx | 6 +++--- .../prompts/manage_prompts_programatically.mdx | 4 ++-- .../tutorials/optimize_classifier.mdx | 2 +- docs/self_hosting/usage.mdx | 16 +++------------- 23 files changed, 68 insertions(+), 82 deletions(-) diff --git a/docs/administration/how_to_guides/organization_management/create_account_api_key.mdx b/docs/administration/how_to_guides/organization_management/create_account_api_key.mdx index 22c32488..1f7b7a94 100644 --- a/docs/administration/how_to_guides/organization_management/create_account_api_key.mdx +++ b/docs/administration/how_to_guides/organization_management/create_account_api_key.mdx @@ -34,12 +34,8 @@ The API key will be shown only once, so make sure to copy it and store it in a s ## Configure the SDK -You may set the following environment variables in addition to `LANGCHAIN_API_KEY` (or equivalently `LANGSMITH_API_KEY`). +You may set the following environment variables in addition to `LANGSMITH_API_KEY`. These are only required if using the EU instance. -:::info -`LANGCHAIN_HUB_API_URL` is only required if using the legacy langchainhub sdk -::: -`LANGCHAIN_ENDPOINT=` -`LANGCHAIN_HUB_API_URL=` +`LANGSMITH_ENDPOINT=` diff --git a/docs/administration/how_to_guides/organization_management/manage_organization_by_api.mdx b/docs/administration/how_to_guides/organization_management/manage_organization_by_api.mdx index 558f52f2..6d099d79 100644 --- a/docs/administration/how_to_guides/organization_management/manage_organization_by_api.mdx +++ b/docs/administration/how_to_guides/organization_management/manage_organization_by_api.mdx @@ -174,10 +174,10 @@ import requests def main(): - api_key = os.environ["LANGCHAIN_API_KEY"] - # LANGCHAIN_ORGANIZATION_ID is not a standard environment variable in the SDK, just used for this example - organization_id = os.environ["LANGCHAIN_ORGANIZATION_ID"] - base_url = os.environ.get("LANGCHAIN_ENDPOINT") or "https://api.smith.langchain.com" + api_key = os.environ["LANGSMITH_API_KEY"] + # LANGSMITH_ORGANIZATION_ID is not a standard environment variable in the SDK, just used for this example + organization_id = os.environ["LANGSMITH_ORGANIZATION_ID"] + base_url = os.environ.get("LANGSMITH_ENDPOINT") or "https://api.smith.langchain.com" headers = { "Content-Type": "application/json", "X-API-Key": api_key, diff --git a/docs/evaluation/how_to_guides/evaluate_with_attachments.mdx b/docs/evaluation/how_to_guides/evaluate_with_attachments.mdx index 7ba65cda..0f0bf67c 100644 --- a/docs/evaluation/how_to_guides/evaluate_with_attachments.mdx +++ b/docs/evaluation/how_to_guides/evaluate_with_attachments.mdx @@ -48,7 +48,7 @@ png_url = "https://www.w3.org/Graphics/PNG/nurbcup2si.png"\n pdf_bytes = requests.get(pdf_url).content wav_bytes = requests.get(wav_url).content png_bytes = requests.get(png_url).content\n -# Define the LANGCHAIN_API_KEY environment variable with your API key +# Define the LANGSMITH_API_KEY environment variable with your API key langsmith_client = Client()\n dataset_name = "attachment-test-dataset:" + str(uuid.uuid4())[0:8]\n dataset = langsmith_client.create_dataset( @@ -104,7 +104,7 @@ if (!response.ok) { const pdfArrayBuffer = await fetchArrayBuffer(pdfUrl); const wavArrayBuffer = await fetchArrayBuffer(wavUrl); const pngArrayBuffer = await fetchArrayBuffer(pngUrl);\n -// Create the LangSmith client (Ensure LANGCHAIN_API_KEY is set in env) +// Create the LangSmith client (Ensure LANGSMITH_API_KEY is set in env) const langsmithClient = new Client();\n // Create a unique dataset name const datasetName = "attachment-test-dataset:" + uuid4().substring(0, 8);\n diff --git a/docs/evaluation/how_to_guides/unit_testing.mdx b/docs/evaluation/how_to_guides/unit_testing.mdx index 1348c155..3a26f28a 100644 --- a/docs/evaluation/how_to_guides/unit_testing.mdx +++ b/docs/evaluation/how_to_guides/unit_testing.mdx @@ -162,10 +162,10 @@ The `expect` utility is modeled off of [Jest](https://jestjs.io/docs/expect)'s e #### Dry-run mode -If you want to run the tests without syncing the results to LangSmith, you can set `LANGCHAIN_TEST_TRACKING=false` in your environment. +If you want to run the tests without syncing the results to LangSmith, you can set `LANGSMITH_TEST_TRACKING=false` in your environment. ```bash -LANGCHAIN_TEST_TRACKING=false pytest tests/ +LANGSMITH_TEST_TRACKING=false pytest tests/ ``` The tests will run as normal, but the experiment logs will not be sent to LangSmith. @@ -174,10 +174,10 @@ The tests will run as normal, but the experiment logs will not be sent to LangSm LLMs on every commit in CI can get expensive. To save time and resources, LangSmith lets you cache results to disk. Any identical inputs will be loaded from the cache so you don't have to call out to your LLM provider unless there are changes to the model, prompt, or retrieved data. -To enable caching, run with `LANGCHAIN_TEST_CACHE=/my/cache/path`. For example: +To enable caching, run with `LANGSMITH_TEST_CACHE=/my/cache/path`. For example: ```bash -LANGCHAIN_TEST_CACHE=tests/cassettes pytest tests/my_llm_tests +LANGSMITH_TEST_CACHE=tests/cassettes pytest tests/my_llm_tests ``` All requests will be cached to `tests/cassettes` and loaded from there on subsequent runs. If you check this in to your repository, your CI will be able to use the cache as well. @@ -188,7 +188,7 @@ With caching enabled, you can iterate quickly on your tests using `watch` mode w ```bash pip install pytest-watch -LANGCHAIN_TEST_CACHE=tests/cassettes ptw tests/my_llm_tests +LANGSMITH_TEST_CACHE=tests/cassettes ptw tests/my_llm_tests ``` ## Explanations diff --git a/docs/evaluation/how_to_guides/upload_existing_experiments.mdx b/docs/evaluation/how_to_guides/upload_existing_experiments.mdx index caa2901a..be456ed4 100644 --- a/docs/evaluation/how_to_guides/upload_existing_experiments.mdx +++ b/docs/evaluation/how_to_guides/upload_existing_experiments.mdx @@ -195,7 +195,7 @@ body = { resp = requests.post( "https://api.smith.langchain.com/api/v1/datasets/upload-experiment", json=body, - headers={"x-api-key": os.environ["LANGCHAIN_API_KEY"]} + headers={"x-api-key": os.environ["LANGSMITH_API_KEY"]} ) print(resp.json()) ``` diff --git a/docs/evaluation/index.mdx b/docs/evaluation/index.mdx index 557393ac..fc129dd0 100644 --- a/docs/evaluation/index.mdx +++ b/docs/evaluation/index.mdx @@ -44,8 +44,8 @@ To create an API key head to the None: if not os.environ.get(var): os.environ[var] = getpass.getpass(f"Set {var}: ") -os.environ["LANGCHAIN_TRACING_V2"] = "true" -_set_env("LANGCHAIN_API_KEY") +os.environ["LANGSMITH_TRACING"] = "true" +_set_env("LANGSMITH_API_KEY") _set_env("OPENAI_API_KEY") #endregion ``` diff --git a/docs/evaluation/tutorials/backtesting.mdx b/docs/evaluation/tutorials/backtesting.mdx index e2d194a2..dbe49a74 100644 --- a/docs/evaluation/tutorials/backtesting.mdx +++ b/docs/evaluation/tutorials/backtesting.mdx @@ -45,10 +45,10 @@ import os # Set the project name to whichever project you'd like to be testing against project_name = "Tweet Writing Task" -os.environ["LANGCHAIN_PROJECT"] = project_name -os.environ["LANGCHAIN_TRACING_V2"] = "true" -if not os.environ.get("LANGCHAIN_API_KEY"): - os.environ["LANGCHAIN_API_KEY"] = getpass.getpass("YOUR API KEY") +os.environ["LANGSMITH_PROJECT"] = project_name +os.environ["LANGSMITH_TRACING"] = "true" +if not os.environ.get("LANGSMITH_API_KEY"): + os.environ["LANGSMITH_API_KEY"] = getpass.getpass("YOUR API KEY") # Optional. You can swap OpenAI for any other tool-calling chat model. os.environ["OPENAI_API_KEY"] = "YOUR OPENAI API KEY" diff --git a/docs/evaluation/tutorials/rag.mdx b/docs/evaluation/tutorials/rag.mdx index 123d6b23..e277982d 100644 --- a/docs/evaluation/tutorials/rag.mdx +++ b/docs/evaluation/tutorials/rag.mdx @@ -47,13 +47,13 @@ First, let's set our environment variables: python` import os - os.environ["LANGCHAIN_TRACING_V2"] = "true" - os.environ["LANGCHAIN_API_KEY"] = "YOUR LANGCHAIN API KEY" + os.environ["LANGSMITH_TRACING"] = "true" + os.environ["LANGSMITH_API_KEY"] = "YOUR LANGSMITH API KEY" os.environ["OPENAI_API_KEY"] = "YOUR OPENAI API KEY" `, typescript` - process.env.LANGCHAIN_TRACING_V2 = "true"; - process.env.LANGCHAIN_API_KEY = "YOUR LANGCHAIN API KEY"; + process.env.LANGSMITH_TRACING = "true"; + process.env.LANGSMITH_API_KEY = "YOUR LANGSMITH API KEY"; process.env.OPENAI_API_KEY = "YOUR OPENAI API KEY"; `, ]} diff --git a/docs/observability/how_to_guides/tracing/add_metadata_tags.mdx b/docs/observability/how_to_guides/tracing/add_metadata_tags.mdx index 866f5c6a..e297c6d0 100644 --- a/docs/observability/how_to_guides/tracing/add_metadata_tags.mdx +++ b/docs/observability/how_to_guides/tracing/add_metadata_tags.mdx @@ -30,7 +30,7 @@ messages = [ # highlight-next-line # You can set metadata & tags **statically** when decorating a function # Use the @traceable decorator with tags and metadata -# Ensure that the LANGCHAIN_TRACING_V2 environment variables are set for @traceable to work +# Ensure that the LANGSMITH_TRACING environment variables are set for @traceable to work @ls.traceable( run_type="llm", name="OpenAI Call Decorator", diff --git a/docs/observability/how_to_guides/tracing/annotate_code.mdx b/docs/observability/how_to_guides/tracing/annotate_code.mdx index 25b0bf6b..ef20feb3 100644 --- a/docs/observability/how_to_guides/tracing/annotate_code.mdx +++ b/docs/observability/how_to_guides/tracing/annotate_code.mdx @@ -26,9 +26,9 @@ If you are using LangChain (either Python or JS/TS), you can skip this section a LangSmith makes it easy to log traces with minimal changes to your existing code with the `@traceable` decorator in Python and `traceable` function in TypeScript. :::note -The `LANGCHAIN_TRACING_V2` environment variable must be set to `'true'` in order for traces to be logged to LangSmith, even when using `@traceable` or `traceable`. This allows you to toggle tracing on and off without changing your code. +The `LANGSMITH_TRACING` environment variable must be set to `'true'` in order for traces to be logged to LangSmith, even when using `@traceable` or `traceable`. This allows you to toggle tracing on and off without changing your code. -Additionally, you will need to set the `LANGCHAIN_API_KEY` environment variable to your API key (see [Setup](/) for more information). +Additionally, you will need to set the `LANGSMITH_API_KEY` environment variable to your API key (see [Setup](/) for more information). By default, the traces will be logged to a project named `default`. To log traces to a different project, see [this section](./log_traces_to_project). @@ -172,9 +172,9 @@ The wrapper works seamlessly with the `@traceable` decorator or `traceable` func Tool calls are automatically rendered :::note -The `LANGCHAIN_TRACING_V2` environment variable must be set to `'true'` in order for traces to be logged to LangSmith, even when using `wrap_openai` or `wrapOpenAI`. This allows you to toggle tracing on and off without changing your code. +The `LANGSMITH_TRACING` environment variable must be set to `'true'` in order for traces to be logged to LangSmith, even when using `wrap_openai` or `wrapOpenAI`. This allows you to toggle tracing on and off without changing your code. -Additionally, you will need to set the `LANGCHAIN_API_KEY` environment variable to your API key (see [Setup](/) for more information). +Additionally, you will need to set the `LANGSMITH_API_KEY` environment variable to your API key (see [Setup](/) for more information). By default, the traces will be logged to a project named `default`. To log traces to a different project, see [this section](./log_traces_to_project). @@ -232,7 +232,7 @@ await chatPipeline("Can you summarize this morning's meetings?");`), ## Use the `RunTree` API Another, more explicit way to log traces to LangSmith is via the `RunTree` API. This API allows you more control over your tracing - you can manually -create runs and children runs to assemble your trace. You still need to set your `LANGCHAIN_API_KEY`, but `LANGCHAIN_TRACING_V2` is not +create runs and children runs to assemble your trace. You still need to set your `LANGSMITH_API_KEY`, but `LANGSMITH_TRACING` is not necessary for this method. This method is not recommended, as it's easier to make mistakes in propagating trace context. diff --git a/docs/observability/how_to_guides/tracing/log_traces_to_project.mdx b/docs/observability/how_to_guides/tracing/log_traces_to_project.mdx index c0fb132f..ef9fd221 100644 --- a/docs/observability/how_to_guides/tracing/log_traces_to_project.mdx +++ b/docs/observability/how_to_guides/tracing/log_traces_to_project.mdx @@ -16,10 +16,10 @@ You can change the destination project of your traces both statically through en ## Set the destination project statically -As mentioned in the [Tracing Concepts](/observability/concepts#projects) section, LangSmith uses the concept of a `Project` to group traces. If left unspecified, the project is set to `default`. You can set the `LANGCHAIN_PROJECT` environment variable to configure a custom project name for an entire application run. This should be done before executing your application. +As mentioned in the [Tracing Concepts](/observability/concepts#projects) section, LangSmith uses the concept of a `Project` to group traces. If left unspecified, the project is set to `default`. You can set the `LANGSMITH_PROJECT` environment variable to configure a custom project name for an entire application run. This should be done before executing your application. ```bash -export LANGCHAIN_PROJECT=my-custom-project +export LANGSMITH_PROJECT=my-custom-project ``` If the project specified does not exist, it will be created automatically when the first trace is ingested. @@ -29,7 +29,7 @@ If the project specified does not exist, it will be created automatically when t You can also set the project name at program runtime in various ways, depending on how you are [annotating your code for tracing](./annotate_code). This is useful when you want to log traces to different projects within the same application. :::note -Setting the project name dynamically using one of the below methods overrides the project name set by the `LANGCHAIN_PROJECT` environment variable. +Setting the project name dynamically using one of the below methods overrides the project name set by the `LANGSMITH_PROJECT` environment variable. ::: +export LANGSMITH_API_KEY= ``` Next, you will need to install the LangSmith SDK: diff --git a/docs/observability/how_to_guides/tracing/trace_with_langchain.mdx b/docs/observability/how_to_guides/tracing/trace_with_langchain.mdx index 93f6c938..811f3f86 100644 --- a/docs/observability/how_to_guides/tracing/trace_with_langchain.mdx +++ b/docs/observability/how_to_guides/tracing/trace_with_langchain.mdx @@ -64,7 +64,7 @@ chain.invoke({"question": "Am I using a callback?", "context": "I'm using a call from langchain_core.tracers.context import tracing_v2_enabled with tracing_v2_enabled(): chain.invoke({"question": "Am I using a context manager?", "context": "I'm using a context manager"})\n -# This will NOT be traced (assuming LANGCHAIN_TRACING_V2 is not set) +# This will NOT be traced (assuming LANGSMITH_TRACING is not set) chain.invoke({"question": "Am I being traced?", "context": "I'm not being traced"})`), TypeScriptBlock(`// You can configure a LangChainTracer instance to trace a specific invocation. import { LangChainTracer } from "@langchain/core/tracers/tracer_langchain";\n @@ -84,10 +84,10 @@ await chain.invoke( ### Statically -As mentioned in the [tracing conceptual guide](../../concepts) LangSmith uses the concept of a Project to group traces. If left unspecified, the tracer project is set to default. You can set the `LANGCHAIN_PROJECT` environment variable to configure a custom project name for an entire application run. This should be done before executing your application. +As mentioned in the [tracing conceptual guide](../../concepts) LangSmith uses the concept of a Project to group traces. If left unspecified, the tracer project is set to default. You can set the `LANGSMITH_PROJECT` environment variable to configure a custom project name for an entire application run. This should be done before executing your application. ```shell -export LANGCHAIN_PROJECT=my-project +export LANGSMITH_PROJECT=my-project ``` ### Dynamically @@ -317,10 +317,10 @@ try { As mentioned in other guides, the following environment variables allow you to configure tracing enabled, the api endpoint, the api key, and the tracing project: -- `LANGCHAIN_TRACING_V2` -- `LANGCHAIN_API_KEY` -- `LANGCHAIN_ENDPOINT` -- `LANGCHAIN_PROJECT` +- `LANGSMITH_TRACING` +- `LANGSMITH_API_KEY` +- `LANGSMITH_ENDPOINT` +- `LANGSMITH_PROJECT` However, in some environments, it is not possible to set environment variables. In these cases, you can set the tracing configuration programmatically. diff --git a/docs/observability/how_to_guides/tracing/trace_with_vercel_ai_sdk.mdx b/docs/observability/how_to_guides/tracing/trace_with_vercel_ai_sdk.mdx index 33232931..81803e7f 100644 --- a/docs/observability/how_to_guides/tracing/trace_with_vercel_ai_sdk.mdx +++ b/docs/observability/how_to_guides/tracing/trace_with_vercel_ai_sdk.mdx @@ -204,7 +204,7 @@ import { generateText } from "ai"; interface Env { OPENAI_API_KEY: string; - LANGSMITH_TRACING_V2: string; + LANGSMITH_TRACING: string; LANGSMITH_ENDPOINT: string; LANGSMITH_API_KEY: string; } @@ -218,9 +218,9 @@ const handler = { model, prompt: "Tell me a joke", experimental_telemetry: AISDKExporter.getSettings({ - // As `process.env.LANGSMITH_TRACING_V2` is undefined in Cloudflare Workers, + // As `process.env.LANGSMITH_TRACING` is undefined in Cloudflare Workers, // we need to check the environment variable directly. - isEnabled: env.LANGSMITH_TRACING_V2 === "true", + isEnabled: env.LANGSMITH_TRACING === "true", }), }); diff --git a/docs/observability/how_to_guides/tracing/trace_without_env_vars.mdx b/docs/observability/how_to_guides/tracing/trace_without_env_vars.mdx index c19fb83f..07e693f6 100644 --- a/docs/observability/how_to_guides/tracing/trace_without_env_vars.mdx +++ b/docs/observability/how_to_guides/tracing/trace_without_env_vars.mdx @@ -14,16 +14,16 @@ import { RegionalUrl } from "@site/src/components/RegionalUrls"; As mentioned in other guides, the following environment variables allow you to configure tracing enabled, the api endpoint, the api key, and the tracing project: -- `LANGCHAIN_TRACING_V2` -- `LANGCHAIN_API_KEY` -- `LANGCHAIN_ENDPOINT` -- `LANGCHAIN_PROJECT` +- `LANGSMITH_TRACING` +- `LANGSMITH_API_KEY` +- `LANGSMITH_ENDPOINT` +- `LANGSMITH_PROJECT` In some environments, it is not possible to set environment variables. In these cases, you can set the tracing configuration programmatically. :::caution Recently changed behavior Due to a number of asks for finer-grained control of tracing using the `trace` context manager, -**we changed the behavior** of `with trace` to honor the `LANGCHAIN_TRACING_V2` environment variable in version **0.1.95** of the Python SDK. You can find more details in the [release notes](https://github.com/langchain-ai/langsmith-sdk/releases/tag/v0.1.95). +**we changed the behavior** of `with trace` to honor the `LANGSMITH_TRACING` environment variable in version **0.1.95** of the Python SDK. You can find more details in the [release notes](https://github.com/langchain-ai/langsmith-sdk/releases/tag/v0.1.95). The recommended way to disable/enable tracing without setting environment variables is to use the `with tracing_context` context manager, as shown in the example below. ::: diff --git a/docs/observability/tutorials/observability.mdx b/docs/observability/tutorials/observability.mdx index 2fc6eff5..cd044118 100644 --- a/docs/observability/tutorials/observability.mdx +++ b/docs/observability/tutorials/observability.mdx @@ -115,9 +115,9 @@ Next, install the LangSmith SDK: Finally, set up the appropriate environment variables. This will log traces to the `default` project (though you can easily change that). ```shell -export LANGCHAIN_TRACING_V2=true -export LANGCHAIN_API_KEY= -export LANGCHAIN_PROJECT=default +export LANGSMITH_TRACING=true +export LANGSMITH_API_KEY= +export LANGSMITH_PROJECT=default ``` ### Trace your LLM calls diff --git a/docs/prompt_engineering/how_to_guides/prompts/manage_prompts_programatically.mdx b/docs/prompt_engineering/how_to_guides/prompts/manage_prompts_programatically.mdx index f375d2a3..10154654 100644 --- a/docs/prompt_engineering/how_to_guides/prompts/manage_prompts_programatically.mdx +++ b/docs/prompt_engineering/how_to_guides/prompts/manage_prompts_programatically.mdx @@ -39,14 +39,14 @@ In TypeScript, you must use the LangChain npm package for pulling prompts (it al ## Configure environment variables -If you already have `LANGCHAIN_API_KEY` set to your current workspace's api key from LangSmith, you can skip this step. +If you already have `LANGSMITH_API_KEY` set to your current workspace's api key from LangSmith, you can skip this step. Otherwise, get an API key for your workspace by navigating to `Settings > API Keys > Create API Key` in LangSmith. Set your environment variable. ```bash -export LANGCHAIN_API_KEY="lsv2_..." +export LANGSMITH_API_KEY="lsv2_..." ``` :::note Terminology diff --git a/docs/prompt_engineering/tutorials/optimize_classifier.mdx b/docs/prompt_engineering/tutorials/optimize_classifier.mdx index 13363b1b..3347058d 100644 --- a/docs/prompt_engineering/tutorials/optimize_classifier.mdx +++ b/docs/prompt_engineering/tutorials/optimize_classifier.mdx @@ -22,7 +22,7 @@ We can do this by setting an environment variable: ```python import os -os.environ["LANGCHAIN_PROJECT"] = "classifier" +os.environ["LANGSMITH_PROJECT"] = "classifier" ``` We can then create our initial application. This will be a really simple function that just takes in a GitHub issue title and tries to label it. diff --git a/docs/self_hosting/usage.mdx b/docs/self_hosting/usage.mdx index f49c4060..9398e264 100644 --- a/docs/self_hosting/usage.mdx +++ b/docs/self_hosting/usage.mdx @@ -14,7 +14,7 @@ This guide assumes you have already deployed a self-hosted LangSmith instance. I ### Configuring the application you want to use with LangSmith -LangSmith has two APIs: One for interacting with the LangChain Hub/prompts and one for interacting with the backend of the LangSmith application. Each exists at its own URL and in a self-hosted environment are set via the `LANGCHAIN_HUB_API_URL` and `LANGCHAIN_ENDPOINT` environment variables, respectively, and have their own separate SDKs. +LangSmith has a single API for interacting with both the hub and the LangSmith backend. 1. Once you have deployed your instance, you can access the LangSmith UI at `http://`. 2. The backend API will be available at `http:///api` @@ -22,9 +22,8 @@ LangSmith has two APIs: One for interacting with the LangChain Hub/prompts and o To use the LangSmith API, you will need to set the following environment variables in your application: ```bash -LANGCHAIN_ENDPOINT=http:///api -LANGCHAIN_HUB_API_URL=http:///api # Only set this if using the legacy langchainhub SDK -LANGCHAIN_API_KEY=foo # Set to a legitimate API key if using OAuth +LANGSMITH_ENDPOINT=http:///api +LANGSMITH_API_KEY=foo # Set to a legitimate API key if using OAuth ``` You can also configure these variables directly in the LangSmith SDK client: @@ -36,15 +35,6 @@ langsmith_client = langsmith.Client( api_key='', api_url='http:///api', ) - -# Deprecated, you can use the Langsmith client for all interactions -import langchainhub - -# Deprecated, use langsmith.Client instead -langchainhub.Client( - api_key='', - api_url='http:///api' -) ``` After setting the above, you should be able to run your code and see the results in your self-hosted instance.