SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
β€’ Open full site

Using Multimodal inputs with GPT4o for Image Recognition on SAP AI Core

In this tutorial we are going to learn on how to consume GPT4o LLM on AI core deployed on SAP AI core.

Overview

🎓 beginner 45 min. SAP Ai CoreBeginnerArtificial IntelligenceMachine Learning

You will learn

  • βœ”How to inference GPT4o with multimodal inputs on AI core
Dhrubajyoti Paul D Dhrubajyoti Paul July 10, 2025
Created by July 16, 2024
Contributors

Prerequisites

Prerequisites

  • A BTP global account If you are an SAP Developer or SAP employee, please refer to the following links ( for internal SAP stakeholders only ) - How to create a BTP Account (internal) SAP AI Core If you are an external developer or a customer or a partner kindly refer to this tutorial
  • Ai core setup and basic knowledge: Link to documentation
  • Ai core Instance with Standard Plan or Extended Plan

Multimodality refers to the ability of a model to process and interpret different types of inputs, such as text, images, audio, or video. In the context of GPT-4o on SAP AI Core, multimodal input allows the model to understand and generate responses that incorporate both text and visual data. This enhances the model’s ability to perform complex tasks, such as scene detection, object recognition, and image analysis, by combining the strengths of both language processing and image recognition. In this tutorial, we will demonstrate these capabilities with the help of GPT-4o, with a sample input and output, which can be replicated in future for various use cases.

Steps

Step 1 Scene Detection
β€”

In this step, we demonstrate how to use GPT-4o to describe a scene depicted in an image. By providing both text and an image URL as input, the model is able to generate a descriptive response that captures the key elements of the scene. This capability is particularly useful for applications like automated content tagging, visual storytelling, or enhancing user experience in multimedia platforms and more.

Follow the further steps to replicate scene detection using GPT-4o.

The following example shows how you can consume this generative AI model using curl. For more information about prompts, see the tutorial Prompt LLMs in the Generative AI Hub in SAP AI Core & Launchpad Information published on SAP site.

Before you use this model, please ensure that the deployment has already been created. You can create the deployment either through generative-ai-hub-sdk or AI Launchpad.

For inferencing the model through curl,

  • open Windows PowerShell (for Windows based devices)

NOTE: do not use DOS Prompt instead of PowerShell

  • open Terminal (for macOS based devices)

Enter the following command after replacing <deployment_url>, <resource-group>, <token> with the values for the corresponding model.

NOTE:

  • for macOS based devices use use the bash command

  • for windows devices, use the PowerShell command

  • Update the β€œurl” to the link of the image resource you want to query the model upon and give the corresponding query in the β€œtext” parameter.

Shell
curl -L '<deployment_url>/chat/completions?api-version=2023-05-15' \
--header 'AI-Resource-Group: <resource-group>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
    "messages": [
      {
        "role": "user",
        "content": [
           {
              "type": "text",
              "text": "describe the scene"
           },
           {
              "type": "image_url",
              "image_url": {
                 "url": "https://raw.githubusercontent.com/SAP-samples/ai-core-samples/main/09_BusinessAIWeek/images/sceneDetection.jpg"
              }
          }
        ]
      }
    ],
    "max_tokens": 4096
}'
PowerShell
curl.exe -L "<deployment_url>/chat/completions?api-version=2023-05-15" --header "AI-Resource-Group: <resource-group>" --header "Content-Type: application/json" --header "Authorization: Bearer <token>" --data '{\"messages\": [{\"role\": \"user\", \"content\": [{\"type\": \"text\",\"text\": \"describe the scene\"},{\"type\":\"image_url\",\"image_url\": {\"url\": \"https://raw.githubusercontent.com/SAP-samples/ai-core-samples/main/09_BusinessAIWeek/images/sceneDetection.jpg\"}}]}],\"max_tokens\": 4096 }'

After executing the above curl command, we’ll get the output as follows -

output
output

For more information on the models refer to Hello GPT-4o

Step 2 Object Detection
+
Step 3 Graph Analysis
+
Step 4 Math
+
Step 5 Image to Text
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Scene Detection 2. Object Detection 3. Graph Analysis 4. Math 5. Image to Text

Learn more →