Registry / llm-agents / sap-ai-sdk-gen

sap-ai-sdk-gen

JSON →
library6.10.0pypypi✓ verified 83d ago

The SAP Cloud SDK for AI (Python) is designed to simplify interactions with generative AI APIs and services, particularly within the SAP ecosystem. It provides unified interfaces for various large language models (LLMs), enabling developers to easily integrate AI capabilities into their applications. The library is currently at version 6.7.0 and maintains a regular release cadence with updates and new features.

pip install sap-ai-sdk-gen
INSTALL
IMPORT
SIG · SAP-AI-SDK-GEN
S
sap-ai-sdk-gen
llm-agentspythonv6.10.0
Install
24.5s avg
Import
Disk
314MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.10.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 320MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 24.5s · import 0.000s · 319MB
314MB installed
● package 314MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GenAIHubProxyClient
from gen_ai_hub import GenAIHubProxyClient
from sap_ai_sdk.generative_ai import GenerativeAI
proxy
from gen_ai_hub import proxy

This quickstart demonstrates how to initialize the `GenerativeAI` client and use its `Completion` service. It relies on environment variables for API key configuration (e.g., `OPENAI_API_KEY`) and attempts to generate text using a specified model.

import os from sap_ai_sdk.generative_ai import GenerativeAI from sap_ai_sdk.generative_ai.completion import Completion # Set your API key as an environment variable (e.g., OPENAI_API_KEY). # For SAP AI Core, ensure AI_API_URL, AI_CLIENT_ID, AI_CLIENT_SECRET, AI_AUTH_URL are set. # Example: os.environ['OPENAI_API_KEY'] = os.environ.get('OPENAI_API_KEY', '') # For demo, ensure it's loaded. try: # Initialize the GenerativeAI client. It automatically detects configured providers. ai_client = GenerativeAI() # Get the completion service completion_service: Completion = ai_client.get_completion_service() prompt = "Explain the concept of quantum entanglement in simple terms." model_name = "gpt-3.5-turbo" # Use a model supported by your configured provider print(f"Requesting completion for model: {model_name}") response = completion_service.create( prompt=prompt, model_name=model_name, # provider="openai" # Optionally specify if multiple providers are configured ) print("\nGenerated Text:") print(response.text) except Exception as e: print(f"An error occurred: {e}") print("Please ensure your environment variables (e.g., OPENAI_API_KEY) are correctly set") print("and that a suitable provider is configured for the chosen model.")
Debug
Known issues
breakingThe SDK underwent significant refactoring in version 6.x. The `GenerativeAI` class is now the central entry point for all services (completion, chat, image generation, etc.). Direct instantiation of services like `Completion()` with a configuration object is no longer the recommended or supported pattern.
fix
Initialize `GenerativeAI` and then use methods like `ai_client.get_completion_service()` to obtain service instances.
affects: >=6.0.0
gotchaAuthentication for generative AI providers (e.g., OpenAI, Azure OpenAI, SAP AI Core) relies heavily on environment variables or explicit `Credentials` objects. Misconfigured or missing API keys/credentials will lead to authentication errors (e.g., 401 Unauthorized).
fix
Ensure relevant environment variables (e.g., `OPENAI_API_KEY`, `AI_API_URL`, `AI_CLIENT_ID`, `AI_CLIENT_SECRET`) are correctly set before initializing the `GenerativeAI` client. Refer to the documentation for provider-specific requirements.
affects: all
gotchaWhen using multiple configured providers or if auto-detection fails, explicitly specifying the `provider` parameter when getting a service (e.g., `ai_client.get_completion_service(provider="openai")`) or in the service call (`completion_service.create(..., provider="openai")`) can prevent `ProviderNotFoundException`.
fix
Always check which providers are configured and, if necessary, explicitly pass the `provider` name to the relevant methods.
affects: all
Upgrade
Version history
6.10.0latest on PyPI · released May 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
16
OpenAI (training)
1
Resources
sap-ai-sdk-gen — pip install sap-ai-sdk-gen · libregistry