LangChain.FileUploader.FileResult (LangChain v0.8.4)

Copy Markdown View Source

Represents the result of a file upload to an LLM provider.

Different providers return different types of file references:

  • OpenAI and Anthropic return a file_id string
  • Google Gemini returns a file_uri URL

At least one of file_id or file_uri will always be present.

The raw field contains the full provider response for accessing provider-specific fields not covered by the struct.

Summary

Functions

Build a new FileResult and return an :ok/:error tuple with the result.

Build a new FileResult and return it or raise an error if invalid.

Types

t()

@type t() :: %LangChain.FileUploader.FileResult{
  file_id: term(),
  file_uri: term(),
  filename: term(),
  mime_type: term(),
  provider: term(),
  raw: term(),
  size_bytes: term()
}

Functions

new(attrs)

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

Build a new FileResult and return an :ok/:error tuple with the result.

new!(attrs)

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

Build a new FileResult and return it or raise an error if invalid.