lihaosky commented on code in PR #800: URL: https://github.com/apache/flink-web/pull/800#discussion_r2214120858
########## docs/content/posts/2025-07-31-release-2.1.0.md: ########## @@ -0,0 +1,437 @@ +--- +authors: + - reswqa: + name: "Ron Liu" + twitter: "Ron999" + +date: "2025-07-31T08:00:00Z" +subtitle: "" +title: Announcing the Release of Apache Flink 2.1 +aliases: + - /news/2025/07/31/release-2.1.0.html +--- + +The Apache Flink PMC is pleased to announce the release of Apache Flink 2.1.0. As usual, we are +looking at a packed release with a wide variety of improvements and new features. Overall, 116 +people contributed to this release completing 15 FLIPs and 200+ issues. Thank you! + +Let's dive into the highlights. + +# Flink SQL Improvements + +## Model DDLs using Table API +Since Flink 2.0, we have introduced dedicated syntax for AI models, enabling users to define models +as easily as creating catalog objects and invoke them like standard functions or table functions in SQL statements. +In Flink 2.1, we have also added Model DDLs Table API support, enabling users to define and manage AI models programmatically +via the Table API in both Java and Python. This provides a flexible, code-driven alternative to SQL for model management and +integration within Flink applications. + +Example: Defining a Model via Table API (Java) +```java +table_env.create_model("MyModel", ModelDescriptor.for_provider("OPENAI") + .input_schema(Schema.new_builder() + .column("f0", DataTypes.STRING()) + .build()) + .output_schema(Schema.new_builder() + .column("label", DataTypes.STRING()) + .build()) + .option("task", "classification") + .option("type", "remote") + .option("provider", "openai") + .option("openai.endpoint", "remote") + .option("openai.api_key", "abcdefg") + .build(), + true); +``` + +**More Information** +* [FLINK-37548](https://issues.apache.org/jira/browse/FLINK-37548) +* [FLIP-507](https://cwiki.apache.org/confluence/display/FLINK/FLIP-507%3A+Add+Model+DDL+methods+in+TABLE+API) + +## Realtime AI Function + +Based on the AI model DDL, In Flink 2.1, we expanded the `ML_PREDICT` table-valued function (TVF) to perform realtime model inference in SQL queries, applying machine learning models to data streams seamlessly. +The implementation supports both Flink builtin model providers (OpenAI) and interfaces for users to define custom model providers, accelerating Flink's evolution from a real-time +data processing engine to a unified realtime AI platform. Looking ahead, we plan to introduce more AI functions such as `ML_EVALUATE`, `VECTOR_SEARCH` to unlock end-to-end experience +for real-time data processing, model training, and inference. + +Take the following SQL statements as an example: +```sql +-- Declare a AI model +CREATE MODEL `my_model` +INPUT (text STRING) +OUTPUT (response STRING) +WITH( + 'provider' = 'openai', + 'endpoint' = 'https://api.openai.com/v1/llm/v1/chat', + 'api-key' = 'abcdefg', Review Comment: ```suggestion 'api-key' = 'abcdefg', 'system-prompt' = 'translate to Chinese', ``` Sorry I missed this -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org