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

pytest updates #634

Merged
merged 1 commit into from
Jan 22, 2025
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
32 changes: 16 additions & 16 deletions docs/evaluation/how_to_guides/pytest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -314,23 +314,9 @@ LANGSMITH_TEST_TRACKING=false pytest tests/

The tests will run as normal, but the experiment logs will not be sent to LangSmith.

## Legacy

#### `@test` / `@unit` decorator

The legacy method for marking test cases is using the `@test` or `@unit` decorators:

```python
from langsmith import test

@test
def test_foo() -> None:
pass
```

#### Expectations
## Expectations

LangSmith provides an `expect` utility to help define expectations about your LLM output. For example:
LangSmith provides an [expect](https://docs.smith.langchain.com/reference/python/_expect/langsmith._expect._Expect#langsmith._expect._Expect) utility to help define expectations about your LLM output. For example:

```python
from langsmith import expect
Expand Down Expand Up @@ -376,3 +362,17 @@ This test case will be assigned 4 scores:
4. The overall test pass/fail score (binary)

The `expect` utility is modeled off of [Jest](https://jestjs.io/docs/expect)'s expect API, with some off-the-shelf functionality to make it easier to grade your LLMs.

## Legacy

#### `@test` / `@unit` decorator

The legacy method for marking test cases is using the `@test` or `@unit` decorators:

```python
from langsmith import test

@test
def test_foo() -> None:
pass
```
2 changes: 1 addition & 1 deletion docs/evaluation/tutorials/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

# Test a ReAct agent with Pytest/Vitest and LangSmith

This tutorial will show you how to use LangSmith's integrations with popular testing tools Pytest and Vitest/Jest to evaluate your LLM application.
This tutorial will show you how to use LangSmith's integrations with popular testing tools [Pytest](../how_to_guides/pytest) and [Vitest/Jest](../how_to_guides/vitest_jest) to evaluate your LLM application.
We will create a ReAct agent that answers questions about publicly traded stocks and write a comprehensive test suite for it.

## Setup
Expand Down
Loading