- Categories:
String & binary functions (AI Functions)
AI_ COMPLETE (Single file)¶
Generates a response (completion) for a text prompt and a single file using a supported model. Depending on the model, the file can be an image, a document, an audio file, or a video file. This overload accepts exactly one file per call. To pass multiple files, or to combine files of different types, use AI_COMPLETE (Prompt object).
For limits by model and input type, see Model limitations and document limits.
Syntax¶
The function has three required arguments and one optional argument. The function can be used with either positional or named argument syntax.
Using AI_COMPLETE with a single file input:
Arguments¶
modelA string specifying the model to be used. The models you can use depend on the type of file.
For image files, you can use one of the following models:
claude-haiku-4-5claude-haiku-5-5claude-opus-4-5claude-opus-4-6claude-opus-4-7claude-opus-4-8claude-opus-5claude-opus-5-5claude-sonnet-4-5claude-sonnet-4-6claude-sonnet-5claude-sonnet-5-5gemini-3.1-progemini-3.7-flashgemini-3.8-flashgemini-4-argongemini-4-carbongemini-4-hydrogenopenai-gpt-5openai-gpt-5-miniopenai-gpt-5-nanoopenai-gpt-5.1openai-gpt-5.2openai-gpt-5.4
For document files, you can use one of the following models:
claude-haiku-4-5claude-haiku-5-5claude-opus-4-5claude-opus-4-6claude-opus-4-7claude-opus-4-8claude-opus-5claude-opus-5-5claude-sonnet-4-5claude-sonnet-4-6claude-sonnet-5claude-sonnet-5-5gemini-3.1-progemini-3.7-flashgemini-3.8-flashgemini-4-argongemini-4-carbongemini-4-hydrogen
For audio and video files, you can use one of the following models:
gemini-3.1-progemini-3.7-flashgemini-3.8-flashgemini-4-argongemini-4-carbongemini-4-hydrogen
Supported models might have different costs.
predicateA string prompt.
fileA FILE object representing a single image, document, audio, or video file. The file type must be supported by the model that you specify; see the model lists for the model argument.
model_parametersAn object containing zero or more of the following options that affect the model’s hyperparameters. See LLM Settings.
-
temperature: A value from 0 to 1 (inclusive) that controls the randomness of the output of the language model. A higher temperature (for example, 0.7) results in more diverse and random output, while a lower temperature (such as 0.2) makes the output more deterministic and focused.Default: 0
-
top_p: A value from 0 to 1 (inclusive) that controls the randomness and diversity of the language model, generally used as an alternative totemperature. The difference is thattop_prestricts the set of possible tokens that the model outputs, whiletemperatureinfluences which tokens are chosen at each step.Default: 0
-
max_tokens: Sets the maximum number of output tokens in the response. Small values can result in truncated responses.Default: 4096
-
guardrails: Filters potentially unsafe and harmful responses from a language model using Cortex Guard. EitherTRUEorFALSE. The default value isFALSE.
-
Returns¶
Returns the string response from the language model.
Examples¶
The following examples demonstrate the basic capabilities of the AI_COMPLETE function with images. For audio and video examples, see Cortex AI Functions: Multimodal.
Visual question answering¶
A chart of inflation rates is used to answer a question about the data.

Comparison between inflation rates in 2023 and in 2024 (Statista)
Response:
Entity extraction from an image¶
This example extracts the entities (objects) from an image and returns the results in JSON format.

Response:
Usage notes¶
The following notes apply to Snowflake-hosted Cortex models. For models deployed on Snowpark Container Services, see Usage notes for processing images.
- This overload accepts exactly one file per call. To process multiple files in one call, use AI_COMPLETE (Prompt object).
- The supported file types depend on the model. See the model lists for the model argument under Arguments.
- The stage containing the file must have server-side encryption enabled. Client-side encrypted stages are not supported.
- The function does not support custom network policies.
- Stage names are case-insensitive; paths are case-sensitive.
Images¶
-
Supported image formats:
.jpg.jpeg.png.gif.webppixtralandllama4models also support.bmp.
-
The maximum image size is 10 MB for most models, and 3.75 MB for
claudemodels.claudemodels do not support images with resolutions above 8000x8000.
Documents¶
- All models listed for document files support these formats:
.txt,.md, and.pdf. Claude models also support.doc,.docx,.xls,.xlsx,.csv, and.xhtml. - Claude models have a maximum document size of 22 MB. Gemini models have a maximum document size of 37.5 MB.
- For context windows and page limits, see Supported models and limitations in AI_COMPLETE with documents.
Audio and video¶
- Only the Gemini models listed for audio files accept audio. Only the Gemini models listed for video files accept video.
- Supported audio formats:
.wav,.mp3,.aiff,.aac,.ogg,.flac,.m4a,.mp4,.pcm, and.webm. - Supported video formats:
.mp4,.mpeg,.mov,.avi,.flv,.mpg,.webm,.wmv, and.3gpp. - The maximum file size is 100 MB. For context windows, see Model limitations.
Note
AI_COMPLETE is the updated version of COMPLETE. For the latest functionality, use AI_COMPLETE.
Legal notices¶
Refer to Snowflake AI and ML for legal notices.