Skip to content

Commit

Permalink
Add Expectations Draft
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Apr 11, 2024
1 parent e1297d5 commit 7e57a1a
Show file tree
Hide file tree
Showing 10 changed files with 202,000 additions and 6 deletions.
16 changes: 14 additions & 2 deletions .github/actions/python-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
- name: Install dependencies
run: |
poetry install --with dev
poetry run pip install -U langchain langchain_anthropic tiktoken rapidfuzz vcrpy
poetry run pip install -U langchain langchain_anthropic tiktoken rapidfuzz vcrpy numpy
shell: bash
working-directory: python

Expand All @@ -52,7 +52,19 @@ runs:
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
LANGCHAIN_TEST_CACHE: "tests/cassettes"
run: make doctest
shell: bash
working-directory: python


- name: Run Evaluation
env:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
LANGCHAIN_TEST_CACHE: "tests/cassettes"
run: make evals
shell: bash
working-directory: python

5 changes: 4 additions & 1 deletion python/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: tests lint format
.PHONY: tests lint format build publish doctest integration_tests integration_tests_fast evals

tests:
poetry run pytest -n auto --durations=10 tests/unit_tests
Expand All @@ -15,6 +15,9 @@ integration_tests_fast:
doctest:
poetry run pytest -n auto --durations=10 --doctest-modules langsmith

evals:
poetry run pytest tests/evaluation

lint:
poetry run ruff check .
poetry run mypy .
Expand Down
18 changes: 18 additions & 0 deletions python/langsmith/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from langsmith._expect import expect
from langsmith._testing import unit
from langsmith.client import Client
from langsmith.evaluation import aevaluate, evaluate
from langsmith.evaluation.evaluator import EvaluationResult, RunEvaluator
from langsmith.run_helpers import trace, traceable
from langsmith.run_trees import RunTree
Expand Down Expand Up @@ -47,6 +49,19 @@ def __getattr__(name: str) -> Any:

return unit

elif name == "expect":
from langsmith._expect import expect

return expect
elif name == "evaluate":
from langsmith.evaluation import evaluate

return evaluate
elif name == "aevaluate":
from langsmith.evaluation import aevaluate

return aevaluate

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


Expand All @@ -59,4 +74,7 @@ def __getattr__(name: str) -> Any:
"traceable",
"trace",
"unit",
"expect",
"evaluate",
"aevaluate",
]
Loading

0 comments on commit 7e57a1a

Please sign in to comment.