Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
mertuytun
Participant

Introduction

In the ever-evolving landscape of technology, leveraging the power of Artificial Intelligence (AI) and machine learning has become essential for businesses seeking a competitive edge. SAP's Business Technology Platform (BTP) offers a robust ecosystem for deploying AI solutions, and one crucial component of this ecosystem is the PostgreSQL Database. This guide will walk you through the process of utilizing a SAP BTP-hosted PostgreSQL Database as a vectorstore database for AI embeddings. By following the steps outlined below, you can harness the capabilities of AI embeddings to enhance your data analytics and decision-making processes.

Pre-requisites:

  • BTP Account (can be trial)
  • BTP PostgreSQL Database which can be assesible by SSH Tunnel
  • Cloud Foundry CLI

Step 1 - Obtain necessary information from BTP Cockpit and CF CLI

Before you can configure your PostgreSQL database, gather essential information from both the BTP Cockpit and the CF CLI. This information includes authorization tokens, Cloud Foundry region details, instance IDs, and database names. These details will be crucial for the subsequent steps.

Step 1.1 - Obtain Authorization token from CF CLI

 

cf oauth-token

 

pgvector-obtain-auth-token.png

Step 1.2 - Obtain CloudFoundryRegion from BTP Cockpit

pgvector-obtain-cloudfoundry-region.png

Step 1.3 - Obtain PostgreSQL InstanceID from BTP Cockpit

pgvector-obtain-postgresql-instance-id.png

Step 1.4 - Obtain Database name from BTP Cockpit

pgvector-obtain-database-name-1.pngpgvector-obtain-database-name-2.png

Step 2- Activate vector extension for PostgreSQL database hosted on BTP

With the prerequisite information in hand, it's time to activate the vector extension for your PostgreSQL database hosted on SAP BTP. This extension will enable your database to efficiently store and manage AI embeddings. You can activate it using various methods, such as CURL commands or Postman requests, as outlined in the guide. This step is pivotal in preparing your database for AI-related tasks.

To activate vector extension, PostgreSQL version should at least be 13.

 

https://api-backing-services.<CloudFoundryRegion>.data.services.cloud.sap/v1/postgresql-db/instances/<InstanceID>/extensions/vector

 

Activate with CURL

 

curl -X PUT 'https://api-backing-services.<CloudFoundryRegion>.data.services.cloud.sap/v1/postgresql-db/instances/<InstanceID>/extensions/vector' \
--header 'Authorization: <AuthorizationToken>' \
--header 'Content-Type: application/json' \
--data-raw '{"database": "<DatabaseName>"}'

 

Activate with Postman

pgvector-postman-1.png

pgvector-postman-2.png

Step 3 - Check 'Vector' extension activation on pgAdmin

To connect to your PostgreSQL database, you'll need to establish an SSH tunnel. Follow the instructions outlined in the blog post provided below to open the tunnel.
SAP BTP PostgreSQL Database import to pgAdmin with SSH Tunnel (Local Access) 

Now that your PostgreSQL database is configured as a vectorstore for AI embeddings, you can put it to the test. Additionally with above blog, you learnt how to connect to your PostgreSQL database through an SSH tunnel and interact with the vectorized data.

pgvector-pgadmin-check.png

Conclusion

In conclusion, this guide has equipped you with the knowledge and steps required to harness the power of SAP BTP and PostgreSQL as a vectorstore database for AI embeddings. By following these instructions, you can elevate your data analytics, information retrieval, and decision-making capabilities to new heights. AI embeddings offer a transformative approach to handling unstructured data, enabling you to extract valuable insights and drive innovation within your organization. As technology continues to advance, embracing AI and leveraging robust platforms like SAP BTP becomes imperative for staying competitive in the modern business landscape.

1 Comment
akbalburak
Discoverer

Good one Ali Mert! 🙂

Labels in this area