Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Remove mandatory model name in LangChain4j integration

未关闭
#1,124 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@hemasekhar-p 已经在做这个了。

开始于 2026年4月9日。

评估

这个 Issue 还没有评估数据。

描述

needs review

🔴 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/adk-java 的其他 Issue

查看 google/adk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。