{"id":27005677,"url":"https://github.com/relevanceai/relevance-chain-sdk","last_synced_at":"2025-04-04T07:17:06.389Z","repository":{"id":165806149,"uuid":"639287177","full_name":"RelevanceAI/relevance-chain-sdk","owner":"RelevanceAI","description":"The managed, developer-first SDK for building LLM chains.","archived":false,"fork":false,"pushed_at":"2023-12-13T01:01:06.000Z","size":635,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-01T05:33:27.440Z","etag":null,"topics":["chains","llm","sdk"],"latest_commit_sha":null,"homepage":"https://documentation.relevanceai.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RelevanceAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-11T06:52:58.000Z","updated_at":"2025-02-18T13:01:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e5ce6ea-8d5b-44b3-86a7-4ce4b2df0b69","html_url":"https://github.com/RelevanceAI/relevance-chain-sdk","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":0.1515151515151515,"last_synced_commit":"a5309c38faff85e8bd37232bda7cda3f7b242877"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RelevanceAI%2Frelevance-chain-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RelevanceAI%2Frelevance-chain-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RelevanceAI%2Frelevance-chain-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RelevanceAI%2Frelevance-chain-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RelevanceAI","download_url":"https://codeload.github.com/RelevanceAI/relevance-chain-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135128,"owners_count":20889421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chains","llm","sdk"],"created_at":"2025-04-04T07:17:05.284Z","updated_at":"2025-04-04T07:17:06.371Z","avatar_url":"https://github.com/RelevanceAI.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Relevance AI Chain SDK\n\n\u003cdiv align=\"center\"\u003e\n\n![Relevance AI stack](head-illustration.png)\n\n[![npm](https://img.shields.io/npm/dw/@relevanceai/chain)](https://www.npmjs.com/package/@relevanceai/chain)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/relevanceai/relevance-chain-sdk)](https://github.com/RelevanceAI/relevance-chain-sdk)\n[![Discord](https://img.shields.io/discord/1107542094672842762)](https://discord.com/invite/8VHJJrQZMM) \n[![Twitter Follow](https://img.shields.io/twitter/follow/relevanceai_?style=social)](https://twitter.com/RelevanceAI_)\n\n\u003c/div\u003e\n\nThe managed, developer-first SDK for building LLM chains.\n\n## 🔨 Installation\n\nGet started with the SDK and CLI by installing it with the following line:\n```sh\nnpm i -g @relevanceai/chain\n```\n\n## 🏃‍♀️ Quickstart\n\nAuthenticate into your Relevance AI account\n```sh\nrelevance login\n```\n\nCreate a `/chains` folder with a file for each chain\n```\n/chains\n- pdf-qa.ts\n- generate-sql.ts\n- generate-configs.ts\n```\n\nRepresent 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`.\n```typescript\nimport { defineChain } from '@relevanceai/chain';\n\nexport default defineChain(\n    {\n        title: 'PDF Q\u0026A',\n        params: {\n            question: { type: 'string' },\n            file_url: { type: 'string' }\n        }\n    },\n    setup(({ params, step }) =\u003e {\n        const { question, file_url } = params;\n\n        const { text } = step('pdf_to_text', { file_url });\n        const { answer } = step('prompt_completion', { \n            prompt: `${text}\\n Based on the above context, answer the question ${question}` \n        });\n\n        return {\n            answer\n        };\n    })\n});\n```\n\nDeploy the chains\n```sh\nrelevance deploy\n```\n\n## Documentation\n\nSee our full documentation [here](https://documentation.relevanceai.com).\n\n\n# Re-generating \u0026 publishing transformation types\n\nRun `scripts/update-codegen.sh` and publish the draft release that gets created.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelevanceai%2Frelevance-chain-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frelevanceai%2Frelevance-chain-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelevanceai%2Frelevance-chain-sdk/lists"}