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

build python sdk reference into docs #557

Merged
merged 25 commits into from
Dec 3, 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
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
install-vercel-deps:
yum -y update
yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip rsync -y

PYTHON = .venv/bin/python

build-api-ref:
git clone -b bagatur/update_py_api_ref --depth=1 https://github.com/langchain-ai/langsmith-sdk.git
python3 -m venv .venv
. .venv/bin/activate
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install --upgrade uv
cd langsmith-sdk && ../$(PYTHON) -m uv pip install -r python/docs/requirements.txt
$(PYTHON) langsmith-sdk/python/docs/create_api_rst.py
LC_ALL=C $(PYTHON) -m sphinx -T -E -b html -d langsmith-sdk/python/docs/_build/doctrees -c langsmith-sdk/python/docs langsmith-sdk/python/docs langsmith-sdk/python/docs/_build/html -j auto
$(PYTHON) langsmith-sdk/python/docs/scripts/custom_formatter.py langsmith-sdk/docs/_build/html/


vercel-build: install-vercel-deps build-api-ref
mkdir -p static/reference/python
mv langsmith-sdk/python/docs/_build/html/* static/reference/python/
rm -rf langsmith-sdk
NODE_OPTIONS="--max-old-space-size=5000" yarn run docusaurus build

2 changes: 1 addition & 1 deletion docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Technical reference that covers components, APIs, and other aspects of LangSmith

### SDK

- [Python SDK Reference](https://langsmith-sdk.readthedocs.io/en/latest/)
- [Python SDK Reference](https://langsmith-docs-git-bagatur-rfcbuiltinsdkref-langchain.vercel.app/reference/python)
- [LangChain off-the-shelf evaluators (Python only)](./reference/sdk_reference/langchain_evaluators)

### Common data types
Expand Down
14 changes: 12 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,19 @@ const config = {
position: "right",
},
{
href: "https://api.smith.langchain.com/redoc",
label: "Go to API Docs",
type: "dropdown",
label: "API Reference",
position: "left",
items: [
{
label: "REST",
href: "https://api.smith.langchain.com/redoc",
},
{
label: "Python",
to: "https://langsmith-docs-git-bagatur-rfcbuiltinsdkref-langchain.vercel.app/reference/python",
},
],
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"docusaurus": "docusaurus",
"test": "jest",
"start": "rm -rf ./docs/api && docusaurus start",
"build": "rm -rf ./build && docusaurus build",
"vercel-build": "git submodule update --init --recursive && python3 -m ensurepip --default-pip && python3 -m pip install -r subdirectories/scripts/requirements.txt && python3 subdirectories/scripts/build_cookbook.py && ls docs && npm run build",
"build": "make vercel-build",
"vercel-build": "ls .; cat Makefile; make vercel-build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand Down
4 changes: 4 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@
{
"source": "/evaluation/how_to_guides/human_feedback/:path*",
"destination": "/evaluation/how_to_guides/:path*"
},
{
"source": "/reference/python(/?)",
"destination": "/reference/python/reference"
}
],
"builds": [
Expand Down
Loading