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 = rec_request.FULL_HISTORY_FILTER # Will not serve already serverd item.
rc = rec_request(USER, COUNT, [], HISTORY)
result = client.send(rc) # Result will be list of items
Tagged Recommedation
rc = rec_request(USER, COUNT, [["TAG1"]], HISTORY)
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.
Source Distribution
Built Distribution
File details
Details for the file recvani-0.0.8.tar.gz
.
File metadata
- Download URL: recvani-0.0.8.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.32.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63456481136b204ec08fab64bd739e853b54523dd4dab4b4b24546e211399482 |
|
MD5 | b127c95ddd85181eba60662c825c2b79 |
|
BLAKE2b-256 | 82a0c2ec2ec457c1ef268cfc5c5b031f3ac128bccecd59b9ef34daaec6fce990 |
File details
Details for the file recvani-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: recvani-0.0.8-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.32.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5dbf7a86dbc7c8865329c96cb16569f23bde6d7ff60eac12e9d0851fd0e792 |
|
MD5 | b517250157e898783ccbea37de577c82 |
|
BLAKE2b-256 | 7c62f2b84427c1fbe4aca7c6a8c3c67f5d3899aed1469a69c1c730b7ca4e5c07 |