Skip to main content

Cerebrate SDK

Project description

Cerebrate SDK

Install

with poetry

poetry add cerebrate-sdk

or with pip

pip install cerebrate-sdk

Examples

Fake email detector

from cerebrate_sdk import Cerebrate

c = Cerebrate('YOUR_API_KEY')

task = "Detect if email is fake or real"
examples = [
    "qwertyuiooiu@ihdj.com: fake"
    "support@cerebrate.ai: real",
]

result = c.predict(task, examples, "lajotig138@5k2u.com: ")

print(result[0])
# fake

With options

from cerebrate_sdk import Cerebrate, Options

c = Cerebrate('YOUR_API_KEY')

options = Options(
    stop=['Q:'],
    temperature=0.7,
    max_tokens=100,
    top_p=1,
    presence_penalty=0,
    frequency_penalty=0,
    best_of=1
)

task = "Detect if email is fake or real"
examples = [
    "qwertyuiooiu@ihdj.com: fake"
    "support@cerebrate.ai: real",
]

result = c.predict(task, examples, "lajotig138@5k2u.com: ", options=options)

print(result[0])
# fake

Raw usage

from cerebrate_sdk import Cerebrate

c = Cerebrate("YOUR_API_KEY")

result = c.raw("Suggest the next item for user's cart."
               "Cart: bacon, eggs, tomatoes"
               "Suggested item: ")
print(result[0])
# sausage

Reusing presets

from cerebrate_sdk import Cerebrate

c = Cerebrate('YOUR_API_KEY')

# key-value pairs
# variable_name: value
# variables are defined in UI during preset creation
variables = {
    "stock": "tennis balls, tennis rockets, soccer balls, soccer uniform, basketballs, tennis uniform, tents, backpacks, socks",
    "cart": "tennis ball, socks"
}

result = c.preset_predict(preset_id="YOUR_PRESET_ID", variables=variables)

print(result[0])

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

cerebrate-sdk-0.2.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

cerebrate_sdk-0.2.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file cerebrate-sdk-0.2.1.tar.gz.

File metadata

  • Download URL: cerebrate-sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.10 Darwin/22.1.0

File hashes

Hashes for cerebrate-sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b0689e50a51d52d0c7636f0aa076fc4ad3caa965868f51caa3f41873136c7afe
MD5 d66a9114a55165d2b6c3b8e889c7fff7
BLAKE2b-256 62ae9ab73314570a56faf597be193451077a7f4f68fbf7abdbaacd17b818c380

See more details on using hashes here.

File details

Details for the file cerebrate_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: cerebrate_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.10 Darwin/22.1.0

File hashes

Hashes for cerebrate_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f4768048d3a7d380c540f70d67f07ab0884e2f2808b283ce6f53e8dd1452a9c
MD5 65d8fc1ce09ebe05e982763261d0a7c6
BLAKE2b-256 08368f8d337ff8f74a7194f5eb3187cdeee68f521b96c1dfb1e9bc17d6282b5e

See more details on using hashes here.

Supported by

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