google / google/adk-python-community

Add standardized planner content blocks helper (community module)

Offen
#162 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
182
Forks
75
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the proposed module path src/google/adk_community/planners/ and inspect google.genai.types.Part plus LangChain v1 standard content blocks. Implement the read-only conversion helpers and TypedDict types described in the issue, then add unit tests under tests/unittests/planners/. Done means reasoning, text, and tool_call blocks expose the stated type discriminators and reasoning kinds without mutating the input parts.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
ai
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.