Confluent

Flink SQL on Confluent Cloud Invokes ML Model & AI Inference

Jul 29, 2024Diptiman Raichaudhuri
Flink SQL on Confluent Cloud Invokes ML Model & AI Inference
SummaryAI, from the source post

This post details the integration of AI model inference into Flink SQL on Confluent Cloud, specifically demonstrating how to invoke an OpenAI GPT-4o model for sentiment classification of product reviews. It outlines the steps involved: creating a Kafka topic, producing Avro-serialized review data, defining a Flink SQL remote model resource pointing to the OpenAI API with a specific system prompt and task ('classification'), and then using the `ML_PREDICT` function within a Flink SQL `INSERT INTO` statement to populate a downstream `product_ratings` table with sentiment ratings. The post provides code excerpts for the Python producer and Flink SQL statements, and discusses the benefits of real-time ML enrichment for streaming data.

More from the Flink AI Model Inference trail