a2578d7ff1
snapshot_release / snapshot_release (push) Has been cancelled
Documentation: build and deploy / deploy (push) Has been cancelled
langchain4j-github-bot.yml lint / langchain4j-github-bot.yml validation (push) Has been cancelled
Java CI / compile_and_unit_test (17) (push) Has been cancelled
Java CI / compile_and_unit_test (21) (push) Has been cancelled
Java CI / compile_and_unit_test (25) (push) Has been cancelled
Split Package Detection / check-split-packages (push) Has been cancelled
Java CI / integration_test (21) (push) Has been cancelled
Java CI / compliance (push) Has been cancelled
Java CI / spotless (push) Has been cancelled
2.8 KiB
2.8 KiB
sidebar_position
| sidebar_position |
|---|
| 4 |
Local
CommandLineExecutionEngine uses the local computer env to execute provided command line code.
There are CommandLineTool and LocalScriptExecutionTool two implemented tools,
that can be useful for Desktop Automation or Computer-Use Agents
(such as File Management, Application Control). You can control your computer using natural language, something like:
set my mac output volume 50list all running applications in my mactell a story and then read it out loudtell a story about moon and save it into a text file- ...
:::danger ⚠️ Security Warning: High-Risk Code Execution
Attention! It might be dangerous to execute the code in a production online serving environment. It needs to be executed through security sandbox environment if used in online serving.
❗ Do NOT use in production environments! :::
Maven Dependency
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-code-execution-engine-local</artifactId>
<version>${latest version here}</version>
</dependency>
APIs
CommandLineExecutionEngineCommandLineToolLocalScriptExecutionTool
Examples
LocalScriptExecutionTool tool = new LocalScriptExecutionTool();
Assistant assistant = AiServices.builder(Assistant.class)
.chatModel(model)
.tools(tool)
.chatMemory(MessageWindowChatMemory.withMaxMessages(10))
.build();
String answer = assistant.chat("list all running applications in my mac");
System.out.println(answer);