# files_reducer

> **Function** in `langchain_anthropic`

📖 [View in docs](https://reference.langchain.com/python/langchain-anthropic/middleware/anthropic_tools/files_reducer)

Custom reducer that merges file updates.

## Signature

```python
files_reducer(
    left: dict[str, FileData] | None,
    right: dict[str, FileData | None],
) -> dict[str, FileData]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `left` | `dict[str, FileData] \| None` | Yes | Existing files dict. |
| `right` | `dict[str, FileData \| None]` | Yes | New files dict to merge (`None` values delete files). |

## Returns

`dict[str, FileData]`

Merged `dict` where right overwrites left for matching keys.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/b302691ff9ad841804e93e5addbdc53b6974473b/libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py#L60)