LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmith_openapi_clienttoFile
Function●Since v0.8

toFile

Helper for creating a File to pass to an SDK upload method from a variety of different data formats

Copy
toFile(
  value: ToFileInput | PromiseLike<ToFileInput>,
  name: string | null,
  options: FilePropertyBag
): Promise<File>

Parameters

NameTypeDescription
value*ToFileInput | PromiseLike<ToFileInput>

the raw content of the file. Can be an Uploadable, BlobLikePart, or AsyncIterable of BlobLikeParts

namestring | null

the name of the file. If omitted, toFile will try to determine a file name from bits if possible

optionsFilePropertyBag

additional properties

View source on GitHub