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

set up versioning and new docs outline #186

Merged
merged 4 commits into from
Apr 23, 2024
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
11 changes: 11 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
lastVersion: "current",
versions: {
current: {
label: "1.0",
badge: false,
},
"2.0": {
label: "2.0",
banner: "unreleased",
},
},
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
Expand Down
32 changes: 32 additions & 0 deletions versioned_docs/version-2.0/concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Concepts

Explanations, clarification and discussion of key topics in LangSmith.

### Admin

- [ ] Organizations
- [ ] Workspaces
- [ ] Users
- [ ] API Keys
- [ ] Personal Access Tokens
- [ ] Roles

### Tracing

- [ ] Projects
- [ ] Traces
- [ ] Runs
- [ ] Tags
- [ ] Metadata

### Evaluation

- [ ] Prompts
- [ ] Experiment
- [ ] Datasets
- [ ] Feedback
- [ ] Evaluator

- [ ] Annotation Queue
- [ ] Prompt
- [ ] Playground
105 changes: 105 additions & 0 deletions versioned_docs/version-2.0/how_to_guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# How-To Guides

Step-by-step guides that cover key tasks, operations and common problems.

### Setup

- [ ] Create an account and API Key
- [ ] Setup an organization
- [ ] Setup a workspace
- [ ] Setup Billing
- [ ] Assigning Roles (enterprise only)

### Deployment

- [ ] Self-hosting LangSmith on Kubernetes
- [ ] Self-hosting LangSmith via Docker Compose
- [ ] Setting up Auth

### Tracing

- [ ] Annotate code for tracing
- [ ] `traceable`
- [ ] wrapping OpenAI or Custom LLM
- [ ] RunTree
- [ ] Log traces to specific project
- [ ] Toggle tracing on and off
- [ ] Sample traces
- [ ] Add metadata and tags to traces
- [ ] Get run_id and trace_id
- [ ] Mask inputs and outputs
- [ ] Log a trace using LangChain
- [ ] Log a trace using instructor
- [ ] Exporting traces
- [ ] Link to data format in reference section
- [ ] Log multi-modal traces

### Datasets

- [ ] Create a dataset in the application
- [ ] Create a dataset using the API
- [ ] Export datasets
- [ ] Import datasets
- [ ] Version datasets
- [ ] Add metadata to examples
- [ ] Filter examples from a dataset
- [ ] Add a trace to a dataset

### Evaluation

- [ ] Run an evaluation
- [ ] Run an evaluation from the playground
- [ ] Run an evaluation on a particular version of dataset
- [ ] Run an evaluation on subset of dataset
- [ ] Use off-the-shelf LangChain evaluators
- [ ] Use custom evaluators
- [ ] Evaluate on intermediate steps
- [ ] Compare experiment results
- [ ] Track regressions and improvements
- [ ] Export experiment
- [ ] Unit test LLM applications
- [ ] View trace for an evaluation run
- [ ] Run a pairwise evaluation (coming soon)
- [ ] Audit evaluation scores (coming soon)

### Human Feedback

- [ ] Attach user feedback from your application to traces
- [ ] Annotate traces inline
- [ ] Add trace to annotation queue
- [ ] Annotate traces in the annotation queue

### Monitoring and Automations

- [ ] Filter for runs
- [ ] Use a trace filter
- [ ] View the monitor charts
- [ ] Slice chart by metadata and tag
- [ ] Set up a rule
- [ ] Online evaluation
- [ ] Annotation Queue addition
- [ ] Dataset addition
- [ ] Webhook action
- [ ] Group traces as threads
- [ ] View threads

### Prompt Hub

- [ ] Create a prompt
- [ ] Update a prompt
- [ ] Pull prompts in code
- [ ] Open a prompt from a trace
- [ ] Open a prompt from an experiment

### Playground

- [ ] Run a prompt in the playground
- [ ] Run a prompt on a custom model

### Proxy

- [ ] Run proxy
- [ ] Make a request to the proxy
- [ ] Turn off caching
- [ ] Stream results
- [ ] Turn on tracing
177 changes: 177 additions & 0 deletions versioned_docs/version-2.0/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
---
sidebar_label: Quick Start
sidebar_position: 1
table_of_contents: true
---

import Tabs from "@theme/Tabs";
import CodeBlock from "@theme/CodeBlock";
import {
CodeTabs,
PythonBlock,
TypeScriptBlock,
} from "@site/src/components/InstructionsWithCode";
import {
LangChainInstallationCodeTabs,
LangChainQuickStartCodeTabs,
ConfigureEnvironmentCodeTabs,
RunTreeQuickStartCodeTabs,
ConfigureSDKEnvironmentCodeTabs,
PythonSDKTracingCode,
TypeScriptSDKTracingCode,
} from "@site/src/components/QuickStart";
import { ClientInstallationCodeTabs } from "@site/src/components/ClientInstallation";
import DocCardList from "@theme/DocCardList";

# Getting started with LangSmith (New!)

## Introduction

**LangSmith** is a platform for building production-grade LLM applications. It allows you to closely monitor and evaluate your application, so you can ship quickly and with confidence. Use of LangChain is not necessary - LangSmith works on its own!

## Install LangSmith

We offer Python and Typescript SDKs for all your LangSmith needs.

<CodeTabs
tabs={[
{
value: "python",
label: "Python",
language: "bash",
content: `pip install -U langsmith`,
},
{
value: "typescript",
label: "TypeScript",
language: "bash",
content: `yarn add langchain langsmith`,
},
]}
groupId="client-language"
/>

## Create an API key

To create an API key head to the [setting pages](https://smith.langchain.com/settings). Then click **Create API Key.**

## Setup your environment

<ConfigureSDKEnvironmentCodeTabs />

## Log your first trace

<p>
We provide multiple ways to log traces to LangSmith. Below, we'll highlight
how to use <code>traceable</code>. See more on the{" "}
<a href="./tracing/integrations">Integrations</a> page.
</p>
<CodeTabs
tabs={[
{
value: "python",
label: "Python",
language: "python",
content: PythonSDKTracingCode(),
},
{
value: "typescript",
label: "TypeScript",
language: "typescript",
content: TypeScriptSDKTracingCode(),
},
]}
groupId="client-language"
/>

- View a [sample output trace](https://smith.langchain.com/public/b37ca9b1-60cd-4a2a-817e-3c4e4443fdc0/r).
- Learn more about tracing on the [tracing page](/tracing).

## Create your first evaluation

Evalution requires a system to test, [data](evaluation/faq) to serve as test cases, and optionally evaluators to grade the results. Here we use a built-in accuracy evaluator.

<CodeTabs
tabs={[
{
value: "python",
label: "Python",
language: "python",
content: `from langsmith import Client
from langsmith.evaluation import evaluate\n
client = Client()\n
# Define dataset: these are your test cases
dataset_name = "Sample Dataset"
dataset = client.create_dataset(dataset_name, description="A sample dataset in LangSmith.")
client.create_examples(
inputs=[
{"postfix": "to LangSmith"},
{"postfix": "to Evaluations in LangSmith"},
],
outputs=[
{"output": "Welcome to LangSmith"},
{"output": "Welcome to Evaluations in LangSmith"},
],
dataset_id=dataset.id,
)\n
# Define your evaluator
def exact_match(run, example):
return {"score": run.outputs["output"] == example.outputs["output"]}\n
experiment_results = evaluate(
lambda input: "Welcome " + input['postfix'], # Your AI system goes here
data=dataset_name, # The data to predict and grade over
evaluators=[exact_match], # The evaluators to score the results
experiment_prefix="sample-experiment", # The name of the experiment
metadata={
"version": "1.0.0",
"revision_id": "beta"
},
)
`,
},
{
value: "typescript",
label: "TypeScript",
language: "typescript",
content: `import { Client, Run, Example } from 'langsmith';
agola11 marked this conversation as resolved.
Show resolved Hide resolved
import { runOnDataset } from 'langchain/smith';
import { EvaluationResult } from 'langsmith/evaluation';\n
const client = new Client();\n
// Define dataset: these are your test cases
const datasetName = "Sample Dataset";
const dataset = await client.createDataset(datasetName, {
description: "A sample dataset in LangSmith."
});
await client.createExamples({
inputs: [
{ postfix: "to LangSmith" },
{ postfix: "to Evaluations in LangSmith" },
],
outputs: [
{ output: "Welcome to LangSmith" },
{ output: "Welcome to Evaluations in LangSmith" },
],
datasetId: dataset.id,
});\n
// Define your evaluator
const exactMatch = async ({ run, example }: { run: Run; example?: Example; }): Promise<EvaluationResult> => {
return {
key: 'exact_match',
score: run.outputs?.output === example?.outputs?.output ? 1 : 0,
};
};\n
await runOnDataset(
(input: { postfix: string }) => ({ output: \`Welcome $\{input.postfix\}\` }), // Your AI system goes here
datasetName, // The data to predict and grade over
{
evaluationConfig: { customEvaluators: [exactMatch] },
projectMetadata: {
version: "1.0.0",
revision_id: "beta",
},
}
);`,
},
]}
groupId="client-language"
/>
Loading
Loading