Comments (4)
Hi there @Distortedlogic please notice you need to import either specific parts or all from redisai-js given there is no default import.
Regarding a sample code, hope the following one helps ( included tensorset and tensorget given they dont need any extra model/script ):
import redis = require('redis');
import redisai = require('redisai-js');
console.log('Sample https://github.com/RedisAI/redisai-js/issues/22!');
(async () => {
const nativeClient: redis.RedisClient = redis.createClient(6379, 'localhost');
const aiclient = new redisai.Client(nativeClient);
const tensorA = new redisai.Tensor(redisai.Dtype.float32, [1, 2], [3, 5]);
const result = await aiclient.tensorset('tensorA', tensorA);
// AI.TENSORSET result: OK
console.log(`AI.TENSORSET result: ${result}`);
const tensorGetReply = await aiclient.tensorget('tensorA');
// AI.TENSORGET reply: datatype FLOAT shape [1,2] , data [3,5]
console.log(
`AI.TENSORGET reply: datatype ${tensorGetReply.dtype} shape [${tensorGetReply.shape}] , data [${tensorGetReply.data}]`
);
await aiclient.end();
})();
Sample output ( transpiling first ):
$ npm run compile
> [email protected] compile /tmp/sample-redisai-js-22
> tsc
$ node build/src/index.js
Sample https://github.com/RedisAI/redisai-js/issues/22!
AI.TENSORSET result: OK
AI.TENSORGET reply: datatype FLOAT shape [1,2] , data [3,5]
PS, this client tests are packed with several examples of tensorset,tensorget, modelrun, scriptrun, etc... - they can be of help for more complex examples also. https://github.com/RedisAI/redisai-js/blob/master/tests/test_client.ts
Can you please check if the above sample runs accordingly after transpiling. Will gladly share a sample GH repo if required with all structure if required.
Kind regards,
from redisai-js.
I tried
import redisai = require('redisai-js');
import {Client, Backend} from 'redisai-js';
I still get the same error
Error: Cannot find module './backend'
here is the command I run to start my app
nodemon --exec ts-node src/index.ts
Must it be transpiled to JS, n not compatible with ts-node? just throwin a thought out there
from redisai-js.
I think you're using the version 4 of redis module? I've experienced the same issue with the version 4 of redis module, so i've solved with the ^3.1.2 as project's dependency.
from redisai-js.
thanks for the idea but I just quit tryina use it.. Redis is slacking way too much with its AI stuff plus the company's become taken over with political agendas .. I even went as far as making PRs, talked with a team member to make sure it looked good, and just never got merged
from redisai-js.
Related Issues (11)
- Support for variadic arguments on SCRIPTRUN
- Proposal: use github dependabot instead of Snyk HOT 2
- Support for AI.DAGRUN
- Syntax Error upon import HOT 5
- Support for AI.DAGRUN_RO
- add bool tensor support
- add string tensor support
- Support for BATCHSIZE, MINBATCHSIZE, INPUTS and OUTPUTS on AI.MODELGET
- Use TF model object as parameter in new redisai.Model HOT 1
- Support chunking large model's protobuf blob into 512MB blocks on AI.MODELSET
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redisai-js.