-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javet: Integrate as code execution engine #43
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Would you mind running make format
to apply spotless?
code-execution-engines/langchain4j-code-execution-engine-javet/pom.xml
Outdated
Show resolved
Hide resolved
code-execution-engines/langchain4j-code-execution-engine-javet/pom.xml
Outdated
Show resolved
Hide resolved
...-execution-engine-javet/src/main/java/dev/langchain4j/agent/V8JavaScriptExecutionEngine.java
Outdated
Show resolved
Hide resolved
...de-execution-engine-javet/src/main/java/dev/langchain4j/agent/V8JavaScriptExecutionTool.java
Outdated
Show resolved
Hide resolved
...cution-engine-javet/src/test/java/dev/langchain4j/agent/V8JavaScriptExecutionEngineTest.java
Outdated
Show resolved
Hide resolved
…/pom.xml Co-authored-by: Martin7-1 <[email protected]>
…/pom.xml Co-authored-by: Martin7-1 <[email protected]>
…/src/main/java/dev/langchain4j/agent/V8JavaScriptExecutionEngine.java Co-authored-by: Martin7-1 <[email protected]>
…/src/main/java/dev/langchain4j/agent/V8JavaScriptExecutionTool.java Co-authored-by: Martin7-1 <[email protected]>
…/src/test/java/dev/langchain4j/agent/V8JavaScriptExecutionEngineTest.java Co-authored-by: Martin7-1 <[email protected]>
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@omarmahamid Thank you!
- Tool's IT is missing, could you please test tool if works correctly?
- Could you move the
ExecutionEngine
todev.langchain4j.community.code.javet
package, and move theTool
todev.langchain4j.community.agent.tool.javet
package?
package dev.langchain4j.community.agent; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Please always use the same assert
framework (Prefer AssertJ
).
@@ -62,6 +62,7 @@ | |||
|
|||
<!-- Integration of web search engine --> | |||
<module>web-search-engines/langchain4j-community-web-search-engine-searxng</module> | |||
<module>code-execution-engines/langchain4j-code-execution-engine-javet</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the directory name is not correctly. (Missing community
)
|
||
<dependency> | ||
<groupId>dev.langchain4j</groupId> | ||
<artifactId>langchain4j-code-execution-engine-graalvm-polyglot</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Looks like this dependency is not necessary
|
||
<dependency> | ||
<groupId>dev.langchain4j</groupId> | ||
<artifactId>langchain4j</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Looks like this dependency is not necessary
|
||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-junit-jupiter</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Looks like this dependency is not necessary
} | ||
|
||
@Override | ||
public String execute(final String code) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public String execute(final String code) { | |
public String execute(String code) { |
import dev.langchain4j.agent.tool.Tool; | ||
import dev.langchain4j.code.CodeExecutionEngine; | ||
|
||
public class V8JavaScriptExecutionTool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class V8JavaScriptExecutionTool { | |
public class JavetJavaScriptExecutionTool { |
@@ -0,0 +1,39 @@ | |||
package dev.langchain4j.community.agent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move it to dev.langchain4j.community.code.javet
package?
@@ -0,0 +1,24 @@ | |||
package dev.langchain4j.community.agent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move it to dev.langchain4j.community.agent.tool.javet
package?
|
||
public class V8JavaScriptExecutionEngine implements CodeExecutionEngine { | ||
|
||
private final IJavetEnginePool<V8Runtime> javetEnginePool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this pool does not close properly.
Issue
Closes #langchain4j/langchain4j#1984
#langchain4j/langchain4j#1983
we decide to add the v8 execution engine to lc4j community.
Change
General checklist
Checklist for adding new maven module
pom.xml
andlangchain4j-community-bom/pom.xml
Checklist for adding new embedding store integration
{NameOfIntegration}EmbeddingStoreIT
that extends from eitherEmbeddingStoreIT
orEmbeddingStoreWithFilteringIT
{NameOfIntegration}EmbeddingStoreRemovalIT
that extends fromEmbeddingStoreWithRemovalIT
Checklist for changing existing embedding store integration
{NameOfIntegration}EmbeddingStore
works correctly with the data persisted using the latest released version of LangChain4j