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.5.0.tar.gz (8.9 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.5.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file pygorse-0.5.0.tar.gz.

File metadata

  • Download URL: pygorse-0.5.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pygorse-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c3f95534117dc11c7e1dd03544cec67e17e22405564fd7e96b2d07b130f5f9a2
MD5 5d9f97ea21886f1cbbba740edafc100e
BLAKE2b-256 9bd1541a63fa1ffdb9dabf14d8fda792d240da51f427bd2ba917155e104da92a

See more details on using hashes here.

File details

Details for the file pygorse-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pygorse-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pygorse-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8767522583b9c20fa2a5c2fb7bf67381b8cb670802678f063d04af7d1a769a39
MD5 f86c77a1553e3b82d1588f3c50c23578
BLAKE2b-256 d9d438464b36547d71e32bd6789cf6b26fbeb711e24a8a4d7e30927dc7ddac68

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