The culprit is that some of your string elements are empty (check index horror_movies.overview[6]
, for example).
This should do the trick:
import Downloads
using CSV, DataFrames, OpenAI
horror_movies = CSV.read(Downloads.download("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-11-01/horror_movies.csv"), DataFrame);
# 298 reviews after removing empties
input = filter(!isempty, horror_movies.overview[1:300])
r = create_embeddings(
ENV["OPENAI_API_KEY"],
input
)