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

Brace/js mono #645

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .github/actions/js-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ runs:
- name: Install Yarn dependencies
run: yarn install
shell: bash
working-directory: js
working-directory: js/langsmith

- name: Run JS integration tests
run: yarn test:integration
shell: bash
working-directory: js
working-directory: js/langsmith
env:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/js_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: "js"
working-directory: "js/langsmith"
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@ cython_debug/
.DS_Store

.envrc

.turbo
node_modules/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ client.chat.completions.create(
)
```

To get started with the JavaScript / TypeScript SDK, [install the package](https://www.npmjs.com/package/langsmith), then follow the instructions in the [JS README](js/README.md).
To get started with the JavaScript / TypeScript SDK, [install the package](https://www.npmjs.com/package/langsmith), then follow the instructions in the [JS README](js/langsmith/README.md).

```bash
yarn add langsmith
Expand Down
3 changes: 3 additions & 0 deletions js/api_refs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
41 changes: 41 additions & 0 deletions js/api_refs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Autogenerated docs
/public/*
/langchain
/langchain-core
4 changes: 4 additions & 0 deletions js/api_refs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public/
.next/
.turbo
node_modules/
11 changes: 11 additions & 0 deletions js/api_refs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Auto-generated API documentation for the LangSmith SDK (JS/TS)

Do not edit the contents of this directory directly.

## Usage

To build the API refs run `yarn build` from the root of this directory, then `yarn dev` or `yarn start` to serve the docs locally.
This app uses [Typedoc](https://typedoc.org/) to generate API references from the source code. The generated HTML is then placed inside the `/public` directory, which is served by [Next.js](https://nextjs.org/).
There is a default redirect when requests are made to `/` which redirects to `/index.html`.

The API references are gitignored by default, so they will not be committed to the repo.
14 changes: 14 additions & 0 deletions js/api_refs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
async redirects() {
return [
{
source: "/",
destination: "/index.html",
permanent: false,
},
];
},
};

module.exports = nextConfig;
35 changes: 35 additions & 0 deletions js/api_refs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "api-refs-js",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
"typedoc:build": "npx typedoc --options typedoc.json",
"build:scripts": "yarn typedoc:build && node ./scripts/update-typedoc-css.js",
"build": "yarn clean && yarn build:scripts && next build",
"build:vercel": "yarn clean && yarn build:scripts && next build",
"start": "yarn build && next start -p 3001",
"lint": "next lint",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx}\"",
"clean": "rm -rf .next .turbo public/ && mkdir public"
},
"dependencies": {
"next": "14.0.1",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"postcss": "^8",
"prettier": "^2.8.3",
"tailwindcss": "^3.3.0",
"typedoc": "^0.25.6",
"typescript": "~5.1.6"
}
}
6 changes: 6 additions & 0 deletions js/api_refs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
30 changes: 30 additions & 0 deletions js/api_refs/scripts/update-typedoc-css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { readFile, writeFile } = require("fs/promises");

async function main() {
const css = `\n.tsd-navigation {
word-break: break-word;
}

.col-content {
min-width: fit-content;
}

.page-menu {
display: none;
}

.deprecation-warning {
background-color: #ef4444;
border-radius: 0.375rem;
display: flex;
flex-direction: column;
padding: 12px;
text-align: left;
}
`;

let file = await readFile("./public/assets/style.css", "utf-8");
file += css;
await writeFile("./public/assets/style.css", file);
}
main();
Binary file added js/api_refs/src/app/favicon.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions js/api_refs/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Config } from "tailwindcss";

const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
plugins: [],
};
export default config;
27 changes: 27 additions & 0 deletions js/api_refs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
28 changes: 28 additions & 0 deletions js/api_refs/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://typedoc.org/schema.json",
"out": "public",
"sort": [
"kind",
"visibility",
"instance-first",
"required-first",
"alphabetical"
],
"plugin": [
"./typedoc_plugins/hide_underscore_lc.js"
],
"tsconfig": "../langsmith/tsconfig.json",
"readme": "none",
"excludePrivate": true,
"excludeInternal": true,
"excludeExternals": true,
"excludeNotDocumented": false,
"includeVersion": true,
"sourceLinkTemplate": "https://github.com/langchain-ai/langsmith-sdk/blob/{gitRevision}/{path}#L{line}",
"logLevel": "Error",
"name": "LangSmith SDK (JS/TS)",
"skipErrorChecking": true,
"exclude": [
"dist"
]
}
Loading
Loading