@@ -805,12 +805,73 @@ int RedisAI_ScriptScan_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **arg
805805 return REDISMODULE_OK ;
806806}
807807
808+ void _RedisAI_Info (RedisModuleCtx * ctx ) {
809+ RedisModuleString * rai_version = RedisModule_CreateStringPrintf (ctx , "%d.%d.%d" , REDISAI_VERSION_MAJOR , REDISAI_VERSION_MINOR , REDISAI_VERSION_PATCH );
810+ RedisModuleString * llapi_version = RedisModule_CreateStringPrintf (ctx , "%d" , REDISAI_LLAPI_VERSION );
811+ RedisModuleString * rdb_version = RedisModule_CreateStringPrintf (ctx , "%llu" , REDISAI_ENC_VER );
812+
813+ int reponse_len = 6 ;
814+
815+ if (RAI_backends .tf .get_version ){
816+ reponse_len += 2 ;
817+ }
818+
819+ if (RAI_backends .torch .get_version ){
820+ reponse_len += 2 ;
821+ }
822+
823+ if (RAI_backends .tflite .get_version ){
824+ reponse_len += 2 ;
825+ }
826+
827+ if (RAI_backends .onnx .get_version ){
828+ reponse_len += 2 ;
829+ }
830+
831+ RedisModule_ReplyWithArray (ctx , reponse_len );
832+
833+ RedisModule_ReplyWithSimpleString (ctx , "Version" );
834+ RedisModule_ReplyWithString (ctx , rai_version );
835+
836+ // TODO: Add Git SHA
837+
838+ RedisModule_ReplyWithSimpleString (ctx , "Low Level API Version" );
839+ RedisModule_ReplyWithString (ctx , llapi_version );
840+
841+
842+ RedisModule_ReplyWithSimpleString (ctx , "RDB Encoding version" );
843+ RedisModule_ReplyWithString (ctx , llapi_version );
844+
845+ if (RAI_backends .tf .get_version ){
846+ RedisModule_ReplyWithSimpleString (ctx , "TensorFlow version" );
847+ RedisModule_ReplyWithSimpleString (ctx , RAI_backends .tf .get_version ());
848+ }
849+
850+ if (RAI_backends .torch .get_version ){
851+ RedisModule_ReplyWithSimpleString (ctx , "Torch version" );
852+ RedisModule_ReplyWithSimpleString (ctx , RAI_backends .torch .get_version ());
853+ }
854+
855+
856+ RedisModule_FreeString (ctx , rai_version );
857+ RedisModule_FreeString (ctx , llapi_version );
858+ RedisModule_FreeString (ctx , rdb_version );
859+ }
860+
808861/**
809862 * AI.INFO <model_or_script_key> [RESETSTAT]
810863 */
811864int RedisAI_Info_RedisCommand (RedisModuleCtx * ctx , RedisModuleString * * argv , int argc ) {
812- if (argc != 2 && argc != 3 )
865+ if (argc > 3 )
813866 return RedisModule_WrongArity (ctx );
867+
868+
869+ if (argc == 1 ) {
870+ _RedisAI_Info (ctx );
871+ return REDISMODULE_OK ;
872+ }
873+
874+
814875 RedisModuleString * runkey = argv [1 ];
815876 struct RedisAI_RunStats * rstats = NULL ;
816877 if (RAI_GetRunStats (runkey , & rstats ) == REDISMODULE_ERR ) {
0 commit comments