Skip to main content

SAP Generative AI Hub: Pydantic AI models for various LLM providers

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydanticai_genai_hub-0.1.10.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydanticai_genai_hub-0.1.10-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file pydanticai_genai_hub-0.1.10.tar.gz.

File metadata

  • Download URL: pydanticai_genai_hub-0.1.10.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pydanticai_genai_hub-0.1.10.tar.gz
Algorithm Hash digest
SHA256 726eec2180d40ff33524e36e4fb452f801f2c03bf696bdd815ae7caa50456791
MD5 2134680b669e1787b4ac4ce2d581287c
BLAKE2b-256 46333d87ed5f6c45cbd8f3330d2553e603ef27aff4649b75b5efa3f28f1f600a

See more details on using hashes here.

File details

Details for the file pydanticai_genai_hub-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for pydanticai_genai_hub-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 2097018a81759be248924cce4da97e663f43cdb1623c7d4ec9a679b14e7f4bce
MD5 af1211690ce0834854079595cae16046
BLAKE2b-256 ac62027bbb0dd81d8e4a6ac0e313ecb8094b12b3ddef41cd0ff064b0a6d93f87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page