Generative AI has broken out of research labs and is now transforming the way business is done. SAP is moving at full speed to embrace this trend and has launched an agent called Joule. In this blog series, I’ll provide a “super-fast hands-on” guide to help you quickly call default models of SAP AI Core and expand them into practical AI agents for real-world business use, so you can understand how these agents work behind the scenes.
Notice
日本語版はこちらです。
Time Commitment
Each part is designed to be completed in 10–15 minutes
If you enjoyed this post, please give it a kudos! Your support really motivates me. Also, if there’s anything you’d like to know more about, feel free to leave a comment!
We’ll move into a Jupyter Notebook, install the required SDKs, and send our first chat to the GPT‑4o‑mini deployment we created in Part 1!
Open VS Code and create a new Jupyter Notebook (langchain_chat.ipynb). Create a fresh folder and (optionally) a Python virtual environment so dependencies don’t clash with other projects.
A requirements.txt file is simply a checklist of Python packages (and versions) your notebook needs.
ai_core_sdk>=2.5.7
pydantic==2.9.2
openai>=1.56.0
google-cloud-aiplatform==1.61.0 # Google
boto3==1.35.76 # Amazon
langchain~=0.3.0
langgraph==0.3.30
langchain-community~=0.3.0
langchain-openai>=0.2.14
langchain-google-vertexai==2.0.1
langchain-google-community==2.0.7
langchain-aws==0.2.9
python-dotenv==1.1.0
generative-ai-hub-sdk
Open a terminal inside your project folder after activating your virtual environment (e.g. .venv). Then execute the command:
pip install -r requirements.txt
Once the install finishes, restart your Notebook kernel so it picks up the new libraries.
In a new notebook cell, load your .env and send a prompt.
Read the docs!
Before you type a single line of code, skim the Generative AI Hub SDK documentation . Notice how the SDK wraps OpenAI, Vertex AI, Bedrock, and exposes a LangChain‑compatible interface. Keep the version matrix handy—mis‑matched pins are the #1 support ticket.
# ▶ Notebook Cell 1
from dotenv import load_dotenv
from gen_ai_hub.proxy.langchain.openai import ChatOpenAI
import os
load_dotenv() # Read credentials & DEPLOYMENT_ID
chat_llm = ChatOpenAI(
deployment_id=os.getenv("DEPLOYMENT_ID") # ← Deployment ID created in Part 1 (Section 5, Step 6)
)
messages = [
("system", "You are a helpful assistant that translates English to French."),
("human", "Hello, World!"),
]
chat_llm.invoke(messages)
“system” message defines the model’s role and behaviour. The “human” message is the user’s input—replace it with whatever text comes from your chat UI.
Success = “Bonjour, le monde !”
You’ll now deploy OpenAI’s text-embedding-ada-002 (or any embedding model) in AI Launchpad exactly the same way you deployed GPT‑4o‑mini. Then call it from LangChain and make sure you receive a vector.
The steps are as follows:
Notebook Cell (some fields masked)
# ▶ Notebook Cell 2
from gen_ai_hub.proxy.langchain.openai import AAAAAAAAAAAA
embedding_model = AAAAAAAAAAAA(
deployment_id="debXXXXXXXXX"
)
single_vector = embedding_model.BBBBBBBBBBBB("Hello world")
print(str(single_vector)[:100]) # Print first 100 chars
You’re good if you see “[-0.012, 0.087, …]” – a string of numbers!
Part 3 Agent Tools: Integrating Google Search
Part 3 upgrades our chat model into a LangChain Agent and bolts on the Google Search tool so answers stay fresh. No extra API keys—everything still runs inside SAP AI Core.
All the views and opinions in the blog are my own and is made in my personal capacity and that SAP shall not be responsible or liable for any of the contents published in this blog.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
35 | |
22 | |
16 | |
15 | |
8 | |
7 | |
7 | |
7 | |
6 | |
6 |