feat(tools): Add LangExtract tool for structured information extraction#92
feat(tools): Add LangExtract tool for structured information extraction#92its-animay wants to merge 1 commit intogoogle:mainfrom
Conversation
Summary of ChangesHello @its-animay, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates Google's LangExtract library into the ADK community tools, providing a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a LangExtractTool to integrate the langextract library for structured information extraction. The implementation is well-structured, including a tool class, a configuration class, and comprehensive unit tests. The use of asyncio.to_thread for the synchronous lx.extract call is correct and important for an async application. My main feedback is a suggestion to use Python's dataclasses for the configuration class to reduce boilerplate code, which is a common practice for such data-holding classes.
Add LangExtractTool to the community tools module, enabling ADK agents to extract structured data (entities, attributes, relationships) from unstructured text using Google's LangExtract library. - New: src/google/adk_community/tools/langextract_tool.py - New: src/google/adk_community/tools/__init__.py - New: tests/unittests/tools/test_langextract_tool.py - Updated: pyproject.toml with langextract optional dependency - Updated: adk_community __init__.py to expose tools module LangExtractToolConfig uses @DataClass for concise, idiomatic config.
d1874a4 to
6c77a0c
Compare
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
ADK community lacks a native tool integration for LangExtract, Google's library for extracting structured information from unstructured text using LLMs. Users must manually wrap `lx.extract()` in custom tool classes.
Solution:
Add `LangExtractTool(BaseTool)` to the `google.adk_community.tools` module. This was originally submitted to adk-python#4549 and redirected here by the maintainers.
Changes:
Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
Checklist
Additional context