Vectify demonstrates how to implement Retrieval Augmented Generation (RAG) using SAP HANA Cloud Vector Engine, Langchain, and SAP Generative AI Hub SDK. The project aims to embed business context into generative AI workflows, enabling enhanced AI-driven insights for use cases such as automatic reply generation and issue deduplication in business scenarios.
Vectify is part of the SAGENAICITY proof-of-concept, which includes:
- Automatic social media replies for citizens of SAGENAICITY.
- Deduplication of reported issues to streamline administrative workflows.
- More features to come...
This project showcases the power of SAP HANA Cloud's vector engine to enhance generative AI models like GPT-4 or GPT-35-Turbo in real-world applications.
For more details on the SAGENAICITY proof-of-concept, visit the project overview.
- SAP HANA Cloud Vector Engine: Powers the vector-based data retrieval for embedding contextual information in generative AI outputs.
- Langchain: Provides the framework to integrate large language models and manage data pipelines.
- SAP Generative AI Hub SDK: Facilitates interaction with AI models such as ADA-002 and GPT-4, using SAP’s AI core services.
- SAP AI Core Extended with models ADA-002, GPT-4, or GPT-35-Turbo.
- SAP HANA Cloud with Vector Engine enabled.
- SAP BTP Subaccount with at least 2GB free runtime memory for deployment.
git clone https://github.com/Pirate-Emperor/vectify.git
cd vectify
Ensure that your AI Core credentials are stored in ~/.aicore/config.json
as per these instructions. The config.json
file should look like this:
{
"AICORE_AUTH_URL": "https://yoursubaccount.authentication.yourregion.hana.ondemand.com/oauth/token",
"AICORE_CLIENT_ID": "your-client-id",
"AICORE_CLIENT_SECRET": "your-client-secret",
"AICORE_BASE_URL": "https://api.ai.prod.yourregion.hana.ondemand.com/v2",
"AICORE_RESOURCE_GROUP": "default"
}
In the root directory of the project, create a config.ini
file with your SAP HANA Cloud credentials:
[database]
address = 2f2e34c5-876d-9876-a3f1-d54dfc11df42.hana.prod-eu12.hanacloud.ondemand.com
port = 443
user = DBADMIN
password = Y0urP4ssw0rd!
This file is required for local testing and is automatically ignored when deploying to Cloud Foundry.
To deploy on Cloud Foundry, push the app to your SAP BTP Subaccount, then provide both AI Core and SAP HANA Cloud credentials:
cf set-env contextual-answers AICORE_AUTH_URL 'https://yoursubaccount.authentication.yourregion.hana.ondemand.com/oauth/token'
cf set-env contextual-answers AICORE_CLIENT_ID 'your-client-id'
cf set-env contextual-answers AICORE_CLIENT_SECRET 'your-client-secret'
cf set-env contextual-answers AICORE_BASE_URL 'https://api.ai.prod.yourregion.hana.ondemand.com/v2'
cf set-env contextual-answers AICORE_RESOURCE_GROUP 'default'
cf set-env contextual-answers DB_ADDRESS '2f2e34c5-876d-9876-a3f1-d54dfc11df42.hana.prod-eu12.hanacloud.ondemand.com'
cf set-env contextual-answers DB_PORT '443'
cf set-env contextual-answers DB_USER 'DBADMIN'
cf set-env contextual-answers DB_PASSWORD 'Y0urP4ssw0rd!'
cf restage contextual-answers
Once the staging phase is complete, you can scale down the app's memory to 128MB:
cf scale contextual-answers -m 128M
Learn more about SAP HANA Cloud Vector Engine here.
Feel free to fork the repository, make changes, and submit pull requests. Contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
Pirate-Emperor
- GitHub: Pirate-Emperor
- Reddit: PirateKingRahul
- Twitter: PirateKingRahul
- Discord: PirateKingRahul
- LinkedIn: PirateKingRahul
- Skype: Join Skype
- Medium: PirateKingRahul