BeanpublicReactAgentchatbotReactAgent(ChatModelchatModel,ShellTool2shellTool,ToolCallbackexecutePythonCode,ToolCallbackviewTextFile,MemorySavermemorySaver){returnxxx;这个里面有两个ToolCallback如何注入BeanpublicToolCallbackexecutePythonCode(){returnFunctionToolCallback.builder(execute_python_code,newPythonTool()).description(PythonTool.DESCRIPTION).inputType(PythonTool.PythonRequest.class).build();}// 把框架提供的 ReadFileTool 包装成名为 view_text_file 的读文件工具。BeanpublicToolCallbackviewTextFile(){ReadFileToolreadFileToolnewReadFileTool();returnFunctionToolCallback.builder(view_text_file,readFileTool).description(View the contents of a text file. The file_path parameter must be an absolute path. You can specify offset and limit to read specific portions of the file. By default, reads up to 500 lines starting from the beginning of the file.).inputType(ReadFileTool.ReadFileRequest.class).build();}spring对象注入1.先按类型找2.如果同类型有多个再按 Bean 名区分默认函数名就是Bean的名字也可以指定Bean(pythonToolCallback)publicToolCallbackexecutePythonCode(){returnFunctionToolCallback.builder(execute_python_code,newPythonTool()).description(PythonTool.DESCRIPTION).inputType(PythonTool.PythonRequest.class).build();}3.如果还分不清就用 Qualifier 明确指定。Qualifier(pythonToolCallback)ToolCallbackexecutePythonCode
spring有多个对象时如何注入
BeanpublicReactAgentchatbotReactAgent(ChatModelchatModel,ShellTool2shellTool,ToolCallbackexecutePythonCode,ToolCallbackviewTextFile,MemorySavermemorySaver){returnxxx;这个里面有两个ToolCallback如何注入BeanpublicToolCallbackexecutePythonCode(){returnFunctionToolCallback.builder(execute_python_code,newPythonTool()).description(PythonTool.DESCRIPTION).inputType(PythonTool.PythonRequest.class).build();}// 把框架提供的 ReadFileTool 包装成名为 view_text_file 的读文件工具。BeanpublicToolCallbackviewTextFile(){ReadFileToolreadFileToolnewReadFileTool();returnFunctionToolCallback.builder(view_text_file,readFileTool).description(View the contents of a text file. The file_path parameter must be an absolute path. You can specify offset and limit to read specific portions of the file. By default, reads up to 500 lines starting from the beginning of the file.).inputType(ReadFileTool.ReadFileRequest.class).build();}spring对象注入1.先按类型找2.如果同类型有多个再按 Bean 名区分默认函数名就是Bean的名字也可以指定Bean(pythonToolCallback)publicToolCallbackexecutePythonCode(){returnFunctionToolCallback.builder(execute_python_code,newPythonTool()).description(PythonTool.DESCRIPTION).inputType(PythonTool.PythonRequest.class).build();}3.如果还分不清就用 Qualifier 明确指定。Qualifier(pythonToolCallback)ToolCallbackexecutePythonCode