From f34bacffc3da272636c053897788ac04e2381f6c Mon Sep 17 00:00:00 2001 From: Mikko Korpela Date: Mon, 25 May 2026 12:46:11 +0300 Subject: [PATCH 1/2] docs: add Adeu redlining and Word tool integration --- src/oss/python/integrations/tools/adeu.mdx | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 src/oss/python/integrations/tools/adeu.mdx diff --git a/src/oss/python/integrations/tools/adeu.mdx b/src/oss/python/integrations/tools/adeu.mdx new file mode 100644 index 0000000000..7ab4e9bd45 --- /dev/null +++ b/src/oss/python/integrations/tools/adeu.mdx @@ -0,0 +1,131 @@ +--- +title: "Adeu Redlining & Word Tools" +description: "Integrate with Adeu tools using LangChain Python." +--- + +This guide provides a quick overview for getting started with the Adeu [tools](/oss/langchain/tools) in LangChain. For a detailed listing of all Adeu features, parameters, and configurations, head to the [Adeu Developer Portal](https://github.com/dealfluence/adeu). + +## Overview + +Adeu acts as a Virtual DOM for Microsoft Word (.docx) documents, translating complex OpenXML structures into token-efficient Markdown representations with inline CriticMarkup. This allows LLM agents to safely redline documents without damaging layouts, custom XML namespaces, or existing metadata. + +### Details + +| Class | Package | Serializable | JS Support | Downloads | Version | +| :--- | :--- | :---: | :---: | :---: | :---: | +| [AdeuToolkit](https://reference.langchain.com/python/langchain-core/tools/base/BaseTool) | [langchain-adeu](https://pypi.org/project/langchain-adeu/) | ❌ | ❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-adeu?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-adeu?style=flat-square&label=%20) | + +### Features + +* **Lossless Translation**: Converts `.docx` documents into clean Markdown on read, and back into native OpenXML on write. +* **Granular Redlining**: Commits edits as standard tracked changes and comment bubbles using native Microsoft Word nodes (`w:ins`/`w:del`). +* **Metadata Sanitization**: Strips dangerous hidden tracking fields, rsids, DMS metadata, and template paths before distributing documents. +* **Fuzzy Anchor Protection**: Automatically protects document boundaries by catching and rejecting ambiguous search-and-replace matches. + +--- + +## Setup + +To use the Adeu LangChain tools, you will need to install the `langchain-adeu` integration package. + +### Installation + +The Adeu integration package resides in `langchain-adeu`: + + + ```python pip + pip install -U langchain-adeu + ``` + ```python uv + uv add langchain-adeu + ``` + + +--- + +## Instantiation + +Instantiate the `AdeuToolkit` to retrieve all five document processing tools: + +```python Initialize toolkit +from langchain_adeu import AdeuToolkit + +toolkit = AdeuToolkit() +tools = toolkit.get_tools() +``` + +--- + +## Invocation + +### Directly + +You can invoke individual tools directly using a dictionary of standard keyword arguments: + +```python Call tool directly +read_tool = [t for t in tools if t.name == "adeu_read_docx"][0] + +# Read document body with active tracked changes visible +markdown_content = read_tool.invoke({ + "file_path": "path/to/agreement.docx", + "clean_view": False, + "mode": "full", + "page": 1 +}) +``` + +### As a ToolCall + +The tools can process model-generated `ToolCall` payloads, returning a standard `ToolMessage` carrying both free-form output and detailed programmatic artifacts: + +```python ToolCall invocation +apply_tool = [t for t in tools if t.name == "adeu_apply_changes"][0] + +model_generated_tool_call = { + "args": { + "file_path": "path/to/agreement.docx", + "author_name": "Legal Agent", + "changes": [ + { + "type": "modify", + "target_text": "Governing Law shall be New York.", + "new_text": "Governing Law shall be Delaware." + } + ] + }, + "id": "1", + "name": apply_tool.name, + "type": "tool_call", +} + +tool_message = apply_tool.invoke(model_generated_tool_call) +``` + +### Within an Agent + +The tools are ready for integration with tool-calling chat model agents inside LangChain: + +```python Agent with tool +from langchain.agents import create_agent +from langchain_openai import ChatOpenAI + +# Initialize a tool-calling LLM +model = ChatOpenAI(model="anthropic:claude-sonnet-4-6") + +# Build the agent +agent = create_agent( + model=model, + tools=tools, +) + +# Execute agentic workflow +response = agent.invoke( + {"messages": [{"role": "user", "content": "Analyze agreement.docx and standardize jurisdiction to Delaware."}]} +) +``` + +--- + +## API Reference + +For detailed documentation of all classes, schemas, and configurations, refer to the [langchain-adeu API reference](https://github.com/dealfluence/adeu/tree/main/langchain). From 08a922a654904ea5f9b92b4e13622c2ed4636c40 Mon Sep 17 00:00:00 2001 From: Mikko Korpela Date: Mon, 25 May 2026 13:04:34 +0300 Subject: [PATCH 2/2] docs: add langchain-adeu integration tools and provider --- packages.yml | 6 +++ .../python/integrations/providers/adeu.mdx | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/oss/python/integrations/providers/adeu.mdx diff --git a/packages.yml b/packages.yml index 3c3ba4e4e7..cbc9e60540 100644 --- a/packages.yml +++ b/packages.yml @@ -396,6 +396,12 @@ packages: downloads_updated_at: "2026-05-18T00:23:32.797657+00:00" # external repos (not organized) +- name: langchain-adeu + repo: dealfluence/adeu + path: langchain + js: "n/a" + downloads: 0 + downloads_updated_at: "2026-05-25T11:00:00+00:00" - name: langchain-aimlapi repo: D1m7asis/langchain-aimlapi path: libs/aimlapi diff --git a/src/oss/python/integrations/providers/adeu.mdx b/src/oss/python/integrations/providers/adeu.mdx new file mode 100644 index 0000000000..dc53528d0d --- /dev/null +++ b/src/oss/python/integrations/providers/adeu.mdx @@ -0,0 +1,39 @@ +--- +title: Adeu +description: "Review and redline Microsoft Word (.docx) files using LangChain." +--- + +# Adeu + +>[Adeu](https://adeu.ai) acts as a Virtual DOM for Microsoft Word (.docx) documents, translating complex OpenXML structures into token-efficient Markdown representations with inline CriticMarkup. + +This allows AI agents to safely read, edit, and sanitize Microsoft Word documents while preserving native layouts, custom XML namespaces, and styling. + +## Installation + +```bash +pip install langchain-adeu +``` + +## Tools + +### AdeuToolkit + +The `AdeuToolkit` contains all the essential tools for document processing: + +- **adeu_read_docx**: Read a `.docx` file into token-efficient Markdown with active track-changes and comments displayed as inline CriticMarkup. +- **adeu_apply_changes**: Apply a transactional batch of tracked edits (modifications, replies, and table adjustments) to a document. +- **adeu_diff_docx**: Generate a custom word-level diff (`@@ Word Patch @@` format) between two versions of a document. +- **adeu_accept_all_changes**: Finalize all pending tracked changes and commit them to clean, plain text. +- **adeu_sanitize_docx**: Strip dangerous tracking metadata, unresolved annotations, and author properties for safe external distribution. + +To initialize the toolkit and fetch the tools: + +```python +from langchain_adeu import AdeuToolkit + +toolkit = AdeuToolkit() +tools = toolkit.get_tools() +``` + +Refer to the [Adeu tool guide](/oss/integrations/tools/adeu) for detailed usage examples and API configurations.