-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gettin a basic example going in TypeScript #22
Comments
Hi there @Distortedlogic please notice you need to import either specific parts or all from redisai-js given there is no default import. 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 ):
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. |
I tried
I still get the same error
here is the command I run to start my app
Must it be transpiled to JS, n not compatible with ts-node? just throwin a thought out there |
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. |
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 |
I have been using redisai-py for a while. Now I am starting to integrate use of redisai into my website with redisai-js.
I am using typescript and ts-node in development. Below is the code I added following the example and the error I received.
The text was updated successfully, but these errors were encountered: