[BUG] Python memory summarization fails for Gemini models: the request has no model name

未关闭 适合新手
#3,710 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@BahaaMattar 已经在做这个了。

开始于 2026年11月17日。

  • #3711 来自 @BahaaMattar —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
google-cloud, python
领域
backend

调研方向

从python/packages/kagent-adk/src/kagent/adk/_memory_service.py开始,阅读KagentMemoryService._summarize_session_content_async,然后检查 Gemini 请求如何获取其模型名称。使用 issue 中描述的模拟 Gemini 客户端复现问题,并为该请求添加一个有针对性的测试。完成标准是:摘要返回提取出的事实,且请求包含配置的模型名称。

由索引模型根据 Issue 内容生成。

描述

📋 Prerequisites
  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue
🎯 Affected Service(s)

App Service

🚦 Impact/Severity

Minor inconvenience

🐛 Bug Description

KagentMemoryService._summarize_session_content_async (python/packages/kagent-adk/src/kagent/adk/_memory_service.py) builds LlmRequest(contents=[...]) without model. google-adk's Gemini raises Gemini requests require a model name. for such a request. With memory enabled on a gemini or gemini_vertex_ai ModelConfig, the session summary therefore always fails and the raw transcript is stored as a single memory instead of the extracted facts. The other providers fall back to their own model name, so they're not affected.

🔄 Steps To Reproduce

On main (29aaacd, google-adk 2.14.1), with a stub Gemini client:

import asyncio
from types import SimpleNamespace
from unittest.mock import MagicMock
from google.genai import types
from kagent.adk._memory_service import KagentMemoryService
from kagent.adk.models._gemini import KAgentGeminiLlm

async def generate_content(*, model, contents, config):
    print("model sent:", model)
    return types.GenerateContentResponse(candidates=[types.Candidate(content=types.Content(role="model", parts=[types.Part(text='["User prefers dark mode"]')]))])

llm = KAgentGeminiLlm(model="gemini-2.5-flash")
llm.__dict__["api_client"] = SimpleNamespace(vertexai=False, aio=SimpleNamespace(models=SimpleNamespace(generate_content=generate_content)))
print(asyncio.run(KagentMemoryService(controller_client=MagicMock())._summarize_session_content_async("user: I like dark mode", model=llm)))
🤔 Expected Behavior

['User prefers dark mode'], with the request naming gemini-2.5-flash.

📱 Actual Behavior
WARNING kagent.adk._memory_service: Failed to summarize session content: Gemini requests require a model name.. Using original.
['user: I like dark mode']

generate_content is never called.

💻 Environment

kagent main (29aaacd), Python ADK runtime, google-adk 2.14.1, Python 3.13.

🔍 Additional Context

google-adk's own LlmEventSummarizer passes model=self._llm.model for the same reason. Passing model=model.model in the summarization request fixes it; I have a fix with a test.

🙋 Are you willing to contribute?
  • I am willing to submit a PR to fix this issue
主要语言
Go
星标
4.5k
派生
937
平均合并
1 天 10 小时
30 天内合并 PR
150

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

kagent-dev/kagent 的其他 Issue

查看 kagent-dev/kagent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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