# `LangChain.FileUploader.FileAnthropic`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.4/lib/file_uploaders/file_anthropic.ex#L1)

Uploads files to Anthropic's [Files API](https://docs.anthropic.com/en/api/files-create).

Requires the `files-api-2025-04-14` beta header, which is automatically included.

## Usage

    {:ok, uploader} = LangChain.FileUploader.FileAnthropic.new(%{api_key: "sk-ant-..."})

    {:ok, result} = LangChain.FileUploader.upload(uploader, file_bytes, %{
      filename: "document.pdf",
      mime_type: "application/pdf"
    })

    result.file_id
    #=> "file-abc123"

The returned `file_id` can be used with `ContentPart.file!/2` to reference
the uploaded file in messages:

    ContentPart.file!(result.file_id, type: :file_id)

# `t`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.4/lib/file_uploaders/file_anthropic.ex#L48)

```elixir
@type t() :: %LangChain.FileUploader.FileAnthropic{
  api_key: term(),
  api_version: term(),
  endpoint: term(),
  receive_timeout: term(),
  req_opts: term()
}
```

# `new`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.4/lib/file_uploaders/file_anthropic.ex#L57)

```elixir
@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
```

Setup an Anthropic file uploader configuration.

# `new!`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.4/lib/file_uploaders/file_anthropic.ex#L68)

```elixir
@spec new!(attrs :: map()) :: t() | no_return()
```

Setup an Anthropic file uploader configuration and return it or raise an error if invalid.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
