Skip to main content

PydanticAI GenAI Hub

A Python library providing Pydantic-based model implementations for various LLM providers. It's intended to be used with SAP's Generative AI Hub SDK.

This project is not affiliated with SAP.

Installation

You can install the package with pip:

pip install pydanticai-genai-hub

To install with specific provider support:

# For Anthropic support
pip install "pydanticai-genai-hub[anthropic]"

# For OpenAI support
pip install "pydanticai-genai-hub[openai]"

# For all providers
pip install "pydanticai-genai-hub[all]"

Usage

Anthropic Model

from pydanticai_genai_hub.anthropic import AnthropicModel

model = AnthropicModel(
    model_name="anthropic--claude-3.5-sonnet",
)

OpenAI Model

from pydanticai_genai_hub.openai import OpenAIModel

model = OpenAIModel(
    model_name="gpt-4o",
)

'Hello World' Example with AWS Bedrock Anthropic

from pydantic_ai import Agent
from pydanticai_genai_hub.anthropic import AnthropicModel

# Initialize the model with SAP GenAI Hub configuration
llm = AnthropicModel(
    model_name="anthropic--claude-3.5-sonnet",
)

agent = Agent(  
    model=llm,
    system_prompt='Be concise, reply with one sentence.',  
)

result = agent.run_sync('Where does "hello world" come from?')  
print(result.data)
"""
The first known use of "hello, world" was in a 1974 textbook about the C programming language.
"""

License

MIT License

Metadata

Release files for pydanticai-genai-hub 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydanticai-genai-hub 0.1.10
File Size Uploaded
pydanticai_genai_hub-0.1.10.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydanticai-genai-hub 0.1.10
File Interpreter ABI Platform
pydanticai_genai_hub-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 31.2 kB

Release files / pydanticai_genai_hub-0.1.10.tar.gz

Download URL pydanticai_genai_hub-0.1.10.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
726eec2180d40ff33524e36e4fb452f801f2c03bf696bdd815ae7caa50456791
BLAKE2b-256 checksum
How to use checksums
46333d87ed5f6c45cbd8f3330d2553e603ef27aff4649b75b5efa3f28f1f600a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pydanticai_genai_hub-0.1.10-py3-none-any.whl

Download URL pydanticai_genai_hub-0.1.10-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2097018a81759be248924cce4da97e663f43cdb1623c7d4ec9a679b14e7f4bce
BLAKE2b-256 checksum
How to use checksums
ac62027bbb0dd81d8e4a6ac0e313ecb8094b12b3ddef41cd0ff064b0a6d93f87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page