Python SDK for gorse recommender system
Project description
PyGorse
Python SDK for gorse recommender system.
Install
- Install from PyPI:
pip install PyGorse
- Install from source:
git clone https://github.com/gorse-io/PyGorse.git
cd PyGorse
pip install .
Usage
Create a client by the entrypoint and api key.
from gorse import Gorse
client = Gorse('http://127.0.0.1:8087', 'api_key')
client.insert_feedbacks([
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'vuejs:vue', 'Timestamp': '2022-02-24' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'd3:d3', 'Timestamp': '2022-02-25' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'dogfalo:materialize', 'Timestamp': '2022-02-26' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'mozilla:pdf.js', 'Timestamp': '2022-02-27' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'moment:moment', 'Timestamp': '2022-02-28' }
])
client.get_recommend('bob', n=10)
The Python SDK implements the async client as well:
from gorse import AsyncGorse
client = AsyncGorse('http://127.0.0.1:8087', 'api_key')
await client.insert_feedbacks([
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'vuejs:vue', 'Timestamp': '2022-02-24' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'd3:d3', 'Timestamp': '2022-02-25' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'dogfalo:materialize', 'Timestamp': '2022-02-26' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'mozilla:pdf.js', 'Timestamp': '2022-02-27' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'moment:moment', 'Timestamp': '2022-02-28' }
])
await client.get_recommend('bob', n=10)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyGorse-0.4.8.tar.gz
(7.1 kB
view details)
Built Distribution
File details
Details for the file PyGorse-0.4.8.tar.gz
.
File metadata
- Download URL: PyGorse-0.4.8.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 463bc8261a4ac4d1aba6e51b55a6652a84e361073017db75f0625ea83247036c |
|
MD5 | b255652488ee4b665593ce1d08a0452d |
|
BLAKE2b-256 | 3f550433c62e1305ed734f14d036f697ec85a402955a91f6275f9fc61f7146fd |
File details
Details for the file PyGorse-0.4.8-py3-none-any.whl
.
File metadata
- Download URL: PyGorse-0.4.8-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 950f4e9fbb96dc34efbaacd6b867f5f11556aeccd00993e3176891d5bf042915 |
|
MD5 | 3844cf0f6c08dc1fce736d5ca27ba038 |
|
BLAKE2b-256 | 024676e01ef37b8b06ede74a8194f9809f05d06812f77b12695afbc666a27abe |