% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/content-document.R
\name{content_document_file}
\alias{content_document_file}
\alias{content_document_url}
\title{Encode documents for chat input}
\usage{
content_document_file(path, mime_type = NULL)

content_document_url(url, mime_type = NULL)
}
\arguments{
\item{path, url}{Path or URL to a document.}

\item{mime_type}{MIME type of the document. If not supplied, it's
inferred from the file extension; unknown extensions are assumed to be
plain text (e.g. code files).}
}
\value{
A \code{ContentDocument} object
}
\description{
These functions are used to prepare text-based documents (plain text,
Markdown, CSV, HTML, code files, and, for providers that support them,
Word/Excel files) as input to the chatbot. \code{content_document_url()} is
used to provide a URL to a document, while \code{content_document_file()} is
used for local files.

Not all providers support all document types, so check the documentation
for the provider you are using. For PDFs, use \code{\link[=content_pdf_file]{content_pdf_file()}} or
\code{\link[=content_pdf_url]{content_pdf_url()}} instead.

Both functions embed the document's contents in every request, so for a
large document, or one you'll refer to across several turns, prefer
\code{chat$file_upload()}. It uploads the file once and later turns reference
it by id.
}
