Skip to content

# hydra里基于LLM的SmartMonkey到底是如何实现有点疑问? #593

@bolt163

Description

@bolt163

看PR稿里实现了基于LLM的 monkey智能探索,对里面的实现比较感兴趣,看完一头雾水有两个疑问向大神们请教下

##1.center里有几个对openapi的封装,但似乎都没看到实际调用的地方,看代码好像没看到代码里有实质调用LLM模型的地方

##2.agent里SmartMonkey,与LLM模型相关的api,version等参数都在 SmartTestParam这个类里定义,但最终传来传去,实际最后程序运行时是收归到了runSmartTestOnce函数,然后如果能执行到,则是进入 smartTestUtil.runPYFunction(smartTestParam, logger);
看这个函数的执行 最后是在执行一段python脚本,非常不解的是代码实现有必要写这么绕吗?
public String runPYFunction(SmartTestParam smartTestParam, Logger logger) throws Exception {
File smartTestFolder = new File(smartTestParam.getOutputFolder(), Const.SmartTestConfig.RESULT_FOLDER_NAME);
smartTestFolder.mkdir();
String res = null;
String[] runArgs = new String[9];
runArgs[0] = "python";
runArgs[1] = filePath;
runArgs[2] = smartTestParam.apkPath;
runArgs[3] = smartTestParam.deviceInfo;
runArgs[4] = smartTestParam.modelInfo;
runArgs[5] = smartTestParam.testSteps;
runArgs[6] = smartTestParam.stringTextFolder;
runArgs[7] = smartTestFolder.getAbsolutePath();
runArgs[8] = smartTestParam.llmInfo;

    for (String tempArg : runArgs) {
        logger.info(tempArg);
    }
    Process proc = Runtime.getRuntime().exec(runArgs);
    SmartTestLog err = new SmartTestLog(proc.getErrorStream(), logger);
    SmartTestLog out = new SmartTestLog(proc.getInputStream(), logger);
    err.start();
    out.start();
    res = out.getContent();
    proc.waitFor();

    return res;
}

然后这里面的filePath, smartTestParam参数 以及所执行到的python文件 PY_FILE_NAME 都是在 hydralab\common\util 目录的 Const.java里所定义。。感觉有点乱七八糟的代码

##3.上面的 smartTestParam参数,涉及 BERT_MODEL_NAME, TOPIC_MODEL_NAME等模型参数的定义,猜测最终SmartMonkey是基于这两个模型来做决策的么,是在线or离线的Reference?这里能在文档里注明出来么,看的有点云里雾里

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions