Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): remove API key #674

Merged
merged 6 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading