Skip to main content

The client side python apis for making integration with recvani serveers

Project description

python-recvani

This contains the client side api for use with recvani server. Recvani is collabrative learning platform for any bussiness where a user and item interact. So client can send score for user interactions and ask for recommendation for user. And all these things in real time.

Check us out at https://www.recvani.com

Features

  • Ease to integration:

    Integrating is as simple as integrating a database.

  • Real time system:

    User interaction are taken care within milliseconds for recommendation

  • Can Scale very easily:

    It can easily support upto millions of users.

  • Low on cost:

    Cost for deploying will be much less than your inhouse machine learning cost.

  • Support categorization:

    Client can easily ask for specific category of item for a user.

Installation

We can directly install python client using pip

pip install recvani

Examples

Client need model name, client key and model key for connecting to recvani server. You can get these by contacting us.

Creating connection

Setting up connection is quite easy.

from recvani.rv_client import rv_client
#Don't forget to replace these by the keys you will get.
client = rv_client(CLIENT_KEY, MODEL_NAME, MODEL_KEY)

Sending Interacations

Send Single Interaction

from recvani.rv_requests import simple_interaction
import time

USER = "USER1"           # unique id for user
ITEM = "ITEM1"           # item id (item can be news id, video id, product id etc.)
SCORE = 1.0              # score client want to give for interaction. Should be devised intelligently
ITIME = int(time.time()) # time for the interaction in seconds

interaction = simple_interaction(USER, ITEM, SCORE, ITIME)

result = client.send(interaction)  #result will 1 on sucess otherwise exception will be thrown. Better to catch it.

Send Batch Interactions

from recvani.rv_requests import batch_interaction, simple_interaction
import time

bi = []
bi.append(simple_interaction("USER1", "ITEM1", 0.0, int(time.time())))
bi.append(simple_interaction("USER2", "ITEM1", 1.0, int(time.time())))
bi.append(simple_interaction("USER1", "ITEM2", 0.0, int(time.time())))

bis = batch_interaction(bi)

result = client.send(bis)

Sending Parameters

We can attach tags and expiry time for every item

Send expiry time

from recvani.rv_requests import exp_request
import time

EXP_TIME = time.time() + 30*24*3600 # The time you want to expire the item. 
rexp = exp_request("ITEM1", EXP_TIME)
result = client.send(rexp)

Send tags

from recvani.rv_requests import tag_request
TAGS = ["TAG1", "TAG2"]
trequest = tag_request("STORY1", TAGS)
result = client.send(trequest)

Send in bulk

 from recvani.rv_requests import batch_param, item_param
 import time

 param1 = item_param("ITEM1", int(time.time()) + 365*24*3600, ["TAG1"])
 param2 = item_param("ITEM2", None, ["TAG2"])
 param3 = item_param("ITEM3", exp_time = int(time.time()) + 365*24*3600)

 bparam = batch_param([param1, param2, param3])

 result = client.send(bparam)

Getting Result

We can get the final recommendation for the user. We can filter history and send you items for particular tag.

Overall Recommendation

from recvani.rv_requests import rec_request 

USER = "USER1"      # USER ID
COUNT = 10          # Count of Recommended item to fetch
TAGS = []           # Tags of item, Empty for overall 
HISTORY = False     # Will not serve already serverd item.

rc = rec_request("USER1", 1, [], True)
result = client.send(rc) # Result will be list of items

Tagged Recommedation

rc = rec_request("USER1", 10, [["TAG1"]], True)
result = client.send(rc) # Will give 10 stories with "TAG1" attached to it  

Complex Queries

Tags can be used to make complex queries. For Example

TAGS = [["TAG1", "TAG2"], ["TAG4"]]

The inner lists provide intersection and outer lists provide union. The tags above will return all time which are either marked "TAG4" or have both "TAG1" and "TAG2" attached to it.

For any help feel free to contact anshuman@recvani.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for recvani, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size recvani-0.0.6-py3-none-any.whl (7.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size recvani-0.0.6.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page