Package dev.langchain4j.code.judge0
Class Judge0JavaScriptExecutionTool
java.lang.Object
dev.langchain4j.code.judge0.Judge0JavaScriptExecutionTool
A tool that executes JS code using the Judge0 service, hosted by Rapid API.
-
Constructor Summary
ConstructorDescriptionJudge0JavaScriptExecutionTool
(String apiKey) Constructs a new instance with the provided Rapid API key.Judge0JavaScriptExecutionTool
(String apiKey, boolean fixCodeIfNeeded, Duration timeout) Constructs a new instance with the provided Rapid API key, a flag to control whether to fix the code, and a timeout. -
Method Summary
-
Constructor Details
-
Judge0JavaScriptExecutionTool
Constructs a new instance with the provided Rapid API key. The code fixing feature is enabled by default. Default timeout is 10 seconds.- Parameters:
apiKey
- The Rapid API key. You can subscribe to the free plan (Basic) here: https://rapidapi.com/judge0-official/api/judge0-ce/pricing
-
Judge0JavaScriptExecutionTool
Constructs a new instance with the provided Rapid API key, a flag to control whether to fix the code, and a timeout.- Parameters:
apiKey
- Rapid API key. You can subscribe to the free plan (Basic) here: https://rapidapi.com/judge0-official/api/judge0-ce/pricingfixCodeIfNeeded
- Judge0 can return result of an execution if it was printed to the console. If provided JS code does not print result to the console, attempt will be made to fix it.timeout
- Timeout for calling Judge0.
-
-
Method Details
-
executeJavaScriptCode
-