Skip to main content

A Python SDK for the TeaRex API

Project description

TeaRex AI Python SDK

This package provides a Python SDK for the tearex.ai Recommendation Engine API. If you don't have a tearex.ai account, you can request one here: tearex.ai.

Documentation

For more information about the API, please refer to the documentation.

Installation

To install the SDK, run the following command:

pip install tearex-ai

Usage

Import the SDK:

import tearex

Initialize the SDK

Provide the url of the API and your API KE as an environment variable TEAREX_URL and TEAREX_API_KEY, or pass them as an argument to the init function:

trx = tearex.Client(uri='YOUR_TEAREX_API_URL', apiKey='YOUR_TEAREX_API_KEY')

Example

import tearex

trx = tearex.Client()

# Define the entities where Alice is a new user and Kale is an existing product.
alice = {"id": "user-1", "label": "User", "properties": {"name": "Alice"}}
kale = {"id": "product-1", "label": "User", "properties": {"name": "Kale"}}

# Create Alice since she is a new user
trx.create_entity(alice)

# Alice purchases Kale, so we create the "Purchased" event
trx.create_event(alice, "Purchased", kale)

# Recommend Alice the next "Product" to purchase
trx.recommend(alice, "Product")

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

tearex-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file tearex-0.1.1.tar.gz.

File metadata

  • Download URL: tearex-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for tearex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d9f487d96a3ccbf1a630bfa9a56cb4f78c7b2f8c03bbd95a3fce0ba347d7bc91
MD5 544f6675988e68dcfa5a08134ef53d27
BLAKE2b-256 44795770299836c034f1a370a005fd824f045a1f399dabf9784e29a35de152e7

See more details on using hashes here.

Supported by

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