<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue" -->

---
title: Introducing Pytest and Vitest integrations for LangSmith...
description: LangSmith now supports running LLM evaluations directly through Pytest (Python) and Vitest/Jest (TypeScript), available in beta with v0.3.0 of the LangSmith...
canonical: https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Introducing Pytest and Vitest integrations for LangSmith Evaluations | daily.dev
og:description: LangSmith now supports running LLM evaluations directly through Pytest (Python) and Vitest/Jest (TypeScript), available in beta with v0.3.0 of the LangSmith...
og:url: https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue
og:image: https://api.daily.dev/og/posts/qsOWLBvUE.png
og:image:alt: Introducing Pytest and Vitest integrations for LangSmith Evaluations
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Introducing Pytest and Vitest integrations for LangSmith Evaluations

**[LangChain](https://daily.dev/sources/langchain)** · 7 min read · 0 upvotes · 0 comments

## Summary

LangSmith now supports running LLM evaluations directly through Pytest (Python) and Vitest/Jest (TypeScript), available in beta with v0.3.0 of the LangSmith Python and TypeScript SDKs. Instead of using a separate evaluate() workflow, developers can decorate or wrap existing test cases to log inputs, outputs, and feedback scores to LangSmith while still getting real-time local test results and CI integration. The integrations support per-test-case custom evaluation logic, built-in evaluation functions like expect.edit_distance() in Python, and team-shareable experiment results. A GitHub Action for CI is planned.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.langchain.com/blog/pytest-and-vitest-for-langsmith-evals>

## Questions this post answers

### How do I run LangSmith evaluations using Pytest instead of the evaluate() function?

Add the @pytest.mark.langsmith decorator to a test function, then use langsmith.testing to log inputs, reference outputs, and feedback inside the test body. Running pytest tests executes normally while also logging test case results, application traces, and feedback traces to LangSmith. This is available in beta as of v0.3.0 of the LangSmith Python SDK.

_daily.dev surfaces integration guides like this for developers wiring LLM evals into existing test suites._

### What is the difference between using LangSmith's evaluate() function and the new Pytest/Vitest test integrations?

Evaluate() requires building a dataset upfront and running one generation function with a shared set of evaluators across it, which works well for black-box testing but is inflexible when different parts of an application need different evaluation logic. The Pytest/Vitest integrations let each test case define its own custom evaluator, support real-time local feedback while iterating, and integrate more naturally into CI pipelines using standard pass/fail assertions.

_developers deciding how to structure LLM eval pipelines can track approaches like this via daily.dev._

### How do I track a Vitest test case in LangSmith?

Wrap test cases in an ls.describe() block using the langsmith/vitest import, then define tests with ls.test() specifying inputs and referenceOutputs. Inside the test, call ls.logOutputs() to record results and use ls.wrapEvaluator() to wrap an evaluator function so its score is automatically logged as feedback, for example under the key correctness.

_teams adding LLM observability to a Vitest suite can follow setups like this via daily.dev._

## Similar posts on daily.dev

- [Introducing Evalite: The TypeScript Testing Tool for AI Powered Apps](https://daily.dev/posts/introducing-evalite-the-typescript-testing-tool-for-ai-powered-apps-g7vhandao) · InfoQ · 1 upvotes · 0 comments
- [Testing LLM Output in CI with Vitest and Schema Validation](https://daily.dev/posts/testing-llm-output-in-ci-with-vitest-and-schema-validation-ecvs0un9p) · SitePoint · 0 upvotes · 0 comments
- [monday Service \+ LangSmith: Building a Code-First Evaluation Strategy from Day 1](https://daily.dev/posts/monday-service-langsmith-building-a-code-first-evaluation-strategy-from-day-1-ck3biv0to) · LangChain · 1 upvotes · 0 comments
- [Vitest: an introduction](https://daily.dev/posts/vitest-an-introduction-9rhl06sca) · Flavio Copes · 2 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#llm](https://daily.dev/tags/llm), [#langchain](https://daily.dev/tags/langchain), [#langsmith](https://daily.dev/tags/langsmith), [#vitest](https://daily.dev/tags/vitest)

[View this post on daily.dev](https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Introducing Pytest and Vitest integrations for LangSmith Evaluations","url":"https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue"},"datePublished":"2026-08-25T21:11:58.651Z","dateModified":"2026-09-13T19:46:15.820Z","description":"LangSmith now supports running LLM evaluations directly through Pytest (Python) and Vitest/Jest (TypeScript), available in beta with v0.3.0 of the LangSmith...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/783158bb290b9de68c1125e48fdc28db?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/783158bb290b9de68c1125e48fdc28db?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"LangChain","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"LangChain","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/0f4f2629e0724a849823f8cd0d913e13","url":"https://daily.dev/sources/langchain"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,llm,langchain,langsmith,vitest","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"LangChain","item":"https://daily.dev/sources/langchain"},{"@type":"ListItem","position":3,"name":"Introducing Pytest and Vitest integrations for LangSmith Evaluations"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/introducing-pytest-and-vitest-integrations-for-langsmith-evaluations-qsowlbvue#faq","mainEntity":[{"@type":"Question","name":"How do I run LangSmith evaluations using Pytest instead of the evaluate() function?","acceptedAnswer":{"@type":"Answer","text":"Add the @pytest.mark.langsmith decorator to a test function, then use langsmith.testing to log inputs, reference outputs, and feedback inside the test body. Running pytest tests executes normally while also logging test case results, application traces, and feedback traces to LangSmith. This is available in beta as of v0.3.0 of the LangSmith Python SDK. daily.dev surfaces integration guides like this for developers wiring LLM evals into existing test suites."}},{"@type":"Question","name":"What is the difference between using LangSmith's evaluate() function and the new Pytest/Vitest test integrations?","acceptedAnswer":{"@type":"Answer","text":"Evaluate() requires building a dataset upfront and running one generation function with a shared set of evaluators across it, which works well for black-box testing but is inflexible when different parts of an application need different evaluation logic. The Pytest/Vitest integrations let each test case define its own custom evaluator, support real-time local feedback while iterating, and integrate more naturally into CI pipelines using standard pass/fail assertions. developers deciding how to structure LLM eval pipelines can track approaches like this via daily.dev."}},{"@type":"Question","name":"How do I track a Vitest test case in LangSmith?","acceptedAnswer":{"@type":"Answer","text":"Wrap test cases in an ls.describe() block using the langsmith/vitest import, then define tests with ls.test() specifying inputs and referenceOutputs. Inside the test, call ls.logOutputs() to record results and use ls.wrapEvaluator() to wrap an evaluator function so its score is automatically logged as feedback, for example under the key correctness. teams adding LLM observability to a Vitest suite can follow setups like this via daily.dev."}}]}
```

