Skip to content

Commit

Permalink
fix(sdk): remove API key (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
dqbd authored May 9, 2024
2 parents 42df6b3 + 19c5f85 commit 90c5ac5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/actions/js-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
langchain-api-key:
description: "Langchain"
required: true
langchain-endpoint:
description: "LangSmith Endpoint"
required: true
openai-api-key:
description: "OpenAI API key"
required: false
Expand Down Expand Up @@ -34,5 +37,6 @@ runs:
working-directory: js
env:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_ENDPOINT: ${{ inputs.langchain-endpoint }}
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
6 changes: 6 additions & 0 deletions .github/actions/python-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
langchain-api-key:
description: "Langchain"
required: true
langchain-endpoint:
description: "LangSmith Endpoint"
required: true
openai-api-key:
description: "OpenAI API key"
required: false
Expand Down Expand Up @@ -40,6 +43,7 @@ runs:
- name: Run integration tests
env:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_ENDPOINT: ${{ inputs.langchain-endpoint }}
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
run: make integration_tests_fast
Expand All @@ -49,6 +53,7 @@ runs:
- name: Run doctest
env:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_ENDPOINT: ${{ inputs.langchain-endpoint }}
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
Expand All @@ -60,6 +65,7 @@ runs:
- name: Run Evaluation
env:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_ENDPOINT: ${{ inputs.langchain-endpoint }}
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
uses: ./.github/actions/python-integration-tests
with:
python-version: 3.11
langchain-endpoint: https://api.smith.langchain.com
langchain-api-key: ${{ secrets.LANGSMITH_API_KEY }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
Expand Down Expand Up @@ -75,5 +76,6 @@ jobs:
uses: ./.github/actions/js-integration-tests
with:
node-version: 20.x
langchain-endpoint: https://api.smith.langchain.com
langchain-api-key: ${{ secrets.LANGSMITH_API_KEY }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
1 change: 1 addition & 0 deletions python/langsmith/evaluation/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ def evaluate_comparative(
... evaluators=[score_preferences],
... client=client,
... ) # doctest: +ELLIPSIS
View the pairwise evaluation results at:...
""" # noqa: E501
if len(experiments) < 2:
raise ValueError("Comparative evaluation requires at least 2 experiments.")
Expand Down
6 changes: 1 addition & 5 deletions python/tests/integration_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ def wait_for(


@pytest.fixture
def langchain_client(monkeypatch: pytest.MonkeyPatch) -> Client:
# monkeypatch.setenv("LANGCHAIN_ENDPOINT", "https://api.smith.langchain.com")
monkeypatch.setenv("LANGCHAIN_ENDPOINT", "https://dev.api.smith.langchain.com")
monkeypatch.setenv("LANGCHAIN_API_KEY", "ls__29e47afc8ad24323aef27444617fb8db")
def langchain_client() -> Client:
return Client()


Expand Down Expand Up @@ -217,7 +214,6 @@ def test_create_dataset(
) -> None:
"""Test persisting runs and adding feedback."""
monkeypatch.setenv("LANGCHAIN_ENDPOINT", "https://dev.api.smith.langchain.com")
monkeypatch.setenv("LANGCHAIN_API_KEY", "ls__29e47afc8ad24323aef27444617fb8db")
dataset_name = "__test_create_dataset" + uuid4().hex[:4]
if langchain_client.has_dataset(dataset_name=dataset_name):
langchain_client.delete_dataset(dataset_name=dataset_name)
Expand Down
9 changes: 1 addition & 8 deletions python/tests/integration_tests/test_runs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import asyncio
import os
import time
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
from typing import AsyncGenerator, Generator, Optional

import pytest
import pytest # type: ignore

from langsmith import utils as ls_utils
from langsmith.client import Client
Expand All @@ -15,13 +14,7 @@

@pytest.fixture
def langchain_client() -> Generator[Client, None, None]:
original = os.environ.get("LANGCHAIN_ENDPOINT")
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
yield Client()
if original is None:
os.environ.pop("LANGCHAIN_ENDPOINT")
else:
os.environ["LANGCHAIN_ENDPOINT"] = original


def poll_runs_until_count(
Expand Down

0 comments on commit 90c5ac5

Please sign in to comment.