Skip to content

docs: add Java SDK evaluate() documentation#4745

Open
sineha-mani wants to merge 7 commits into
mainfrom
docs/java-evaluate-function
Open

docs: add Java SDK evaluate() documentation#4745
sineha-mani wants to merge 7 commits into
mainfrom
docs/java-evaluate-function

Conversation

@sineha-mani

@sineha-mani sineha-mani commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a new guide at /langsmith/evaluate-llm-application-java that explains evaluate() in plain language for Java/Kotlin users on langsmith-java 0.1.0-beta.11

"Here's how a Java developer runs an evaluation"

│ ✅ Install library
│ ✅ Step-by-step guide (same page as Python/TS)
│ ✅ Common options cheat sheet
│ ✅ Re-score existing experiment (short)
│ ✅ Version note + a few gotchas

Screenshot 2026-07-07 at 3 40 40 PM

Test plan

  • Preview the new page in Mintlify dev server
  • Verify links to related evaluation pages resolve correctly
  • Review code samples for accuracy against langsmith-java 0.1.0-beta.11 API

Made with Cursor

Document evaluate(), evaluateAsync(), evaluateExisting(), and evaluateComparative() for langsmith-java 0.1.0-beta.11 with plain-language explanations and minimal Kotlin examples.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for opening a docs PR, sineha-mani! When it's ready for review, please add the relevant reviewers:

  • @katmayb or @fjmorris (LangSmith)

@github-actions github-actions Bot added internal langsmith For docs changes to LangSmith labels Jul 6, 2026
sineha-mani and others added 5 commits July 7, 2026 14:05
Add Java/Kotlin tabs and an options section to evaluate-llm-application.mdx instead of maintaining a separate Java SDK page.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace Kotlin tabs and examples with Java using Evaluation, Tracing.traceFunction, and DynamicRunEvaluatorKt APIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add dependency install instructions and notes for re-scoring overloads and EvaluationResult construction from Java.

Co-authored-by: Cursor <cursoragent@cursor.com>
Point readers to per-language API reference and drop the install block that had no Python/TS counterpart on this page.

Co-authored-by: Cursor <cursoragent@cursor.com>
The intro Javadoc link already anchors the required SDK version for Java evaluate examples.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sineha-mani sineha-mani changed the title Add Java SDK evaluate() documentation docs: add Java SDK evaluate() documentation Jul 8, 2026
After running an experiment, you may want to **add new evaluation metrics without re-running your application**. This is useful when you've added new evaluators or want to apply different scoring criteria to existing results. Instead of re-executing your target function on all examples, you can evaluate the existing experiment traces directly.

To add evaluators to an existing experiment, pass the experiment name or ID to `evaluate()` / `aevaluate()` instead of a target function. The evaluators will run on the cached traces from the original experiment, accessing the inputs, outputs, and any intermediate steps that were logged.
To add evaluators to an existing experiment, pass the experiment name or ID to `evaluate()` / `aevaluate()` (Python), or `Evaluation.evaluateExisting()` (Java) instead of a target function. The evaluators run on the cached traces from the original experiment, accessing the inputs, outputs, and any intermediate steps that were logged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess we should add to JS too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

import java.util.function.Function;

// Optionally wrap with Tracing.traceFunction to record inputs and outputs in LangSmith.
Function<Map<String, Object>, Map<String, Object>> toxicityClassifier =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why can't we just automatically do this for functions passed into evaluate like we do in Python/JS?

@sineha-mani sineha-mani Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good point - evaluate() already wraps the target with traceable() internally. The traceFunction in the docs is optional/custom-naming parity with Python's traceable section; we can simplify the Java example to a plain lambda. Will update.

import java.util.Objects;

RunEvaluator correct =
DynamicRunEvaluatorKt.runEvaluatorFromOutputsReference(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming is completely meaningless to me - does it make sense if you are a Java dev?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Kt suffix is automatic Kotlin→Java interop: top-level functions in DynamicRunEvaluator.kt compile to DynamicRunEvaluatorKt.* on the JVM.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DynamicRunEvaluator is the SDK adapter that turns the scoring lambda into a RunEvaluator the evaluate runner can call. It pulls outputs/reference from each run and normalizes the return value (e.g. 1.0) into LangSmith feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did that answer what you meant or am I missing a spot of clarification?

Evaluation.evaluate() already traces the target when uploadResults is true.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Mintlify preview branch generated: preview-docsja-1783484944-f86c4f0

Site preview: https://langchain-5e9cc07a-preview-docsja-1783484944-f86c4f0.mintlify.app

Important

Preview links may take a few minutes to start working while the deployment finishes.

Changed documentation pages (preview deep links):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal langsmith For docs changes to LangSmith

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants