Skip to content

ThomAub/redisai-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redisai-rs

A rust client for RedisAI

Please read the API documentation on doc.rs

MIT license Crates.io docs.rs GitHub Workflow Status

Installation

The RedisAI module needs to be installed first. A docker image is provided for convinience from redislab:

# cpu version
docker run -p 6379:6379 -it --rm redislabs/redisai:edge-cpu
# gpu version
docker run -p 6379:6379 -it --rm redislabs/redisai:edge-gpu

The gpu version use nvidia runtime so nvidia gpu needto be available. More information can be found in RedisAI github

Then simply add it to your Cargo.toml

[dependencies]
redis = "0.20.0"
redisai = "0.1.1"

Usage

use redis;

use redisai::RedisAIClient;
use redisai::tensor::{ToFromBlob,AITensor};

let aiclient: RedisAIClient = RedisAIClient { debug: true };
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let mut con = client.get_connection().unwrap();

let tensor_data: Vec<i8> = vec![1, 2, 3, 127];
let shape: [usize; 1] = [4];
let ai_tensor: AITensor<i8, 1> = AITensor::new(shape, tensor_data.to_blob());

aiclient.ai_tensorset(&mut con, "example_one_dim_i8_tensor".to_string(), ai_tensor);

let ai_tensor: AITensor<i8, 1> = aiclient.ai_tensorget(&mut con, "example_one_dim_i8_tensor".to_string(), false).unwrap();

About

A rust client for RedisAI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages