https://github.com/relevanceai/relevance-chain-sdk
The managed, developer-first SDK for building LLM chains.
https://github.com/relevanceai/relevance-chain-sdk
chains llm sdk
Last synced: 6 months ago
JSON representation
The managed, developer-first SDK for building LLM chains.
- Host: GitHub
- URL: https://github.com/relevanceai/relevance-chain-sdk
- Owner: RelevanceAI
- Created: 2023-05-11T06:52:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-13T01:01:06.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T05:33:27.440Z (6 months ago)
- Topics: chains, llm, sdk
- Language: TypeScript
- Homepage: https://documentation.relevanceai.com
- Size: 620 KB
- Stars: 6
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Relevance AI Chain SDK

[](https://www.npmjs.com/package/@relevanceai/chain)
[](https://github.com/RelevanceAI/relevance-chain-sdk)
[](https://discord.com/invite/8VHJJrQZMM)
[](https://twitter.com/RelevanceAI_)The managed, developer-first SDK for building LLM chains.
## 🔨 Installation
Get started with the SDK and CLI by installing it with the following line:
```sh
npm i -g @relevanceai/chain
```## 🏃♀️ Quickstart
Authenticate into your Relevance AI account
```sh
relevance login
```Create a `/chains` folder with a file for each chain
```
/chains
- pdf-qa.ts
- generate-sql.ts
- generate-configs.ts
```Represent the chain in code exporting `defineChain` and configure the chain. The first argument is a config of the chain and the input schema. The second argument is the `setup` function which is used to define the chain with each `step`.
```typescript
import { defineChain } from '@relevanceai/chain';export default defineChain(
{
title: 'PDF Q&A',
params: {
question: { type: 'string' },
file_url: { type: 'string' }
}
},
setup(({ params, step }) => {
const { question, file_url } = params;const { text } = step('pdf_to_text', { file_url });
const { answer } = step('prompt_completion', {
prompt: `${text}\n Based on the above context, answer the question ${question}`
});return {
answer
};
})
});
```Deploy the chains
```sh
relevance deploy
```## Documentation
See our full documentation [here](https://documentation.relevanceai.com).
# Re-generating & publishing transformation types
Run `scripts/update-codegen.sh` and publish the draft release that gets created.