0.2.7 • Published 5 months ago
@beparallel/langchain-ts v0.2.7
@beparallel/langchain-ts
A TypeScript tool for extracting Langchain prompts and generating corresponding TypeScript types.
Features
- Extracts prompts from Langchain Hub
- Generates TypeScript interfaces for prompt inputs and outputs
- Automatically handles JSON schema conversion
- Command-line interface for easy integration
Installation
- Install the package
pnpm i @beparallel/langchain-ts- Set the environment variables in your
.envfile
LANGCHAIN_API_KEY=your_api_key
LANGCHAIN_TAG=your_tag- Set up the script in your
package.jsonfile
"scripts": {
...
"prompt:generate": "dotenv -f .env.* run -- npx langchain-types --file=X"
}Where X = the path to the file where you want to save the types.
- Run the script
pnpm prompt:generateContributing
Installation
pnpm iUsage
- Add the environment variables in your
.envfile
LANGCHAIN_API_KEY=your_api_key
LANGCHAIN_TAG=your_tag- Export them
export LANGCHAIN_API_KEY=your_api_key
export LANGCHAIN_TAG=your_tag- Run the script
pnpm prompt:generateRelease
- Update the version in the
package.jsonfile. - Run the following command to update the types.
pnpm prepublish- Run npm publish command
npm publish --access public- Commit and push the changes.
- Create a new release on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.