Skip to main content

Einstein Models Python SDK

A Python SDK for interacting with Salesforce Einstein Models API.

Installation

pip install einstein-models

Usage

from einstein_models import ModelsAI

# Get model list
from einstein_models.models.models import get_models

# Initialize the client
sfModelsAI = ModelsAI()

# Save available models
Models = get_models()

# Authenticate
sfModelsAI.authenticate(
    salesforceDomain="your-domain.my.salesforce.com",
    clientId="your-client-id",
    clientSecret="your-client-secret"
)

# Generate content
response = sfModelsAI.generate(
    model="sfdc_ai__DefaultOpenAIGPT4Omni",
    prompt="What is the capital of Switzerland?",
    probability=0.8,
    locale="en_US"
)

# Generate content with model list
response = sfModelsAI.generate(
    model=Model.OPENAI_GPT_4_OMNI.value,
    prompt="What is the capital of Switzerland?",
    probability=0.8,
    locale="en_US"
)


# Chat generation
messages = Messages()
messages.add_user_message("What is the capital of Switzerland?")
response = sfModelsAI.chat_generate(
    model="sfdc_ai__DefaultOpenAIGPT4Omni",
    messages=messages
)

License

MIT

Metadata

Release files for einstein-models 0.2.5

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

Source distribution (sdist)

Source distribution for einstein-models 0.2.5
File Size Uploaded
einstein-models-0.2.5.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for einstein-models 0.2.5
File Interpreter ABI Platform
einstein_models-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 25.1 kB

Release files / einstein-models-0.2.5.tar.gz

Download URL einstein-models-0.2.5.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cd2758301473fd12e307bed3b75de66ffa0071a068146bf46cb91e6a8cb32868
BLAKE2b-256 checksum
How to use checksums
5ce34a7764f60744559174679d19828b1227de12447ba617d969a69967df1ab7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release files / einstein_models-0.2.5-py3-none-any.whl

Download URL einstein_models-0.2.5-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23bf269bbbcd725093daa5cb47045bf143076ab3a63c2db02c1959e666d7615c
BLAKE2b-256 checksum
How to use checksums
c65f5b9a432ce0cda12024d6138ffc7d23d30835d7b56774f83d3c1b097b82ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.2.5 This release

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