Skip to main content

Python SDK for Salesforce Einstein Models API

Project description

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

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

einstein-models-0.2.5.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

einstein_models-0.2.5-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file einstein-models-0.2.5.tar.gz.

File metadata

  • Download URL: einstein-models-0.2.5.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for einstein-models-0.2.5.tar.gz
Algorithm Hash digest
SHA256 cd2758301473fd12e307bed3b75de66ffa0071a068146bf46cb91e6a8cb32868
MD5 6b95e7eeeaab74a7b91ec5a62f731f09
BLAKE2b-256 5ce34a7764f60744559174679d19828b1227de12447ba617d969a69967df1ab7

See more details on using hashes here.

File details

Details for the file einstein_models-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for einstein_models-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 23bf269bbbcd725093daa5cb47045bf143076ab3a63c2db02c1959e666d7615c
MD5 fc8ea5777a24eb5e3de91054bb4d6155
BLAKE2b-256 c65f5b9a432ce0cda12024d6138ffc7d23d30835d7b56774f83d3c1b097b82ae

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