{"id":15023855,"url":"https://github.com/sap/ai-sdk-js","last_synced_at":"2025-04-09T22:10:44.907Z","repository":{"id":247969980,"uuid":"817686552","full_name":"SAP/ai-sdk-js","owner":"SAP","description":"SAP Cloud SDK for AI is the official Software Development Kit (SDK) for SAP AI Core, SAP Generative AI Hub, and Orchestration Service.","archived":false,"fork":false,"pushed_at":"2025-04-09T09:07:53.000Z","size":3070,"stargazers_count":68,"open_issues_count":14,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T22:10:37.610Z","etag":null,"topics":["ai","chat","gen-ai","llm","orchestration","sap-ai-core","sap-generative-ai-hub","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAP.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2024-06-20T08:29:40.000Z","updated_at":"2025-04-09T08:57:27.000Z","dependencies_parsed_at":"2024-08-12T00:36:03.839Z","dependency_job_id":"5b3a2f35-c413-45f9-b03e-fc6dc322ca69","html_url":"https://github.com/SAP/ai-sdk-js","commit_stats":null,"previous_names":["sap/ai-sdk-js"],"tags_count":12,"template":false,"template_full_name":"SAP/repository-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Fai-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Fai-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Fai-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Fai-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAP","download_url":"https://codeload.github.com/SAP/ai-sdk-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119294,"owners_count":21050755,"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":["ai","chat","gen-ai","llm","orchestration","sap-ai-core","sap-generative-ai-hub","typescript"],"created_at":"2024-09-24T19:59:32.606Z","updated_at":"2025-04-09T22:10:44.899Z","avatar_url":"https://github.com/SAP.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![REUSE status](https://api.reuse.software/badge/github.com/SAP/ai-sdk-js)](https://api.reuse.software/info/github.com/SAP/ai-sdk-js)\n[![Fosstars security rating](https://github.com/SAP/ai-sdk-js/blob/fosstars/fosstars_badge.svg)](https://github.com/SAP/ai-sdk-js/blob/fosstars/fosstars_report.md)\n\n# SAP Cloud SDK for AI\n\nSAP Cloud SDK for AI is the official Software Development Kit (SDK) for **SAP AI Core**, **SAP Generative AI Hub**, and **Orchestration Service**.\n\nIntegrate chat completion into your business applications with SAP Cloud SDK for AI. \nLeverage the generative AI hub of [SAP AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/what-is-sap-ai-core) to make use of templating, grounding, data masking, content filtering and more. \nSet up your SAP AI Core instance with SAP Cloud SDK for AI.\n\n### Table of Contents\n\n- [Requirements and Setup](#requirements-and-setup)\n- [Packages](#packages)\n  - [@sap-ai-sdk/ai-api](#sap-ai-sdkai-api)\n  - [@sap-ai-sdk/foundation-models](#sap-ai-sdkfoundation-models)\n  - [@sap-ai-sdk/langchain](#sap-ai-sdklangchain)\n  - [@sap-ai-sdk/orchestration](#sap-ai-sdkorchestration)\n  - [@sap-ai-sdk/document-grounding](#sap-ai-sdkdocument-grounding)\n  - [@sap-ai-sdk/prompt-registry](#sap-ai-sdkprompt-registry)\n- [SAP Cloud SDK for AI Sample Project](#sap-cloud-sdk-for-ai-sample-project)\n- [Deprecated Models](#deprecated-models)\n- [Error Handling](#error-handling)\n  - [Accessing Error Information](#accessing-error-information)\n- [Local Testing](#local-testing)\n- [Support, Feedback, Contribution](#support-feedback-contribution)\n- [Security / Disclosure](#security--disclosure)\n- [Code of Conduct](#code-of-conduct)\n- [Licensing](#licensing)\n\n## Requirements and Setup\n\n- [Enable the AI Core service in SAP BTP](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/initial-setup).\n- Ensure the project is configured with **Node.js v20 or higher**, along with **native ESM** support.\n\nFor further details, refer to the individual sections under [Packages](#packages).\n\n## Packages\n\nThis project publishes multiple packages and is managed using [pnpm](https://pnpm.io/)\n\n### @sap-ai-sdk/ai-api\n\nThis package provides tools to manage your scenarios and workflows in SAP AI Core.\n\n- Streamline data preprocessing and model training pipelines.\n- Execute batch inference jobs.\n- Deploy inference endpoints for your trained models.\n- Register custom Docker registries, sync AI content from your own git repositories, and register your own object storage for training data and model artifacts.\n\n#### Installation\n\n```\n$ npm install @sap-ai-sdk/ai-api\n```\n\nFor details on the client, refer to this [document](https://github.com/SAP/ai-sdk-js/blob/main/packages/ai-api/README.md).\n\n### @sap-ai-sdk/foundation-models\n\nThis package incorporates generative AI foundation models into your AI activities in SAP AI Core and SAP AI Launchpad.\n\n#### Installation\n\n```\n$ npm install @sap-ai-sdk/foundation-models\n```\n\nFor details on foundation model clients, refer to this [document](https://github.com/SAP/ai-sdk-js/blob/main/packages/foundation-models/README.md).\n\n### @sap-ai-sdk/langchain\n\nThis package provides LangChain model clients, built on top of the foundation model clients of the SAP Cloud SDK for AI.\n\n#### Installation\n\n```\n$ npm install @sap-ai-sdk/langchain\n```\n\nFor details on LangChain model client, refer to this [document](https://github.com/SAP/ai-sdk-js/blob/main/packages/langchain/README.md).\n\n### @sap-ai-sdk/orchestration\n\nThis package incorporates generative AI [orchestration](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/orchestration) capabilities into your AI activities in SAP AI Core and SAP AI Launchpad.\n\n#### Installation\n\n```\n$ npm install @sap-ai-sdk/orchestration\n```\n\nFor details on orchestration client, refer to this [document](https://github.com/SAP/ai-sdk-js/blob/main/packages/orchestration/README.md).\n\n### @sap-ai-sdk/document-grounding\n\n\u003e [!warning]\n\u003e This package is still in **beta** and is subject to breaking changes. Use it with caution.\n\nThis package incorporates generative AI document grounding [Pipeline API](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/pipeline-api-a9badce6a4da4df68e98549d64aa2217), [Vector API](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/vector-api-0358c5ca839d4cf7b4982dbcbc1ba7ff) and [Retrieval API](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/retrieval-api) into your AI activities in SAP AI Core and SAP AI Launchpad.\n\n#### Installation\n\n```\n$ npm install @sap-ai-sdk/document-grounding\n```\n\nFor details on document grounding client, refer to this [document](https://github.com/SAP/ai-sdk-js/blob/main/packages/document-grounding/README.md).\n\n### @sap-ai-sdk/prompt-registry\n\nThis package incorporates generative AI [prompt registry](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/prompt-registry) into your AI activities in SAP AI Core and SAP AI Launchpad.\n\n#### Installation\n\n```\n$ npm install @sap-ai-sdk/prompt-registry\n```\n\nFor details on prompt registry client, refer to this [document](https://github.com/SAP/ai-sdk-js/blob/main/packages/prompt-registry/README.md).\n\n## SAP Cloud SDK for AI Sample Project\n\nWe have created a sample project demonstrating the different clients' usage of the SAP Cloud SDK for AI for TypeScript/JavaScript.\nThe [project README](https://github.com/SAP/ai-sdk-js/blob/main/sample-code/README.md) outlines the set-up needed to build and run it locally.\n\n## Deprecated Models\n\nThe following models are deprecated and should not be used.\nReplace them with the recommended alternatives.\n\n| Model Name                  | Replacement                                        |\n| --------------------------- | -------------------------------------------------- |\n| `text-embedding-ada-002`    | `text-embedding-3-small`, `text-embedding-3-large` |\n| `meta--llama3-70b-instruct` | `meta--llama3.1-70b-instruct`                      |\n| `gpt-35-turbo`              | `gpt-4o-mini`                                      |\n| `gpt-35-turbo-16k`          | `gpt-4o-mini`                                      |\n| `gpt-4-32k`                 | `gpt-4o`                                           |\n\nFor more information, refer to the SAP note on [Availability of Generative AI Models](https://me.sap.com/notes/3437766).\n\n## Error Handling\n\nA common error scenario is `Request failed with status code STATUS_CODE` coming from `AxiosError`. \nIn this case, SAP Cloud SDK for AI uses [`ErrorWithCause`](https://sap.github.io/cloud-sdk/docs/js/features/error-handling) to provide more detailed error information.\n\n### Accessing Error Information\n\nFor example, for the following nested `ErrorWithCause`\n\n```ts\nconst rootCause = new Error('The root cause is a bug!');\nconst lowerLevelErrorWithCause = new ErrorWithCause('Failed to call function foo().', rootCause);\nconst upperLevelErrorWithCause = new ErrorWithCause('Process crashed.', lowerLevelErrorWithCause);\nthrow upperLevelErrorWithCause;\n```\n\nThe error stack will look like this:\n\n```txt\nErrorWithCause: Process crashed.\n    at ...\nCaused by:\nErrorWithCause: Failed to call function foo().\n    at ...\nCaused by:\nError: The root cause is a bug!\n    at ...\n```\n\n- `error.stack` will contain the above stack trace.\n- `error.message` will be `Process crashed.`.\n- `error.cause.message` will be `Failed to call function foo().`.\n- `error.rootCause.message` will be `The root cause is a bug!`.\n\nIn case of `AxiosError`, the response data will be part of the error stack and can be accessed via `error.cause.response.data`.\n\n## Local Testing\n\nTo test SAP Cloud SDK for AI features locally during application development, follow these steps:\n\n1. Download a service key for the AI Core service instance.\n2. Set the downloaded service key as the `AICORE_SERVICE_KEY` environment variable in the local environment.\n\nThe SDK parses the service key from the environment variable to interact with the AI Core service.\nThis setup enables local testing of clients such as orchestration and OpenAI, provided that deployments for orchestration and OpenAI exist in SAP BTP.\n\n\u003e [!Tip]\n\u003e Ways to load environment variables might vary based on the framework you are using.\n\u003e\n\u003e For example, while the SAP Cloud SDK for AI uses the [dotenv](https://www.npmjs.com/package/dotenv) library to load environment variables, NextJS uses a [specific configuration](https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables) to load them.\n\n## Support, Feedback, Contribution\n\nThis project is open to feature requests, bug reports and questions via [GitHub issues](https://github.com/SAP/ai-sdk-js/issues).\n\nContribution and feedback are encouraged and always welcome.\nFor more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](https://github.com/SAP/ai-sdk-js/blob/main/CONTRIBUTING.md).\n\n## Security / Disclosure\n\nIf you find any bug that may be a security problem, please follow our instructions at [in our security policy](https://github.com/SAP/ai-sdk-js/security/policy) on how to report it.\nPlease do not create GitHub issues for security-related doubts or problems.\n\n## Code of Conduct\n\nWe as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone.\nBy participating in this project, you agree to abide by its [Code of Conduct](https://github.com/SAP/.github/blob/main/CODE_OF_CONDUCT.md) at all times.\n\n## Licensing\n\nCopyright 2024 SAP SE or an SAP affiliate company and ai-sdk-js contributors.\nPlease see our [LICENSE](LICENSE) for copyright and license information.\nDetailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/ai-sdk-js).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap%2Fai-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsap%2Fai-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap%2Fai-sdk-js/lists"}