Setting up Document Grounding for Joule with Google Drive
Share

[[{“value”:”

SAP’s document grounding service lets you connect Joule to your company’s internal documents, so it can answer questions grounded in your actual content rather than relying on general training data.  Since recently Google Drive is available as a data source for Document Grounding, which opens this capability up to organizations running on Google Workspace 🎉 

This post walks through the complete setup enabling Document Grounding for Google Drive: from creating a BTP service instance to configuring a GCP service account, wiring up a BTP destination, and creating an ingestion pipeline that indexes your Google Drive documents. The result is a grounding instance ready to serve vector search queries.

A few things that make Google Drive a practical choice here. There is no agent or connector to install in your Drive environment. Native Google Docs and Google Slides are automatically converted to DOCX and PPTX during ingestion. And if your documents already live in a shared drive or shared folder, you can get grounding running without reorganizing anything.

For the full official documentation, see Set Up Document Grounding on SAP Help Portal.

Note: If you are looking for a setup guide for Microsoft SharePoint instead, I highly recommend visiting the blog from @nageshcaparthy : Joule – Getting Started with Document Grounding – setup guide – 1


What You’ll Set Up

Here is what this post covers, in order:

  1. Document Grounding service instance on BTP with Cloud Identity Services authentication
  2. GCP service account with credentials that SAP BTP can use to read your Drive
  3. BTP destination that holds the Google Drive connection configuration
  4. Ingestion pipeline that connects the destination to the grounding service and indexes your documents

The BTP destination holds your GCP credentials. The pipeline references that destination to reach Google Drive. The grounding service processes incoming documents into vector embeddings and stores them for search.


Prerequisites

Before you start, make sure you have:

  • Active Joule instance connected to an IAS tenant in your BTP subaccount (see Establish a Unified Joule Instance)
  • BTP subaccount with document grounding entitlement. Entitlements are added automatically to your global account when you purchase AI Units.
  • GCP Console access with permission to create service accounts and download keys
  • Google Drive folder or shared drive containing the documents you want to index, with permission to share access
  • BTP Cockpit access with permissions to create service instances and destinations in your Joule subaccount
  • curl or an API testing tool (e.g. Bruno) for pipeline creation (there is no BTP Cockpit UI for this step)

 

Step 1: Create the Document Grounding Service Instance

Create the Service Instance

Open the BTP Cockpit and navigate to your Joule subaccount. Go to Services > Service Marketplace and search for “Document Grounding”. Select the tile and choose Create. Set the Runtime Environment (in this case I chose Other), give the instance a name (you will need this name in the next sub-section), and confirm.

btp-create-doc-grounding-instance.png

Once the instance is created, open it and create a service binding:

 

btp-docgrounding-binding.png

Give the binding a name such as “docgrounding-binding” and confirm. When the binding is created, open its details and copy the url value. This is the base URL for all document grounding API calls. It could look like this:

https://mtls.rage.<id>.kyma.ondemand.com

 

Set Up Authentication

The grounding service API uses bearer token authentication. To get tokens, you create a Cloud Identity Services instance linked to your document grounding instance.

Back in Service Marketplace, search for “Cloud Identity Services” and create a new instance. Set the plan to application, the Runtime Environment (in this case I chose Other), and enter a name.

btp-create-cis-instance.png

On the parameters screen, provide the following JSON, substituting your document grounding instance name:

{
“consumed-services”: [
{ “service-instance-name”: “<your-doc-grounding-instance-name>” }
]
}

This is how it looks like:

btp-create-cis-service.png

 

Once this instance exists, navigate to it via Instances and Subscriptions and create a service binding for it with these parameters:

{
“credential-type”: “X509_GENERATED”,
“validity”: 365,
“validity-type”: “DAYS”
}

btp-create-cis-binding.png

This generates an X.509 certificate that expires after a year. Open the service binding details and copy these four values: clientid, certificate, key, and authorization_endpoint.

 

Get a Bearer Token

Create two files from the certificate and key values. The JSON stores them with literal n characters rather than real line breaks, so you need to convert them.

On macOS: Open e.g. a Text Editor, Visual Studio Code or another text tool. Copy this bash command in it:

echo ‘<certificate-value>’ | sed ‘s/\n/n/g’ > doc-grounding.crt

Get the copied certificate value from the service binding and add it in the bash command. Open a terminal and provide the full bash command, press enter. This should create a doc-grounding.crt file in the current folder you are in.

Repeat the same step again but use this time the following bash command together with the key value from the service binding.

echo ‘<key-value>’ | sed ‘s/\n/n/g’ > doc-grounding.key

On Windows PowerShell: Follow the same instructions as for macOS above with the below PowerShell commands.

[System.IO.File]::WriteAllText("doc-grounding.crt", '<certificate-value>'.Replace('n', "`n"))
[System.IO.File]::WriteAllText("doc-grounding.key", '<key-value>'.Replace('n', "`n"))

Edit the authorization_endpoint value from the service binding by replacing /oauth2/authorize at the end with /oauth2/token, like for example https://<ias-tenant-id>.accounts.ondemand.com/oauth2/token. Enter the clientid value from the service binding. Then request a token using curl or API tools like Bruno. Here is a sample curl request:

curl
–request POST
–url “<edited-authorization-endpoint>”
–header “accept: application/json”
–header “content-type: application/x-www-form-urlencoded”
–data “client_id=<clientid>”
–data “grant_type=client_credentials”
–cert doc-grounding.crt
–key doc-grounding.key

For the sake of user experience, let’s see how it looks like in Bruno:

Start by creating a new collection (e.g. grounding-blog-post) and adding a POST request named “Get Token”. Open the collection settings via the ... menu next to the collection name.

bruno-collection-sidebar.png

Go to the Client Certificates tab in the collection settings. Now we have to add the certificate and the key twice: Once for the IAS tenant domain in order to get the bearer token, and a second time with the document grounding url as domain with the document grounding url to interact with the document grounding service.

Starting with the first client certificate, as Domain the IAS tenant will be used (e.g. https://<ias-tenant-id>.accounts.ondemand.com). Then, set the Cert file to doc-grounding.crt and the Key file to doc-grounding.key. Leave Passphrase empty. Click Add, then Save.

bruno-client-certificates.png

Afterwards, repeat the steps and only change the domain. You can use the authorization_endpoint base url (or url field from document grounding service binding).

Once saved, the configured certificates appear in the list. Repeat the same for the mtls url which is the service-binding-url.

bruno-client-certificates-list.png

In the request, set the URL to your authorization_endpoint with /oauth2/token at the end. Open the Body tab, select Form URL Encoded, and add the two fields: client_id with your client ID value, and grant_type set to client_credentials.

 

bruno-body-form-urlencoded.png

Send the request. A 200 OK response with an access_token in the body confirms that authentication is working.

 

bruno-token-response.png

Copy the access_token value from the response. You will use this for all subsequent API calls, including pipeline creation in Step 4.

 

Verify the Connection

Test that your service URL and token work together. In Bruno, send a GET request to <service-binding-url>/pipeline/api/v1/pipeline with an Accept: application/json header and your bearer token as the Authorization header.

bruno-get-pipeline.png

An empty array [] means the connection works and you have no pipelines yet. That is the expected response at this point.


 

Step 2: Create a GCP Service Account

The document grounding service needs machine-to-machine access to Google Drive. A service account gives it that without requiring a human user to go through an OAuth consent screen. You share specific Drive content with the service account, and the BTP destination holds the credentials.

Create a GCP Project

If you do not have a GCP project yet, open the GCP Console and create one. Give it a descriptive name like docgrounding-btp-gdrive so its purpose is clear. Note the Project ID — you cannot change it later.

gdrive-create-project.png

Enable the Google Drive API

Before creating a service account, make sure the Google Drive API is enabled in your GCP project. Navigate to APIs & Services in the GCP Console and click Enable APIs and services.

gcp-apis-enable.png

 

Search for “Google Drive” and select Google Drive API from the results.

gcp-api-library-search.png

Enable it if it is not already active. Without this, service account credentials will not be able to access Drive content even if the sharing is configured correctly.

 

Create the Service Account

Open the GCP Console and navigate to IAM & Admin > Service Accounts. Create a new service account. The name is your choice; something like btp-doc-grounding makes the purpose clear. You do not need to assign any GCP IAM roles to this service account. Access to specific Drive content is granted through Drive sharing, not through IAM roles.

gcp-create-service-account.png

 

Generate a Key

Select your service account, go to the Keys tab, and choose Add Key > Create new key. Select JSON format and download the file. Keep it secure. It contains the private key that BTP will use to authenticate with Google’s OAuth token endpoint.

gcp-create-key.png

The JSON structure looks like this:

{
“type”: “service_account”,
“project_id”: “<your-gcp-project>”,
“private_key_id”: “abc123”,
“private_key”: “—–BEGIN PRIVATE KEY—–n…n—–END PRIVATE KEY—–n”,
“client_email”: “btp-doc-grounding@<your-project>.iam.gserviceaccount.com”,
“client_id”: “123456789012342278901”,
“auth_uri”: “https://accounts.google.com/o/oauth2/auth”,
“token_uri”: “https://oauth2.googleapis.com/token”,
“auth_provider_x509_cert_url”: “https://www.googleapis.com/oauth2/v1/certs”,
“client_x509_cert_url”: “https://www.googleapis.com/robot/v1/metadata/x509/btp-doc-grounding@<your-project>.iam.gserviceaccount.com”,
“universe_domain”: “googleapis.com”
}

The fields you will use in the next step:

 

JSON Field Where You Will Use It
client_id BTP destination Client ID field
private_key BTP destination additional property private_key
client_email BTP destination additional property client_email
auth_uri BTP destination additional property auth_uri

 

Share Your Drive Content with the Service Account

Navigate to the Google Drive folder or shared drive you want to index. For this example we go with a shared folder. Use Share and add the client_email value from the JSON as a member. Set the permission to Viewer. Read access is all the ingestion pipeline needs.

gdrive-share-with-service-account.png

Once shared, you can see the folder with the documents you plan to index.

gdrive-folder-contents.png

Here is a sample document in that folder that will be indexed through this pipeline:

gdrive-sample-document.png

While you are in Drive, note the folder ID from the URL. For a shared folder, the URL looks like:

https://drive.google.com/drive/folders/1ABCdefGHIjklMNOpqrSTUvwxYZ
                                       └── this is your folder ID

For a shared drive, open it and grab the ID from the URL after /drive/. You will need this ID when creating the pipeline in Step 4.


 

Step 3: Configure the BTP Destination

The BTP destination holds your Google Drive connection configuration. The pipeline will reference this destination by name, so the grounding service knows how to authenticate with Google’s API.

Open Connectivity > Destinations in your BTP Cockpit and create a new destination with the following main properties:

 

Property Value
Name Your choice (e.g. GoogleDrive_DocGrounding)
Type HTTP
URL https://googleapis.com/drive/v3
Proxy Type Internet
Authentication OAuth2ClientCredentials
Client ID <client_id from service account JSON>
Client Secret Leave empty
Token Service URL https://oauth2.googleapis.com/token

Then add these additional properties:

 

Property Value
private_key The full private_key value from the JSON, including the header and footer lines
client_email The client_email from the JSON
auth_uri https://accounts.google.com/o/oauth2/auth

Save the destination and use Check Connection to verify. A successful response confirms that BTP can reach the Google Drive API using the service account credentials.

btp-destination-details.png


 

Step 4: Create the Ingestion Pipeline

The pipeline tells the grounding service what to index. It connects your BTP destination to a specific Google Drive folder or shared drive and runs the ingestion process. Pipeline creation happens through the grounding service API, not through the BTP Cockpit.

Here is the curl request for a shared folder:

curl
–request POST
–url “<service-binding-url>/pipeline/api/v1/pipeline”
–header “Authorization: Bearer <access_token>”
–header “content-type: application/json”
–cert doc-grounding.crt
–key doc-grounding.key
–data ‘{
“type”: “GoogleDrive”,
“configuration”: {
“destination”: “<your-destination-name>”,
“googleDrive”: {
“resourceType”: “SHARED_FOLDER”,
“resourceId”: “<your-folder-id>”,
“includePaths”: [“/**”]
}
}
}’

The response is a JSON object with a pipelineId. Save this ID. You will use it to check ingestion status.

Here is how the request and response look in Bruno (You can copy the data JSON from the curl request above):

bruno-pipeline-creation-response.png

Here is what each field does:

  • type: Must be "GoogleDrive" (case-sensitive).
  • destination: The name of the BTP destination you created in Step 3.
  • resourceType: Either SHARED_FOLDER or SHARED_DRIVE. Use the one that matches what you shared with the service account.
  • resourceId: The folder or shared drive ID from the Drive URL.
  • includePaths: Glob patterns for which files to index. ["/**"] indexes everything, but as this parameter is optional, this can be omitted as well. Use ["/policies/**"] to limit to a specific subfolder.

 

SHARED_FOLDER vs SHARED_DRIVE

 

Resource Type When to Use
SHARED_FOLDER You shared a specific folder within My Drive or a shared drive
SHARED_DRIVE You shared an entire shared drive

If you leave resourceId empty, the pipeline runs in auto-discovery mode and indexes all shared drives and folders the service account can read. This is convenient for testing but less controlled for production use.

 

Supported File Types

The grounding service ingests these formats from Google Drive:

DOCX, HTML, JPEG, JPG, JSON, PDF, PNG, PPTX, TIFF, TXT.

Despite that, Document Grounding using Google Drive extends the existing support for DOCX and PPTX with processing of native Google Docs and Google Slides.

For more information and availability, see SAP Document Grounding setup documentation.


 

Verify the Setup

Check Pipeline Status

Use the pipeline ID from the creation response to check ingestion progress:

curl
–request GET
–url “<service-binding-url>/pipeline/api/v1/pipeline/<pipeline-id>”
–header “Authorization: Bearer <access_token>”
–cert doc-grounding.crt
–key doc-grounding.key

The response includes the pipeline status and a document count. Ingestion for small document sets typically completes within a few minutes. Larger sets take longer.

When ingestion is complete, the status field shows FINISHED.

bruno-pipeline-status-response.png

You can also list the indexed documents by calling <service-binding-url>/pipeline/api/v1/pipeline/<pipeline-id>/executions/<execution-id>/documents. Each indexed document appears with its title, status INDEXED, and a link back to the original Google Drive file.

 

bruno-pipeline-documents-response.png

Note: You first have to get the execution id via this request url:

<service-binding-url>/pipeline/api/v1/pipeline/<pipeline-id>/executions

 

Test a Search Query

Now open your Joule Instance that is connected to your IAS. This can be done via Instances and Subscriptions in the BTP Subaccount, then open the Joule instance. Append to your url /webclient/standalone/sap_digital_assistant to open the standalone Joule web client. The full url looks something like that:

https://<tenant>.<region>.sapdas.cloud.sap/webclient/standalone/sap_digital_assistant.

Then provide a prompt that is matching your uploaded document(s).

And here is Joule answering a question about that document’s content, with the source citation pointing back to the original file:

joule-grounding-result.png


And with that, your Google Drive documents are now indexed and searchable through the document grounding service!


Related resources:

“}]] 

 [[{“value”:”SAP’s document grounding service lets you connect Joule to your company’s internal documents, so it can answer questions grounded in your actual content rather than relying on general training data.  Since recently Google Drive is available as a data source for Document Grounding, which opens this capability up to organizations running on Google Workspace 🎉 This post walks through the complete setup enabling Document Grounding for Google Drive: from creating a BTP service instance to configuring a GCP service account, wiring up a BTP destination, and creating an ingestion pipeline that indexes your Google Drive documents. The result is a grounding instance ready to serve vector search queries.A few things that make Google Drive a practical choice here. There is no agent or connector to install in your Drive environment. Native Google Docs and Google Slides are automatically converted to DOCX and PPTX during ingestion. And if your documents already live in a shared drive or shared folder, you can get grounding running without reorganizing anything.For the full official documentation, see Set Up Document Grounding on SAP Help Portal.Note: If you are looking for a setup guide for Microsoft SharePoint instead, I highly recommend visiting the blog from @nageshcaparthy : Joule – Getting Started with Document Grounding – setup guide – 1What You’ll Set UpHere is what this post covers, in order:Document Grounding service instance on BTP with Cloud Identity Services authenticationGCP service account with credentials that SAP BTP can use to read your DriveBTP destination that holds the Google Drive connection configurationIngestion pipeline that connects the destination to the grounding service and indexes your documentsThe BTP destination holds your GCP credentials. The pipeline references that destination to reach Google Drive. The grounding service processes incoming documents into vector embeddings and stores them for search.PrerequisitesBefore you start, make sure you have:Active Joule instance connected to an IAS tenant in your BTP subaccount (see Establish a Unified Joule Instance)BTP subaccount with document grounding entitlement. Entitlements are added automatically to your global account when you purchase AI Units.GCP Console access with permission to create service accounts and download keysGoogle Drive folder or shared drive containing the documents you want to index, with permission to share accessBTP Cockpit access with permissions to create service instances and destinations in your Joule subaccountcurl or an API testing tool (e.g. Bruno) for pipeline creation (there is no BTP Cockpit UI for this step) Step 1: Create the Document Grounding Service InstanceCreate the Service InstanceOpen the BTP Cockpit and navigate to your Joule subaccount. Go to Services > Service Marketplace and search for “Document Grounding”. Select the tile and choose Create. Set the Runtime Environment (in this case I chose Other), give the instance a name (you will need this name in the next sub-section), and confirm.Once the instance is created, open it and create a service binding: Give the binding a name such as “docgrounding-binding” and confirm. When the binding is created, open its details and copy the url value. This is the base URL for all document grounding API calls. It could look like this:https://mtls.rage.<id>.kyma.ondemand.com Set Up AuthenticationThe grounding service API uses bearer token authentication. To get tokens, you create a Cloud Identity Services instance linked to your document grounding instance.Back in Service Marketplace, search for “Cloud Identity Services” and create a new instance. Set the plan to application, the Runtime Environment (in this case I chose Other), and enter a name.On the parameters screen, provide the following JSON, substituting your document grounding instance name:{
“consumed-services”: [
{ “service-instance-name”: “<your-doc-grounding-instance-name>” }
]
}This is how it looks like: Once this instance exists, navigate to it via Instances and Subscriptions and create a service binding for it with these parameters:{
“credential-type”: “X509_GENERATED”,
“validity”: 365,
“validity-type”: “DAYS”
}This generates an X.509 certificate that expires after a year. Open the service binding details and copy these four values: clientid, certificate, key, and authorization_endpoint. Get a Bearer TokenCreate two files from the certificate and key values. The JSON stores them with literal n characters rather than real line breaks, so you need to convert them.On macOS: Open e.g. a Text Editor, Visual Studio Code or another text tool. Copy this bash command in it:echo ‘<certificate-value>’ | sed ‘s/\n/n/g’ > doc-grounding.crtGet the copied certificate value from the service binding and add it in the bash command. Open a terminal and provide the full bash command, press enter. This should create a doc-grounding.crt file in the current folder you are in.Repeat the same step again but use this time the following bash command together with the key value from the service binding.echo ‘<key-value>’ | sed ‘s/\n/n/g’ > doc-grounding.keyOn Windows PowerShell: Follow the same instructions as for macOS above with the below PowerShell commands.[System.IO.File]::WriteAllText(“doc-grounding.crt”, ‘<certificate-value>’.Replace(‘n’, “`n”))
[System.IO.File]::WriteAllText(“doc-grounding.key”, ‘<key-value>’.Replace(‘n’, “`n”))Edit the authorization_endpoint value from the service binding by replacing /oauth2/authorize at the end with /oauth2/token, like for example https://<ias-tenant-id>.accounts.ondemand.com/oauth2/token. Enter the clientid value from the service binding. Then request a token using curl or API tools like Bruno. Here is a sample curl request:curl
–request POST
–url “<edited-authorization-endpoint>”
–header “accept: application/json”
–header “content-type: application/x-www-form-urlencoded”
–data “client_id=<clientid>”
–data “grant_type=client_credentials”
–cert doc-grounding.crt
–key doc-grounding.keyFor the sake of user experience, let’s see how it looks like in Bruno:Start by creating a new collection (e.g. grounding-blog-post) and adding a POST request named “Get Token”. Open the collection settings via the … menu next to the collection name.Go to the Client Certificates tab in the collection settings. Now we have to add the certificate and the key twice: Once for the IAS tenant domain in order to get the bearer token, and a second time with the document grounding url as domain with the document grounding url to interact with the document grounding service.Starting with the first client certificate, as Domain the IAS tenant will be used (e.g. https://<ias-tenant-id>.accounts.ondemand.com). Then, set the Cert file to doc-grounding.crt and the Key file to doc-grounding.key. Leave Passphrase empty. Click Add, then Save.Afterwards, repeat the steps and only change the domain. You can use the authorization_endpoint base url (or url field from document grounding service binding).Once saved, the configured certificates appear in the list. Repeat the same for the mtls url which is the service-binding-url.In the request, set the URL to your authorization_endpoint with /oauth2/token at the end. Open the Body tab, select Form URL Encoded, and add the two fields: client_id with your client ID value, and grant_type set to client_credentials. Send the request. A 200 OK response with an access_token in the body confirms that authentication is working. Copy the access_token value from the response. You will use this for all subsequent API calls, including pipeline creation in Step 4. Verify the ConnectionTest that your service URL and token work together. In Bruno, send a GET request to <service-binding-url>/pipeline/api/v1/pipeline with an Accept: application/json header and your bearer token as the Authorization header.An empty array [] means the connection works and you have no pipelines yet. That is the expected response at this point. Step 2: Create a GCP Service AccountThe document grounding service needs machine-to-machine access to Google Drive. A service account gives it that without requiring a human user to go through an OAuth consent screen. You share specific Drive content with the service account, and the BTP destination holds the credentials.Create a GCP ProjectIf you do not have a GCP project yet, open the GCP Console and create one. Give it a descriptive name like docgrounding-btp-gdrive so its purpose is clear. Note the Project ID — you cannot change it later.Enable the Google Drive APIBefore creating a service account, make sure the Google Drive API is enabled in your GCP project. Navigate to APIs & Services in the GCP Console and click Enable APIs and services. Search for “Google Drive” and select Google Drive API from the results.Enable it if it is not already active. Without this, service account credentials will not be able to access Drive content even if the sharing is configured correctly. Create the Service AccountOpen the GCP Console and navigate to IAM & Admin > Service Accounts. Create a new service account. The name is your choice; something like btp-doc-grounding makes the purpose clear. You do not need to assign any GCP IAM roles to this service account. Access to specific Drive content is granted through Drive sharing, not through IAM roles. Generate a KeySelect your service account, go to the Keys tab, and choose Add Key > Create new key. Select JSON format and download the file. Keep it secure. It contains the private key that BTP will use to authenticate with Google’s OAuth token endpoint.The JSON structure looks like this:{
“type”: “service_account”,
“project_id”: “<your-gcp-project>”,
“private_key_id”: “abc123”,
“private_key”: “—–BEGIN PRIVATE KEY—–n…n—–END PRIVATE KEY—–n”,
“client_email”: “btp-doc-grounding@<your-project>.iam.gserviceaccount.com”,
“client_id”: “123456789012342278901”,
“auth_uri”: “https://accounts.google.com/o/oauth2/auth”,
“token_uri”: “https://oauth2.googleapis.com/token”,
“auth_provider_x509_cert_url”: “https://www.googleapis.com/oauth2/v1/certs”,
“client_x509_cert_url”: “https://www.googleapis.com/robot/v1/metadata/x509/btp-doc-grounding@<your-project>.iam.gserviceaccount.com”,
“universe_domain”: “googleapis.com”
}The fields you will use in the next step: JSON FieldWhere You Will Use Itclient_idBTP destination Client ID fieldprivate_keyBTP destination additional property private_keyclient_emailBTP destination additional property client_emailauth_uriBTP destination additional property auth_uri Share Your Drive Content with the Service AccountNavigate to the Google Drive folder or shared drive you want to index. For this example we go with a shared folder. Use Share and add the client_email value from the JSON as a member. Set the permission to Viewer. Read access is all the ingestion pipeline needs.Once shared, you can see the folder with the documents you plan to index.Here is a sample document in that folder that will be indexed through this pipeline:While you are in Drive, note the folder ID from the URL. For a shared folder, the URL looks like:https://drive.google.com/drive/folders/1ABCdefGHIjklMNOpqrSTUvwxYZ
└── this is your folder IDFor a shared drive, open it and grab the ID from the URL after /drive/. You will need this ID when creating the pipeline in Step 4. Step 3: Configure the BTP DestinationThe BTP destination holds your Google Drive connection configuration. The pipeline will reference this destination by name, so the grounding service knows how to authenticate with Google’s API.Open Connectivity > Destinations in your BTP Cockpit and create a new destination with the following main properties: PropertyValueNameYour choice (e.g. GoogleDrive_DocGrounding)TypeHTTPURLhttps://googleapis.com/drive/v3Proxy TypeInternetAuthenticationOAuth2ClientCredentialsClient ID<client_id from service account JSON>Client SecretLeave emptyToken Service URLhttps://oauth2.googleapis.com/tokenThen add these additional properties: PropertyValueprivate_keyThe full private_key value from the JSON, including the header and footer linesclient_emailThe client_email from the JSONauth_urihttps://accounts.google.com/o/oauth2/authSave the destination and use Check Connection to verify. A successful response confirms that BTP can reach the Google Drive API using the service account credentials. Step 4: Create the Ingestion PipelineThe pipeline tells the grounding service what to index. It connects your BTP destination to a specific Google Drive folder or shared drive and runs the ingestion process. Pipeline creation happens through the grounding service API, not through the BTP Cockpit.Here is the curl request for a shared folder:curl
–request POST
–url “<service-binding-url>/pipeline/api/v1/pipeline”
–header “Authorization: Bearer <access_token>”
–header “content-type: application/json”
–cert doc-grounding.crt
–key doc-grounding.key
–data ‘{
“type”: “GoogleDrive”,
“configuration”: {
“destination”: “<your-destination-name>”,
“googleDrive”: {
“resourceType”: “SHARED_FOLDER”,
“resourceId”: “<your-folder-id>”,
“includePaths”: [“/**”]
}
}
}’The response is a JSON object with a pipelineId. Save this ID. You will use it to check ingestion status.Here is how the request and response look in Bruno (You can copy the data JSON from the curl request above):Here is what each field does:type: Must be “GoogleDrive” (case-sensitive).destination: The name of the BTP destination you created in Step 3.resourceType: Either SHARED_FOLDER or SHARED_DRIVE. Use the one that matches what you shared with the service account.resourceId: The folder or shared drive ID from the Drive URL.includePaths: Glob patterns for which files to index. [“/**”] indexes everything, but as this parameter is optional, this can be omitted as well. Use [“/policies/**”] to limit to a specific subfolder. SHARED_FOLDER vs SHARED_DRIVE Resource TypeWhen to UseSHARED_FOLDERYou shared a specific folder within My Drive or a shared driveSHARED_DRIVEYou shared an entire shared driveIf you leave resourceId empty, the pipeline runs in auto-discovery mode and indexes all shared drives and folders the service account can read. This is convenient for testing but less controlled for production use. Supported File TypesThe grounding service ingests these formats from Google Drive:DOCX, HTML, JPEG, JPG, JSON, PDF, PNG, PPTX, TIFF, TXT.Despite that, Document Grounding using Google Drive extends the existing support for DOCX and PPTX with processing of native Google Docs and Google Slides.For more information and availability, see SAP Document Grounding setup documentation. Verify the SetupCheck Pipeline StatusUse the pipeline ID from the creation response to check ingestion progress:curl
–request GET
–url “<service-binding-url>/pipeline/api/v1/pipeline/<pipeline-id>”
–header “Authorization: Bearer <access_token>”
–cert doc-grounding.crt
–key doc-grounding.keyThe response includes the pipeline status and a document count. Ingestion for small document sets typically completes within a few minutes. Larger sets take longer.When ingestion is complete, the status field shows FINISHED.You can also list the indexed documents by calling <service-binding-url>/pipeline/api/v1/pipeline/<pipeline-id>/executions/<execution-id>/documents. Each indexed document appears with its title, status INDEXED, and a link back to the original Google Drive file. Note: You first have to get the execution id via this request url:<service-binding-url>/pipeline/api/v1/pipeline/<pipeline-id>/executions Test a Search QueryNow open your Joule Instance that is connected to your IAS. This can be done via Instances and Subscriptions in the BTP Subaccount, then open the Joule instance. Append to your url /webclient/standalone/sap_digital_assistant to open the standalone Joule web client. The full url looks something like that:https://<tenant>.<region>.sapdas.cloud.sap/webclient/standalone/sap_digital_assistant.Then provide a prompt that is matching your uploaded document(s).And here is Joule answering a question about that document’s content, with the source citation pointing back to the original file:And with that, your Google Drive documents are now indexed and searchable through the document grounding service!Related resources:SAP Help: Set Up Document GroundingSAP Help: Configure Access from SAP BTPSAP Help: Set Up Content Ingestion”}]] Read More Technology Blog Posts by SAP articles 

#SAPCHANNEL

By ali

Leave a Reply