Skip to content

Commit b65a674

Browse files
authored
Merge branch 'main' into feat-allow_new_message_null
2 parents edf3911 + 9e3723b commit b65a674

File tree

47 files changed

+1971
-3361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1971
-3361
lines changed

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"redhat.java",
4+
"vscjava.vscode-java-pack",
5+
"josevseb.google-java-format-for-vs-code"
6+
]
7+
}

.vscode/settings.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
// formatOnType and formatOnPaste is a very bad idea for slow formatters
3+
// (such as an external Google Java Format invocation exec), so just on Save:
4+
"editor.formatOnSave": true,
5+
"editor.formatOnType": false,
6+
"editor.formatOnPaste": false,
7+
8+
"files.insertFinalNewline": true,
9+
"files.trimTrailingWhitespace": true,
10+
11+
"[java]": {
12+
"editor.tabSize": 2,
13+
// Format Java using https://github.com/google/google-java-format,
14+
// via https://github.com/JoseVSeb/google-java-format-for-vs-code
15+
"editor.defaultFormatter": "josevseb.google-java-format-for-vs-code",
16+
"editor.codeActionsOnSave": {
17+
// Used by at least JS as well as Java, so only overridden for [java]
18+
"source.organizeImports": "always",
19+
"source.addMissingImports": "never"
20+
}
21+
},
22+
// Keep this version in sync with the same version in pom.xml
23+
// NB: Changes to this are only taken into account on start-up, so need to restart.
24+
"java.format.settings.google.version": "1.27.0",
25+
// TODO https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/3050
26+
"java.compile.nullAnalysis.mode": "automatic",
27+
"java.completion.importOrder": ["#", "", "javax", "java"], //# is static
28+
"java.completion.favoriteStaticMembers": ["com.google.common.truth.Truth.*"],
29+
"java.configuration.updateBuildConfiguration": "automatic",
30+
"java.import.maven.enabled": true
31+
}

contrib/langchain4j/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<relativePath>../../pom.xml</relativePath>
2626
</parent>
2727

28-
<artifactId>google-adk-contrib-langchain4j</artifactId>
29-
<name>Agent Development Kit - Contributions - LangChain4j</name>
28+
<artifactId>google-adk-langchain4j</artifactId>
29+
<name>Agent Development Kit - LangChain4j</name>
3030
<description>LangChain4j integration for the Agent Development Kit.</description>
3131

3232
<properties>
33-
<mcp-schema.version>0.10.0</mcp-schema.version>
34-
<google.genai.version>1.0.0</google.genai.version>
33+
<mcp.version>0.10.0</mcp.version>
34+
<google.genai.version>1.8.0</google.genai.version>
3535
<junit.version>5.11.4</junit.version>
3636
<mockito.version>5.17.0</mockito.version>
3737
<langchain4j.version>1.1.0</langchain4j.version>
@@ -78,7 +78,7 @@
7878
<dependency>
7979
<groupId>io.modelcontextprotocol.sdk</groupId>
8080
<artifactId>mcp</artifactId>
81-
<version>${mcp-schema.version}</version>
81+
<version>${mcp.version}</version>
8282
</dependency>
8383

8484
<!-- Test dependencies -->
@@ -136,4 +136,4 @@
136136
<scope>test</scope>
137137
</dependency>
138138
</dependencies>
139-
</project>
139+
</project>

contrib/langchain4j/src/main/java/com/google/adk/models/langchain4j/LangChain4j.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,11 @@ private ChatRequest toChatRequest(LlmRequest llmRequest) {
224224
.mode()
225225
.ifPresent(
226226
functionMode -> {
227-
if (functionMode
228-
.knownEnum()
229-
.equals(FunctionCallingConfigMode.Known.AUTO)) {
227+
if (FunctionCallingConfigMode.Known.AUTO.equals(
228+
functionMode.knownEnum())) {
230229
requestBuilder.toolChoice(ToolChoice.AUTO);
231-
} else if (functionMode
232-
.knownEnum()
233-
.equals(FunctionCallingConfigMode.Known.ANY)) {
230+
} else if (FunctionCallingConfigMode.Known.ANY.equals(
231+
functionMode.knownEnum())) {
234232
// TODO check if it's the correct
235233
// mapping
236234
requestBuilder.toolChoice(ToolChoice.REQUIRED);
@@ -246,9 +244,8 @@ private ChatRequest toChatRequest(LlmRequest llmRequest) {
246244
toolSpecification.name()))
247245
.toList());
248246
});
249-
} else if (functionMode
250-
.knownEnum()
251-
.equals(FunctionCallingConfigMode.Known.NONE)) {
247+
} else if (FunctionCallingConfigMode.Known.NONE.equals(
248+
functionMode.knownEnum())) {
252249
requestBuilder.toolSpecifications(List.of());
253250
}
254251
});
@@ -349,7 +346,7 @@ private List<ChatMessage> toUserOrToolResultMessage(Content content) {
349346
.mimeType(mimeType)
350347
.build());
351348
} else if (mimeType.startsWith("text/")
352-
|| mimeType.equals("application/json")
349+
|| "application/json".equals(mimeType)
353350
|| mimeType.endsWith("+json")
354351
|| mimeType.endsWith("+xml")) {
355352
// TODO are there missing text based mime types?
@@ -454,7 +451,7 @@ private List<ToolSpecification> toToolSpecifications(LlmRequest llmRequest) {
454451
}
455452

456453
private JsonObjectSchema toParameters(Schema schema) {
457-
if (schema.type().isPresent() && schema.type().get().knownEnum().equals(Type.Known.OBJECT)) {
454+
if (schema.type().isPresent() && Type.Known.OBJECT.equals(schema.type().get().knownEnum())) {
458455
return JsonObjectSchema.builder()
459456
.addProperties(toProperties(schema))
460457
.required(schema.required().orElse(List.of()))
@@ -490,7 +487,7 @@ private JsonSchemaElement toJsonSchemaElement(Schema schema) {
490487
.items(toJsonSchemaElement(schema.items().orElseThrow()))
491488
.build();
492489
case OBJECT -> toParameters(schema);
493-
case TYPE_UNSPECIFIED ->
490+
default ->
494491
throw new UnsupportedFeatureException(
495492
"LangChain4jLlm does not support schema of type: " + type);
496493
};

core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<description>Agent Development Kit: an open-source, code-first toolkit designed to simplify building, evaluating, and deploying advanced AI agents anywhere.</description>
3131

3232
<properties>
33-
<mcp-schema.version>0.10.0</mcp-schema.version>
33+
<mcp.version>0.10.0</mcp.version>
3434
<errorprone.version>2.38.0</errorprone.version>
3535
<google.auth.version>1.33.1</google.auth.version>
3636
<google.cloud.storage.version>2.28.0</google.cloud.storage.version>
@@ -76,7 +76,7 @@
7676
<dependency>
7777
<groupId> io.modelcontextprotocol.sdk</groupId>
7878
<artifactId>mcp</artifactId>
79-
<version>${mcp-schema.version}</version>
79+
<version>${mcp.version}</version>
8080
</dependency>
8181
<dependency>
8282
<groupId>com.google.auth</groupId>
@@ -229,4 +229,4 @@
229229
</resource>
230230
</resources>
231231
</build>
232-
</project>
232+
</project>

0 commit comments

Comments
 (0)