google / google/adk-python-community

feat: Add LangExtract tool for structured information extraction

Đang mở
#91 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
182
Fork
75
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 🔴 Required Information

### Is your feature request related to a specific problem?

ADK community lacks a native integration for [LangExtract](https://github.com/google/langextract) — Google's own library for extracting structured information from unstructured text using LLMs with precise source grounding. Users who want to use LangExtract within ADK agents currently have to manually wrap \`lx.extract()\` in a custom tool class with significant boilerplate.

### Describe the Solution You'd Like

Add a \`LangExtractTool\` to \`google.adk_community.tools\` that:

- Extends \`BaseTool\` with a clean function declaration exposing \`text\` and \`prompt_description\` as LLM-visible parameters
- Pre-configures extraction settings (examples, model_id, extraction_passes, etc.) at construction time
- Runs \`lx.extract()\` via \`asyncio.to_thread()\` to avoid blocking the event loop
- Includes a companion \`LangExtractToolConfig\` for easy programmatic configuration

**Usage:**
```python
from google.adk_community.tools import LangExtractTool
import langextract as lx

tool = LangExtractTool(
name='extract_entities',
description='Extract named entities from text.',
examples=[
lx.data.ExampleData(
text='John is a software engineer at Google.',
extractions=[
lx.data.Extraction(
extraction_class='person',
extraction_text='John',
attributes={'role': 'software engineer', 'company': 'Google'},
)
],
)
],
)

agent = Agent(model='gemini-2.5-flash', name='extraction_agent', tools=[tool])
```

### Impact on your work

Enables ADK agents to perform structured extraction (entities, attributes, relationships) from documents out of the box — a common use case for enterprise AI workflows. Since LangExtract is a Google library, having native ADK community support is a natural fit.

### Willingness to contribute

Yes — I have an implementation ready to submit as a PR.

---

## 🟡 Recommended Information

### Additional Context

- LangExtract repo: https://github.com/google/langextract
- Originally submitted to [adk-python#4549](https://github.com/google/adk-python/pull/4549) and redirected here by maintainers

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu trong google.adk_community.tools và xem xét các tích hợp BaseTool hiện có trước khi kiểm tra cấu trúc được yêu cầu của LangExtractTool và LangExtractToolConfig. Sử dụng repository LangExtract và API lx.extract() được mô tả trong issue làm tài liệu tham chiếu. Được xem là hoàn tất khi các agent có thể cấu hình công cụ, cung cấp text và prompt_description, đồng thời thực hiện việc trích xuất mà không chặn event loop.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
ai, tooling
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.