Skip to content

Commit

Permalink
Add TS eval for langchain
Browse files Browse the repository at this point in the history
  • Loading branch information
dqbd committed May 2, 2024
1 parent 9588685 commit b2ac40a
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,30 @@ First, define your `LangChain` runnable:

Then, pass the `runnable.invoke` method to the `evaluate` method. Note that the input variables of the runnable must match the keys of the example inputs.

```python
results = evaluate(
chain.invoke,
data=dataset_name,
evaluators=[correct_label],
experiment_prefix="Toxic Queries",
)
```
<CodeTabs
groupId="client-language"
tabs={[
python`
from langsmith.evaluation import evaluate
results = evaluate(
chain.invoke,
data=dataset_name,
evaluators=[correct_label],
experiment_prefix="Toxic Queries",
)
`,
typescript`
import { evaluate } from "langsmith/evaluation";
await evaluate(chain.invoke.bind(chain), {
data: datasetName,
evaluators: [correctLabel],
experimentPrefix: "Toxic Queries",
});
`,
]}
/>

The runnable is traced appropriately for each output.

Expand Down

0 comments on commit b2ac40a

Please sign in to comment.