Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Feb 15, 2024
2 parents 4299961 + 4ef2c93 commit da0141f
Show file tree
Hide file tree
Showing 40 changed files with 2,902 additions and 1,630 deletions.
4 changes: 3 additions & 1 deletion .github/actions/python-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ runs:
working-directory: python

- name: Install dependencies
run: poetry install --with dev
run: |
poetry install --with dev
poetry run pip install -U langchain
shell: bash
working-directory: python

Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize, reopened, labeled, unlabeled]
workflow_dispatch:
inputs:
run-python-tests:
description: "Run Python integration tests"
default: "true"
required: false
run-js-tests:
description: "Run JS integration tests"
default: "true"
required: false

jobs:
python_integration_test:
name: Python Integration Test
if: >
github.event_name == 'push' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'release')) ||
(github.event_name == 'workflow_dispatch' && ${{ github.event.inputs.run-python-tests == 'true' }})
runs-on: ubuntu-20.04
defaults:
run:
Expand All @@ -23,7 +40,9 @@ jobs:
- name: Install poetry
run: pipx install poetry==1.4.2
- name: Install dependencies
run: poetry install --with dev
run: |
poetry install --with dev
poetry run pip install -U langchain
- name: Run Python integration tests
uses: ./.github/actions/python-integration-tests
with:
Expand All @@ -33,6 +52,10 @@ jobs:

js_integration_test:
name: JS Integration Test
if: >
github.event_name == 'push' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'release')) ||
(github.event_name == 'workflow_dispatch' && ${{ github.event.inputs.run-js-tests == 'true' }})
runs-on: ubuntu-20.04
defaults:
run:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Links

on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: '0 5 * * *'
workflow_dispatch:

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check links in Markdown files
uses: gaurav-nelson/github-action-markdown-link-check@v1
10 changes: 7 additions & 3 deletions .github/workflows/python_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ jobs:
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Install dependencies
run: poetry install --with dev,lint
run: |
poetry install --with dev,lint
poetry run pip install -U langchain
- name: Analysing the code with our lint
run: make lint

Expand All @@ -72,7 +74,9 @@ jobs:
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Install dependencies
run: poetry install
run: |
poetry install --with dev
poetry run pip install -U langchain
- name: Run tests
run: make tests
shell: bash
shell: bash
10 changes: 10 additions & 0 deletions .github/workflows/release_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ jobs:
run: cd js && yarn run build
- name: Check version
run: cd js && yarn run check-version
- name: Check NPM version
id: check_npm_version
run: |
cd js
if yarn run check-npm-version; then
echo "::set-output name=should_publish::true"
else
echo "::set-output name=should_publish::false"
fi
- name: Publish package to NPM
if: steps.check_npm_version.outputs.should_publish == 'true'
run: |
cd js
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
Expand Down
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This repository contains the Python and Javascript SDK's for interacting with the [LangSmith platform](https://smith.langchain.com/).

LangSmith helps your team debug, evaluate, and monitor your language models and intelligent agents. It works
with any LLM Application, including a native integration with the [LangChain Python](https://github.com/hwchase17/langchain) and [LangChain JS](https://github.com/hwchase17/langchainjs) open source libraries.
with any LLM Application, including a native integration with the [LangChain Python](https://github.com/langchain-ai/langchain) and [LangChain JS](https://github.com/langchain-ai/langchainjs) open source libraries.

LangSmith is developed and maintained by [LangChain](https://langchain.com/), the company behind the LangChain framework.

Expand All @@ -13,12 +13,13 @@ To get started with the Python SDK, [install the package](https://pypi.org/proje

```bash
pip install -U langsmith
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls_...
```

Then start tracing your app:

```
```python
import openai
from langsmith import traceable
from langsmith.wrappers import wrap_openai
Expand All @@ -35,11 +36,48 @@ To get started with the JavaScript / TypeScript SDK, [install the package](https

```bash
yarn add langsmith
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls_...
```

Then start tracing your app!

```javascript
import { traceable } from "langsmith/traceable";
import { OpenAI } from "openai";

const client = new OpenAI();

const createCompletion = traceable(
openai.chat.completions.create.bind(openai.chat.completions),
{ name: "OpenAI Chat Completion", run_type: "llm" }
);

await createCompletion({
model: "gpt-3.5-turbo",
messages: [{ content: "Hi there!", role: "user" }],
});
```

```
{
id: 'chatcmpl-8sOWEOYVyehDlyPcBiaDtTxWvr9v6',
object: 'chat.completion',
created: 1707974654,
model: 'gpt-3.5-turbo-0613',
choices: [
{
index: 0,
message: { role: 'assistant', content: 'Hello! How can I help you today?' },
logprobs: null,
finish_reason: 'stop'
}
],
usage: { prompt_tokens: 10, completion_tokens: 9, total_tokens: 19 },
system_fingerprint: null
}
```

## Cookbook

For tutorials on how to get more value out of LangSmith, check out the [Langsmith Cookbook](https://github.com/langchain-ai/langsmith-cookbook/tree/main) repo.
Expand Down
3 changes: 3 additions & 0 deletions js/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Chinook_Sqlite.sql
/run_trees.cjs
/run_trees.js
/run_trees.d.ts
/traceable.cjs
/traceable.js
/traceable.d.ts
/evaluation.cjs
/evaluation.js
/evaluation.d.ts
Expand Down
Loading

0 comments on commit da0141f

Please sign in to comment.