% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/help_functions.R
\name{make_value_row}
\alias{make_value_row}
\title{Parse AI Response into Formatted Row String}
\usage{
make_value_row(ai_response)
}
\arguments{
\item{ai_response}{Character. A single response string from an AI model, typically
containing semicolon-separated values.}
}
\value{
Character. A formatted row string in SQL format like "('val1','val2',...)",
or NA if validation fails.
}
\description{
This function takes a single AI response string and formats it into a standardized
SQL-style row format for consistent data processing. It handles text sanitization
and ensures the response has exactly N elements (N set by set_parameters()).
}
\details{
The function performs several formatting operations:
\itemize{
\item Converts input to character format
\item Replaces quotes with backticks to avoid SQL conflicts
\item Splits on semicolons to extract individual values
\item Trims whitespace from each value
\item Pads with NA values if fewer than expected elements
\item Validates that we have the expected number of elements
\item Converts to lowercase and formats as SQL-style row
}

The function expects exactly N values as set by set_parameters().
}
\examples{
\dontrun{
# AI response with semicolon-separated values (assuming set_parameters(n_variables = 6))
ai_response <- "123;en;Hello world;positive;high;topic1"
formatted_row <- make_value_row(ai_response)
# Returns: "('123','en','hello world','positive','high','topic1')"
}

}
\seealso{
\code{\link[=main_func]{main_func()}}
}
