byteplus rec python sdk
Install the client library
pip install --upgrade byteplus-rec
Saas E-Commerce Example
from byteplus_rec.region.region import Region
from byteplus_rec.retail.retail_client import Client
from byteplus_rec.retail.retail_client_builder import ClientBuilder
from byteplus_rec_core.exception import BizException
log = logging.getLogger(__name__)
# A unique identity assigned by Bytedance.
PROJECT_ID = "***********"
# Unique id for this model.The saas model id that can be used to get rec results from predict api,
# which is need to fill in URL.
MODEL_ID = "***********"
# Required Param:
# tenant_id
# region
# AK
# SK
# Optional Param:
# scheme
# hosts
try:
client: Client = ClientBuilder() \
.account_id("***********") \
.region(Region.SG) \
.project_id(PROJECT_ID) \
.auth_ak("***********") \
.auth_sk("***********") \
.build()
except BizException as clientE:
log.error("fail to create byteplus rec client, msg:%s", clientE)
if __name__ == '__main__':
client.write_users()
client.predict()
Saas Content(Short-Video/Image/Doc) Example
from byteplus_rec.region.region import Region
from byteplus_rec.content.content_client import Client
from byteplus_rec.content.content_client_builder import ClientBuilder
from byteplus_rec_core.exception import BizException
log = logging.getLogger(__name__)
# A unique identity assigned by Bytedance.
PROJECT_ID = "***********"
# Unique id for this model.The saas model id that can be used to get rec results from predict api,
# which is need to fill in URL.
MODEL_ID = "***********"
# Required Param:
# tenant_id
# region
# AK
# SK
# Optional Param:
# scheme
# hosts
try:
client: Client = ClientBuilder() \
.account_id("***********") \
.region(Region.SG) \
.project_id(PROJECT_ID) \
.auth_ak("***********") \
.auth_sk("***********") \
.build()
except BizException as clientE:
log.error("fail to create byteplus rec client, msg:%s", clientE)
if __name__ == '__main__':
client.write_users()
client.predict()
How to run example
Take the E-commerce industry as an example:
- clone the project.
- install requirements.
- add sdk root path to envs.
- enter the example directory.
- fill necessary parameters.
- run main.py.
git clone https://github.com/byteplus-sdk/byteplus-sdk-python-rec.git
cd byteplus-sdk-python-rec
pip3 install -r requirements.txt
export PYTHONPATH=$PYTHONPATH:$PWD
cd byteplus_rec/retail/example
# fill in projectID, modelID, tenantID, AK, SK and other parameters.
python3 main.py
For more details
Metadata
Release files for byteplus-rec 1.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| byteplus-rec-1.0.10.tar.gz | 33.0 kB | Without provenance | Details for byteplus-rec-1.0.10.tar.gz |
Release files / byteplus-rec-1.0.10.tar.gz
| Download URL | byteplus-rec-1.0.10.tar.gz |
|---|---|
| Size | 33.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca8715b08213c8a8cc7d58c17504f96dd1bfb2c21edd44faac274ef807b4d3c2
|
|
BLAKE2b-256 checksum How to use checksums |
6f9304aad9fea7805d2a63d5a607cfb7468e915b09c2284b080a722c79a79396
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for byteplus-rec 1.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.