llm_complete function generates text completions using specified models and prompts for dynamic data generation.
Modalities
Text
Pass tabular columns incontext_columns (default type: 'tabular').
Image
Use a vision-capable model and settype: 'image' (URL, path, or base64). Optional OpenAI detail: 'low' or 'high'.
Voice
Pass audio withtype: 'audio' and a required transcription_model (OpenAI or Azure Whisper, e.g. whisper-1). Anthropic and Ollama do not support audio.
1. Simple Usage (without data)
1.1 Inline Prompt
gpt-4 model. The prompt
asks the model to explain the purpose of Flock. The function returns a completion for each row based on the provided
prompt.
1.2 Named Prompt
description-generation is used with the summarizer model. The
function generates product descriptions using data from the product_name column for each row in the sample data.
2. Actual Usage (with data)
summarize-content with version
2 and the reduce-model. It processes the product_name column and generates a summarized description. The query
then filters out rows where the generated description is shorter than 50 characters.
3. Input Parameters
Thellm_complete function accepts three structured inputs: model configuration, prompt configuration, and input data
columns.
3.1 Model Configuration
- Parameter:
model_nameandsecret_name
3.1.1 Model Selection
- Description: Specifies the model used for text generation.
- Example:
3.1.2 Model Selection with Secret
- Description: Specifies the model along with the secret name to be used for authentication when accessing the model.
- Example:
3.2 Prompt Configuration
-
Parameter:
promptorprompt_namewithcontext_columns3.2.1 Inline Prompt
Directly provides the prompt with context columns.- Example:
3.2.2 Named Prompt
References a pre-configured prompt with context columns.- Example:
3.2.3 Named Prompt with Version
References a specific version of a prompt with context columns.- Example:
- Example:
3.3 Context Columns Configuration
- Parameter:
context_columnsarray - Description: Specifies the columns from the table to be passed to the model as input. Each column can have three
properties:
data: The SQL column data (required)name: Custom name for the column to be referenced in the prompt (optional)type: Data type —"tabular"(default),"image", or"audio"(audio requirestranscription_model)
- Example:
4. Output
The function generates a completion for each row based on the provided prompt and input data.- Column Type: JSON
- Behavior: Maps over each row and generates a response per tuple. By default the JSON holds free-form model text. Pass a JSON schema in
model_parametersto constrain the response shape (OpenAIresponse_format, Ollamaformat, Anthropicoutput_format/ tool-use — see Anthropic and Model parameters). UseLOAD JSONand dot notation to extract fields.

