google / google/adk-python-community

Add standardized planner content blocks helper (community module)

オープン
#162 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
182
フォーク
75
PR マージ指標
30日以内にマージされた PR はありません

説明

### What

Add a small, read-only helper that converts planner-produced `google.genai.types.Part` lists into provider-agnostic, typed "content blocks" modelled after [LangChain v1's standard content blocks](https://docs.langchain.com/oss/python/langchain/messages#standard-content-blocks).

ADK planners (`PlanReActPlanner`, `BuiltInPlanner`) emit reasoning as parts with `thought=True`, and `PlanReActPlanner` additionally annotates text with inline `/*PLANNING*/`-style tags that consumers must parse by hand. This helper turns that into a list of typed blocks — `reasoning` (with a `reasoning_kind` of planning/replanning/reasoning/action), `text`, and `tool_call` — so consumers branch on a `type` discriminator instead of re-parsing raw text.

It is **additive and read-only**: it never mutates the parts and doesn't change how planners build instructions or post-process responses. Existing consumers of the `Part` output are unaffected.

### Background

Originally proposed in core ADK (google/adk-python#6185). That PR was closed and the maintainer suggested the feature belongs in `adk-python-community` as a community module. This issue tracks landing it here.

### Proposed location

New module `src/google/adk_community/planners/` exporting `parts_to_content_blocks` / `part_to_content_block` (plus the `ReasoningContentBlock` / `TextContentBlock` / `ToolCallContentBlock` TypedDicts, `ReasoningKind`, and `ContentBlock`). Self-contained — depends only on `google-genai` (already a transitive dependency via `google-adk`), so no new optional-dependency group is needed. Unit tests under `tests/unittests/planners/`.

A PR implementing this is ready to open.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

提案されているモジュールパス src/google/adk_community/planners/ から始め、google.genai.types.Part と LangChain v1 の標準 content blocks を調査します。issue に記載されている読み取り専用の変換ヘルパーと TypedDict 型を実装し、その後 tests/unittests/planners/ 配下に unit test を追加します。reasoning、text、tool_call ブロックが指定された型 discriminator と reasoning の種類を公開し、入力 parts を変更しないことが完了の条件です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
ai
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。