• IDD
  • IDD
  • Skybuffer AI
    • Skybuffer AI Installation and Initial Setup
      • On Business Technology Platform (BTP)
        • Skybuffer AI Installation Guide on BTP
      • On Premise: XSA Runtime and SAP HANA EE
        • Installing SAP HANA Including XS Runtime
        • XS Deployment Process
      • Post Installation User Guide
    • AI Agent
      • AI Agent Configurator
        • Register New AI Agent
        • Intents and Entities Creation
        • Skills Creation and Management
          • Standard Action Types
          • Generative AI Action
          • RAG Action
        • Scheduling
        • Communication Channels
          • Webchat Communication Channel Setup
          • Facebook Messenger Communication Channel Setup
          • Zoom Communication Channel Setup
          • MS Teams Communication Channel Setup
          • Slack Communication Channel Setup
          • Telegram Communication Channel Setup
          • Viber Communication Channel Setup
          • WhatsApp Communication Channel Setup
          • AI Agent Communication Channel Setup
        • Monitor Section
      • Destination Management
      • AI Translate
      • Survey Craft
      • Identity Providers
      • Business AI Scenarios
      • ML Models Hub
      • RAG Document Hub
    • AI Connector
      • AI Connector Configurator
      • AI Connector Logs
      • AWS Integration
      • Google Services Integration
      • Twilio Integration
      • Yandex Services Integration
    • SAP Backend for Business AI
      • Business AI Scenarios Package Administration
        • Installation Guide
        • Uninstallation Guide
      • Business AI Scenarios Package Maintenance Guide
        • Product License
        • Configuration of Email Sending Mechanism
          • Configuration Settings
          • Setup of Specific Email Sending Control
        • Technical User Setup
          • Central oData Service Authorization Role Maintenance
          • Technical User ID Creation
        • Assigning Business AI Scenarios to ABAP RIK Classes
        • Simplified User Creation Scenario Setup (Without Approval Workflow)
          • Maintain and Assign Reference Users for User Creation Scenario
          • Activate Notification for New User Creation (Optional)
        • User Creation Scenario Setup with Approval Workflow
          • Configure Approval Workflow for User Creation Scenario
          • Set Up Approval Steps for Different User Types Creation
    • HOW-TO Guides
      • SAP AI Core Integration. Ollama Server Setup
      • MS SharePoint Integration. Add-in Registration
      • MS Teams Integration. Single Sign-On
        • Create Azure Bot Service
        • Configure Azure Bot Service and Connect to Bot Management App
        • Create Middleware SSO Application
        • Configure Bot Service Application SSO
        • Create Azure AD Enterprise Application for SAP Backend
        • Configure oAuth2 in SAP System
        • Assign Identity Provider and Push Nodejs Configuration
        • Deploy Your App into Microsoft Teams
        • Managing Application Keys
    • Hybrid Chats
      • Hybrid Chats Maintenance Guide
        • Business and Technical Users Setup
          • Create Business and Technical Users
          • Create Business Partners
        • Tenant Configuration
        • Live Pool Management and Configuration
          • Start Live Pool
          • Manage Live Pool
        • System Configuration
          • Configure Status Profile
          • Set Up Technical Messages for Hybrid Chats
        • Hybrid Chats Configuration
        • Hybrid Chats Categorization
          • Categorization Management
          • Categorization Mapping
          • Translate Categories
      • Hybrid Chats User Manual
        • Hybrid Chats
          • HC Archive Mode
          • HC Active Mode
        • HC My Data
          • Edit Personal Data and Profile Picture
          • Default Settings Management
          • Notification and Dialogue Manual Mode Management
          • Quick Replies Management
            • Standard User Mode - Quick Replies
            • Administrator User Mode - Quick Replies
        • HC Analytics
          • HC Analytics
          • Operator Activity Analytics
          • Exit Survey Analytics
        • HC Teams
          • Access HC Teams Application
          • Create New Team
          • Create New Team Member
          • Edit Agent
          • Edit Team Name

SAP AI Core Integration. Ollama Server Setup

112 views 0

Instructions for setting up Ollama server in SAP AI Core

SAP AI Core is a service of the SAP Business Technology Platform that is designed to handle the execution and operations of your AI assets. In our case, we use this service to train models to recognize intents and entities.

Prerequisites:

  • You have an SAP Business Technology Platform account with space inside, and SAP AI Core service is already activated using any of the service plans (free one is available). If not, complete the steps for initial setup: https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/initial-setup
  • You are subscribed to SAP AI Launchpad using any of the service plans (free one is available). If not, complete the steps for initial setup: https://help.sap.com/docs/ai-launchpad/sap-ai-launchpad/subscribe-to-sap-ai-launchpad
  • Applications that need to interact with the Ollama server will need to obtain access tokens using SAP AI Core service instance and know the resource group name and the endpoints prefix. Therefore, they must be configured and bound to this service either manually or automatically during the deployment process. We will be considering this later in a separate paragraph.

Step 1. Create an SAP AI Core service instance

Inside your account and space, select the menu item of Service Marketplace and then SAP AI Core.

Press the Create button.

A screenshot of a computer Description automatically generated

Select your plan and fill in the field of Instance Name with AI_core. Do not give other names to this service because the name is the essential key for further interaction between the application and the service.

Follow the next steps on the pictures below:

A screenshot of a computer Description automatically generated

A screenshot of a computer Description automatically generated

After completing this sequence, you may see an instance of service in your space. To get credentials, first you must create a service key  and after that press the button of View Credentials:

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

After the key is created, you can view the credentials data or download the service key as a text file.

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

Step 2. Create a workspace and a resource group

Download the service key for AI API Connection as a txt file.

A screenshot of a computer Description automatically generated

Inside your account and space, among Instances and Subscriptions, find SAP AI Launchpad and press on it.

A screenshot of a computer Description automatically generated

Create an AI API Connection using the txt file with the service key. The name of API Connection does not matter.

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

You can omit using the file and manually fill in all the fields:

A screenshot of a computer Description automatically generated

At least one resource group must be inside your workspace (AI API Connection). If not, create one, the name is of no importance, but here in this present document we will be using default.

A screenshot of a computer Description automatically generated

Step 3. Integrate GitHub repository into your workspace

Log into the GIT account that you plan to use to store the training scenarios script files and create a new private repository there or use an existing one. If you don’t have one, you can create a free new account. In any case, the repository must be private, i.e. not accessible by other users by default.

Link text e.g., Destination screen

Link text e.g., Destination screen

Click on your GitHub profile icon. Select Settings.

image

Click on Developer Settings from the left navigation pane.

image

Click on Personal access tokens. Click on Generate new token. GitHub tokens are an alternative to sharing your GitHub credentials so that you can allow applications like SAP AI Core to access your GitHub repositories, without compromising your account security.

image

Select the checkbox of Full control of private repositories in the Select Scopes field.

image

Scroll to the bottom of the page and click on Generate token.

image

Store your generated access token locally.

image

 

Select your SAP AI Core connection under the Workspaces app in the SAP AI Launchpad.

A screenshot of a computer Description automatically generated

A screenshot of a computer Description automatically generated

Use the following as references:

  1. URL: Paste the URL of your GitHub repository.
  2. Name: Name of repository to display. If not filled, then it uses the original repository name.
  3. Username: Your GitHub username.
  4. Access Token: Paste your GitHub Personal Access Token generated in the previous step.

A screenshot of a computer Description automatically generated

You will see your GitHub onboarding completed in a few seconds. If not, then use the Refresh button.

A screenshot of a computer Description automatically generated

 

NOTE: These onboarding steps only store credentials to access the specified SAP AI Core instance within your GitHub account. Therefore, this Completed status does not guarantee that all the required files in your GitHub repository are accessible and correct.

Step 4. Place deployment files in GitHub

Create a new folder for deployment files with the name of SkybufferOllama. In GitHub there is no UI for creating a directory, so we will use the function of Create new file and in the file name will go the directory name.  After the directory creation this temporary file may be deleted.

A screenshot of a computer Description automatically generated

A screenshot of a chat Description automatically generated

A screenshot of a computer Description automatically generated

Upload the scenario files to the new folder. All files have *.yaml extension and must be taken from Skybuffer Official repository and downloaded to the local disk, for example in \skybfryaicor\skybuffer_ollama folder.

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

Remember to press button commit the changes.

A screenshot of a computer Description automatically generated

After all the changes, you should have a new directory with at least 1 *.yaml files for GPU training.

A screenshot of a computer Description automatically generated

Step 5. Create an SAP AI Core application to sync workflows with GitHub

Go to your SAP AI Launchpad.

In the AI Core Administration app, click Applications > Create.

A screenshot of a computer Description automatically generated

Specify the details of your application. This form will create your application on your SAP AI Launchpad.

Use the following as references:

  1. Application Name: ollamaserv.
  2. Repository: Select repository from the list.
  3. Path in Repository: SkybufferOllama.
  4. Revision: HEAD

A screenshot of a application Description automatically generated

After successful creation, you will see your application in the Applications. Find it and press on it.

A screenshot of a computer Description automatically generated

 

On the Application Details screen (Figure 40), first press on the Sync button (1), after synchronization is completed, press the refresh button (2). You will be able to see the Health status (3) and sync the details (4). The number of the deployment templates (scenarios) should be the same as the *.yaml files count at GitHub in the SkybufferOllama folder.

A screenshot of a computer Description automatically generated

 

Step 6. Check Scenarios

Click ML Operation > Scenario to find all the scenarios from all the applications. Scenarios are automatically created from the details specified in the *.yaml files at your GitHub.

A screenshot of a computer Description automatically generated

To view the details, click on the row in the scenarios and expand it. Here you can find Scenario ID, we will need this kind of information later when creating configuration for deployment.

A screenshot of a computer Description automatically generated

Step 7. Integrate DockerHub repository into your workspace

This step is required once. Storing the Docker credentials enables SAP AI Core to pull (download) your Docker images from a private Docker repository of Skybuffer company.

NOTE: SAP AI Core does not verify your docker credentials, it is used for deploying the image to the corresponding Amazon service and will check it while deploying only. Please ensure that you are storing the correct credentials.

Click Docker Registry Secrets in the SAP AI Core Administration app. Click Add.

A screenshot of a computer Description automatically generated

Use the following as references:

  1. Name: skybufferrepo.
  2. Secret: upload from file docker-token-skybuffer-{organization name}.txt (file must be taken from Skybuffer Official repository).

A screenshot of a computer Description automatically generated

After successful creation, you will be able to see a new docker registry secret.

A screenshot of a computer Description automatically generated

Step 8. Create configuration and run Ollama server

To launch the server, we need to create a configuration and perform deployment based on it. To create a configuration, select the item of Configurations inside the ML Operations.

A screenshot of a computer Description automatically generated

Use the following as references:

  1. Configuration Name: You can specify any, for example – Ollama GPU llama3 Infer-S.
  2. Scenario: Select the scenario from the list, for example – Ollama: GPU llama3 Infer-S.
  3. Version: Select the version from the list (there will be only one latest version).
  4. Executable: Select from the list (there will be only one).

A screenshot of a computer Description automatically generated

No further data entry is required, just follow the instructions as shown in the pictures below:

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

After successful creation, you will be able to see the new configuration . Find it and click on it, you will see the additional information and the button of Create Deployment, use it to start deployment.

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

You can specify the duration of the server work time, or use the default value. Then click Review.

A screenshot of a computer Description automatically generated

 

A screenshot of a computer Description automatically generated

After creation, you will be automatically transferred to the Deployments tab and will see additional information about your deployment, in fact it is the Ollama server startup/operation status. To update the information on this screen, use a special button in the top right-hand corner.

A screenshot of a computer Description automatically generated

Once the server starts, you will see its status as RUNNING. You can also check some additional information using the Status and Logs tabs.

After successful launch, pay attention to the URL of the running service. We will need it to interact with the Ollama server.

A screenshot of a computer Description automatically generated

You can also simply switch to the Deployments tab and see the general list and statuses there. By clicking on any of the elements, you will return to the tab with additional information.

A screenshot of a computer Description automatically generated

On the tab with additional information, you can manage the process, including stopping the deployment.

A screenshot of a computer Description automatically generated

Step 9. Sending requests to Ollama server from postman

To send any requests to the Ollama server running in SAP AI Core, we will need to know the URL and the name of the resource group, as well as an authorization token obtained according to the OAuth 2.0 standard.

Let us consider an example for a request to generate a response to a question.

URL:

URL consists of 3 parts:

  • URL of the running deployment {deployment_url}
  • Prefix with the version number {prefix}
  • Ollama regular endpoint {ollama_endpoint}

Generally, URL looks like this: {deployment_url}/{prefix}/{ollama_endpoint}

In our example:

  • Deployment URL must be taken from the deployment information (Figure 56): https://api.ai.prod.us-east-1.aws.ml.hana.ondemand.com/v2/inference/deployments/d3ed15443d1fd5f6
  • Prefix: v1
  • Ollama endpoint: api/generate

As a result, the full URL is: https://api.ai.prod.us-east-1.aws.ml.hana.ondemand.com/v2/inference/deployments/d3ed15443d1fd5f6/v1/api/generate

AI-Resource-Group header: should be taken from your workspace (Figure 16)

In our example: default

Authorization header: should be received using OAuth 2.0 standard using credentials of your SAP AI Core instance (Figure 9):

A screenshot of a computer Description automatically generated

Body: {

“model”: “llama3.1”,

“prompt”:”How many colors are in the rainbow?”,

“stream”:false

}

A screenshot of a computer Description automatically generated

 

Step 10. Check bindings in BTP account

Any application making requests to the Ollama server must receive access tokens and therefore require the AI_core service credentials. Therefore, they must be bound to this service either manually or automatically during the deployment process.

Let’s look at an example of checking the binding of the botclientconnector application and creating one.

Find your service instance and click on it. You will see all the applications that are already bound. In our case there is no botclientconnector, so we must bind it.

A screenshot of a computer Description automatically generated

To bind an application, use the Create button.

A screenshot of a social media post Description automatically generated

A screenshot of a computer Description automatically generated

A screenshot of a service keys Description automatically generated

 

Useful links:

SAP AI Core documentation: https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/what-is-sap-ai-core

SAP AI Launchpad documentation: https://help.sap.com/docs/ai-launchpad/sap-ai-launchpad/what-is-sap-ai-launchpad

Skybuffer Official repository (not public, credentials needed):

Git Repository – skybfryaicor < Github_neo < Skybuffer Sp. z o.o. – SAP BTP Cockpit (ondemand.com)

https://git.eu2.hana.ondemand.com/ofvwid1a4r/skybfryaicor

https://git.eu2.hana.ondemand.com/plugins/gitiles/ofvwid1a4r%2Fskybfryaicor

Was this helpful?

Yes  No
Related Articles
  • Scheduling
  • AI Agent Communication Channel Setup
  • Post Installation User Guide
  • Installing SAP HANA Including XS Runtime
  • On Premise: XSA Runtime and SAP HANA EE
  • On Business Technology Platform (BTP)
Copyright 2022 Skybuffer.com. All Rights Reserved.