Uploads files to Anthropic's Files API.
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)
Summary
Functions
Setup an Anthropic file uploader configuration.
Setup an Anthropic file uploader configuration and return it or raise an error if invalid.