Skip to content

Commit

Permalink
Merge pull request #135 from HamaWhiteGG/dev
Browse files Browse the repository at this point in the history
Fix dependency convergence errors #129
  • Loading branch information
HamaWhiteGG committed Nov 30, 2023
2 parents d1e577a + 29ff7a5 commit 456bbc5
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 32 deletions.
48 changes: 38 additions & 10 deletions langchain-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,28 @@
<dependency>
<groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
<exclusion>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-context</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -133,27 +150,28 @@
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
</dependency>

<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -169,6 +187,16 @@
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Map<String, Object> getFullInputs(List<Pair<AgentAction, String>> interme
return fullInputs;
}

public static BaseSingleActionAgent fromLlmAndTools(
public static BaseSingleActionAgent fromLLMAndTools(
BaseLanguageModel llm,
List<BaseTool> tools,
Map<String, Object> kwargs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public List<String> returnValues() {
*/
public abstract AgentResult plan(List<Pair<AgentAction, String>> intermediateSteps, Map<String, Object> kwargs);

public static BaseSingleActionAgent fromLlmAndTools(
public static BaseSingleActionAgent fromLLMAndTools(
BaseLanguageModel llm,
List<BaseTool> tools,
Map<String, Object> kwargs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ public static BasePromptTemplate createPrompt(List<BaseTool> tools, String syste
* Construct an agent from an LLM and tools.
* This method will be called by the {@link Initialize#initializeAgent} using MethodUtils.invokeStaticMethod.
*/
public static Agent fromLlmAndTools(BaseLanguageModel llm, List<BaseTool> tools, Map<String, Object> kwargs) {
return fromLlmAndTools(llm, tools, null, SYSTEM_MESSAGE_PREFIX, SYSTEM_MESSAGE_SUFFIX, HUMAN_MESSAGE,
public static Agent fromLLMAndTools(BaseLanguageModel llm, List<BaseTool> tools, Map<String, Object> kwargs) {
return fromLLMAndTools(llm, tools, null, SYSTEM_MESSAGE_PREFIX, SYSTEM_MESSAGE_SUFFIX, HUMAN_MESSAGE,
FORMAT_INSTRUCTIONS, null, kwargs);
}

/**
* Construct an agent from an LLM and tools.
*/
public static Agent fromLlmAndTools(BaseLanguageModel llm, List<BaseTool> tools, AgentOutputParser outputParser,
public static Agent fromLLMAndTools(BaseLanguageModel llm, List<BaseTool> tools, AgentOutputParser outputParser,
String systemMessagePrefix, String systemMessageSuffix, String humanMessage, String formatInstructions,
List<String> inputVariables, Map<String, Object> kwargs) {
validateTools(tools);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static AgentExecutor initializeAgent(List<BaseTool> tools, BaseLanguageMo
}
Class<? extends BaseSingleActionAgent> clazz = AGENT_TO_CLASS.get(agent);
agentKwargs = agentKwargs != null ? agentKwargs : Map.of();
agentObj = (BaseSingleActionAgent) MethodUtils.invokeStaticMethod(clazz, "fromLlmAndTools",
agentObj = (BaseSingleActionAgent) MethodUtils.invokeStaticMethod(clazz, "fromLLMAndTools",
llm, tools, agentKwargs);
} else if (agentPath != null) {
agentObj = loadAgent(agentPath, Map.of("llm", llm, "tools", tools));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ public static PromptTemplate createPrompt(List<BaseTool> tools, String prefix, S
/**
* Construct an agent from an LLM and tools.
*/
public static Agent fromLlmAndTools(BaseLanguageModel llm, List<BaseTool> tools, Map<String, Object> kwargs) {
return fromLlmAndTools(llm, tools, null, PREFIX, SUFFIX, FORMAT_INSTRUCTIONS, null, kwargs);
public static Agent fromLLMAndTools(BaseLanguageModel llm, List<BaseTool> tools, Map<String, Object> kwargs) {
return fromLLMAndTools(llm, tools, null, PREFIX, SUFFIX, FORMAT_INSTRUCTIONS, null, kwargs);
}

/**
* Construct an agent from an LLM and tools.
*/
public static Agent fromLlmAndTools(BaseLanguageModel llm, List<BaseTool> tools, AgentOutputParser outputParser,
public static Agent fromLLMAndTools(BaseLanguageModel llm, List<BaseTool> tools, AgentOutputParser outputParser,
String prefix, String suffix, String formatInstructions, List<String> inputVariables,
Map<String, Object> kwargs) {
validateTools(tools);
Expand Down
11 changes: 11 additions & 0 deletions langchain-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
<artifactId>awaitility</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
13 changes: 0 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<commons-collections4.version>4.4</commons-collections4.version>
<hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
<redisson.version>3.17.3</redisson.version>
<netty-resolver.version>4.1.43.Final</netty-resolver.version>
<reactor-core.version>3.5.8</reactor-core.version>
<reactor-adapter.version>3.5.1</reactor-adapter.version>
<mockito-core.version>3.12.4</mockito-core.version>
Expand Down Expand Up @@ -266,18 +265,6 @@
<version>${redisson.version}</version>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
<version>${netty-resolver.version}</version>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
<version>${netty-resolver.version}</version>
</dependency>

<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
Expand Down

0 comments on commit 456bbc5

Please sign in to comment.