Remove mandatory model name in LangChain4j integration
维护者通常 1 天内回复
@hemasekhar-p 已经在做这个了。
开始于 2026年4月9日。
评估
这个 Issue 还没有评估数据。
描述
🔴 Required Information
Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected / deprioritized.
If an item is not applicable to you - please mark it as N/A
Is your feature request related to a specific problem?
When I'm using the LangChain4J integration I need to set twice the model name: once in the LangCHain4j configuration and one when using the LangChain4j builder.
import com.google.adk.agents.LlmAgent;
import com.google.adk.models.langchain4j.LangChain4j;
import dev.langchain4j.model.anthropic.AnthropicChatModel;
// 1. Initialize LangChain4j model
AnthropicChatModel claudeModel = AnthropicChatModel.builder()
.apiKey(System.getenv("ANTHROPIC_API_KEY"))
.modelName("claude-sonnet-4-6")
.build();
// 2. Wrap the LangChain4j model for ADK
LangChain4j adkModel = LangChain4j.builder()
.chatModel(claudeModel)
.modelName("claude-sonnet-4-6") // <--- 👀 here
.build();
// 3. Create your agent
LlmAgent agent = LlmAgent.builder()
.name("science-teacher")
.description("A helpful science teacher")
.model(adkModel)
.instruction("You are a helpful science teacher that explains concepts clearly.")
.build();
Describe the Solution You'd Like
As the model name is configured in the LangChain4j configuration, it should be more maintenable to not set it again with the LangChain4J builder.
import com.google.adk.agents.LlmAgent;
import com.google.adk.models.langchain4j.LangChain4j;
import dev.langchain4j.model.anthropic.AnthropicChatModel;
// 1. Initialize LangChain4j model
AnthropicChatModel claudeModel = AnthropicChatModel.builder()
.apiKey(System.getenv("ANTHROPIC_API_KEY"))
.modelName("claude-sonnet-4-6")
.build();
// 2. Wrap the LangChain4j model for ADK
LangChain4j adkModel = LangChain4j.builder()
.chatModel(claudeModel)
.build();
// 3. Create your agent
LlmAgent agent = LlmAgent.builder()
.name("science-teacher")
.description("A helpful science teacher")
.model(adkModel)
.instruction("You are a helpful science teacher that explains concepts clearly.")
.build();
Impact on your work
Minore impact, it's just more readable and maintainable.
Willingness to contribute
Are you interested in implementing this feature yourself or submitting a PR?
No
- 主要语言
- Java
- 星标
- 1.7k
- 派生
- 421
- 平均合并
- 3 天 14 小时
- 30 天内合并 PR
- 31
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-java 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 68/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
维护者通常 1 天内回复
-
Approved tool call re-runs on every later user turn if it never got a function response可能已有人在做 @hemasekhar-p 于 2 天前认领。 未关闭needs review
google/adk-java#1556 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
LocalSkillSource.listResources returns backslash-separated paths on Windows可能已有人在做 @hemasekhar-p 于 2 天前认领。 未关闭needs review
google/adk-java#1541 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Context caching (ContextCacheConfig) is a silent no-op: config is plumbed to InvocationContext but never read可能已有人在做 @hemasekhar-p 于 4 天前认领。 未关闭needs review
难度 5/5 一周以上 新手友好度 35/100
google/adk-java#1530 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
OpenAPITools/openapi-generator#25014 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
openhab/openhab-core#5847 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 88/100
apache/parquet-java#3820 ·
维护者通常 1 天内回复