Skip to main content

Python SDK for gorse recommender system

Project description

PyGorse

CI

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


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.7.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

PyGorse-0.4.7-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file PyGorse-0.4.7.tar.gz.

File metadata

  • Download URL: PyGorse-0.4.7.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for PyGorse-0.4.7.tar.gz
Algorithm Hash digest
SHA256 591efcb5449429a91c3d987f559835d3dbd0f831c21422835ceac0cbec37b550
MD5 33637720d0bc7daea28f046e6106a31a
BLAKE2b-256 368c0361433906f5cfc29bfd96c0e70a3e00f7711253b3482fa329dec8ac9413

See more details on using hashes here.

File details

Details for the file PyGorse-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: PyGorse-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for PyGorse-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b65ceb7fc5984ed64a02383f66d747eb82e72bffb8464f28e4908d13a82d7b07
MD5 199c68394a0cc04e4ae812f8cfd12d5f
BLAKE2b-256 421745cbfa932c859f15626520cb52a557fd16144df19df3998e52b019b03c9a

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