Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@sap-ai-sdk/document-grounding
Advanced tools
> [!warning] > This package is still in **beta** and is subject to breaking changes. Use it with caution.
[!warning] This package is still in beta and is subject to breaking changes. Use it with caution.
SAP Cloud SDK for AI is the official Software Development Kit (SDK) for SAP AI Core, SAP Generative AI Hub, and Orchestration Service.
This package incorporates generative AI document grounding capabilities into your AI activities in SAP AI Core and SAP AI Launchpad.
$ npm install @sap-ai-sdk/document-grounding
Accessing the AI Core Service via the SDK
The SDK automatically retrieves the
AI Core
service credentials and resolves the access token needed for authentication.
- In Cloud Foundry, it's accessed from the
VCAP_SERVICES
environment variable.- In Kubernetes / Kyma environments, you have to mount the service binding as a secret instead, for more information refer to this documentation.
The examples below demonstrate the usage of the most commonly used APIs in SAP AI Core document grounding service. In addition to the examples below, you can find more sample code here.
import
const response =
await VectorApi.createCollection(
{
title: 'ai-sdk-js-e2e',
embeddingConfig: {
modelName: 'text-embedding-ada-002-v2'
},
metadata: []
},
{
'AI-Resource-Group': 'default'
}
).executeRaw();
const collectionId = (response.headers.location as string).split('/').at(-2);
const response: DocumentsListResponse = await VectorApi.createDocuments(
collectionId,
{
documents: [
{
metadata: [],
chunks: [
{
content:
'SAP Cloud SDK for AI is the official Software Development Kit (SDK) for SAP AI Core, SAP Generative AI Hub, and Orchestration Service.',
metadata: []
}
]
}
]
},
{
'AI-Resource-Group': 'default'
}
).execute();
When calling the execute()
method, it is possible to provide a custom destination.
For example, when querying deployments targeting a destination with the name my-destination
, the following code can be used:
const response = await VectorApi.deleteCollectionById(collectionId, {
'AI-Resource-Group': 'default'
}).execute({
destinationName: 'my-destination'
});
For local testing instructions, refer to this section.
Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
The SAP Cloud SDK for AI is released under the Apache License Version 2.0.
FAQs
> [!warning] > This package is still in **beta** and is subject to breaking changes. Use it with caution.
We found that @sap-ai-sdk/document-grounding demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.