yuxiqian commented on code in PR #3753:
URL: https://github.com/apache/flink-cdc/pull/3753#discussion_r1856176376


##########
docs/content/docs/core-concept/transform.md:
##########
@@ -359,21 +359,28 @@ transform:
 ## Embedding AI Model
 
 Embedding AI Model can be used in transform rules.
+To use Embedding AI Model, you need to download the jar of build-in model, and 
then add `--jar {$BUILD_IN_MODEL_PATH}` to your flink-cdc.sh command.

Review Comment:
   built-in



##########
docs/content/docs/core-concept/transform.md:
##########
@@ -392,18 +400,19 @@ The following built-in models are provided:
 
 | parameter           | type   | optional/required | meaning                   
                    |
 
|---------------------|--------|-------------------|-----------------------------------------------|
-| OpenAI.model-name   | STRING | required          | Name of model to be 
called.                   |
-| OpenAI.host         | STRING | required          | Host of the Model server 
to be connected.     |
-| OpenAI.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |
-| OpenAI.chat.promote | STRING | optional          | Promote for chatting with 
OpenAI.             |
+| openai.model        | STRING | required          | Name of model to be 
called.                   |
+| openai.host         | STRING | required          | Host of the Model server 
to be connected.     |
+| openai.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |
+| openai.chat.promote | STRING | optional          | Promote for chatting with 
OpenAI.             |
 
 #### OpenAIEmbeddingModel
 
-| parameter           | type   | optional/required | meaning                   
                    |
-|---------------------|--------|-------------------|-----------------------------------------------|
-| OpenAI.model-name   | STRING | required          | Name of model to be 
called.                   |
-| OpenAI.host         | STRING | required          | Host of the Model server 
to be connected.     |
-| OpenAI.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |
+| parameter     | type   | optional/required | meaning                         
              |
+|---------------|--------|-------------------|-----------------------------------------------|
+| openai.model  | STRING | required          | Name of model to be called.     
              |
+| openai.host   | STRING | required          | Host of the Model server to be 
connected.     |
+| openai.apiKey | STRING | required          | Api Key for verification of the 
Model server. |

Review Comment:
   Ditto



##########
flink-cdc-cli/src/test/java/org/apache/flink/cdc/cli/parser/YamlPipelineDefinitionParserTest.java:
##########
@@ -352,10 +352,11 @@ private void testSchemaEvolutionTypesParsing(
                                     "OpenAIEmbeddingModel",
                                     new LinkedHashMap<>(
                                             ImmutableMap.<String, 
String>builder()
-                                                    .put("name", 
"GET_EMBEDDING")
-                                                    .put("model", 
"OpenAIEmbeddingModel")
-                                                    .put("host", 
"https://xxxx";)
-                                                    .put("key", "abcd1234")
+                                                    .put("model-name", 
"GET_EMBEDDING")
+                                                    .put("class-name", 
"OpenAIEmbeddingModel")
+                                                    .put("openai.model", 
"text-embedding-3-small")
+                                                    .put("openai.host", 
"https://xxxx";)
+                                                    .put("openai.key", 
"abcd1234")

Review Comment:
   Should this be `openai.key` or `openai.apikey`?



##########
docs/content/docs/core-concept/transform.md:
##########
@@ -392,18 +400,19 @@ The following built-in models are provided:
 
 | parameter           | type   | optional/required | meaning                   
                    |
 
|---------------------|--------|-------------------|-----------------------------------------------|
-| OpenAI.model-name   | STRING | required          | Name of model to be 
called.                   |
-| OpenAI.host         | STRING | required          | Host of the Model server 
to be connected.     |
-| OpenAI.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |
-| OpenAI.chat.promote | STRING | optional          | Promote for chatting with 
OpenAI.             |
+| openai.model        | STRING | required          | Name of model to be 
called.                   |
+| openai.host         | STRING | required          | Host of the Model server 
to be connected.     |
+| openai.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |

Review Comment:
   This has been changed to `openai.apikey` in code



##########
docs/content/docs/core-concept/transform.md:
##########
@@ -392,18 +400,19 @@ The following built-in models are provided:
 
 | parameter           | type   | optional/required | meaning                   
                    |
 
|---------------------|--------|-------------------|-----------------------------------------------|
-| OpenAI.model-name   | STRING | required          | Name of model to be 
called.                   |
-| OpenAI.host         | STRING | required          | Host of the Model server 
to be connected.     |
-| OpenAI.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |
-| OpenAI.chat.promote | STRING | optional          | Promote for chatting with 
OpenAI.             |
+| openai.model        | STRING | required          | Name of model to be 
called.                   |
+| openai.host         | STRING | required          | Host of the Model server 
to be connected.     |
+| openai.apiKey       | STRING | required          | Api Key for verification 
of the Model server. |
+| openai.chat.promote | STRING | optional          | Promote for chatting with 
OpenAI.             |

Review Comment:
   `openapi.chat.prompt`



##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/operators/transform/UserDefinedFunctionDescriptor.java:
##########
@@ -46,30 +43,29 @@ public class UserDefinedFunctionDescriptor implements 
Serializable {
 
     private final Map<String, String> parameters;
 
-    private static final ObjectMapper objectMapper = new ObjectMapper();
-
-    /** Package of {@link org.apache.flink.cdc.runtime.model.BuiltInModel}. */
-    public static final String PREFIX_CLASSPATH_MODEL = 
"org.apache.flink.cdc.runtime.model.";
+    private final boolean isModel;
 
-    private static final String MODEL_NAME_KEY = "name";
+    /** Package of embedding model. */
+    public static final String PREFIX_CLASSPATH_BUILD_IN_MODEL =

Review Comment:
   BUILT_IN_MODEL



##########
flink-cdc-pipeline-model/pom.xml:
##########
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <artifactId>flink-cdc-parent</artifactId>
+        <groupId>org.apache.flink</groupId>
+        <version>${revision}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>flink-cdc-pipeline-model</artifactId>
+    <properties>
+        <langchain4j.version>0.23.0</langchain4j.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-cdc-common</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-test-utils-junit</artifactId>
+            <version>${flink.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j</artifactId>
+            <version>${langchain4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j-open-ai</artifactId>
+            <version>${langchain4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.theokanning.openai-gpt3-java</groupId>
+            <artifactId>service</artifactId>
+            <version>0.12.0</version>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>3.2.4</version>
+                <executions>
+                    <execution>
+                        <id>shade-flink</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <shadeTestJar>false</shadeTestJar>
+                            <artifactSet>
+                                <includes>
+                                    <include>io.debezium:debezium-api</include>
+                                    
<include>io.debezium:debezium-embedded</include>
+                                    
<include>io.debezium:debezium-core</include>
+                                    
<include>io.debezium:debezium-ddl-parser</include>
+                                    
<include>io.debezium:debezium-connector-mysql</include>
+                                    
<include>org.apache.flink:flink-connector-debezium</include>
+                                    
<include>org.apache.flink:flink-connector-mysql-cdc</include>
+                                    <include>org.antlr:antlr4-runtime</include>
+                                    <include>org.apache.kafka:*</include>
+                                    
<include>com.zendesk:mysql-binlog-connector-java</include>
+                                    <include>com.fasterxml.*:*</include>
+                                    <include>com.google.guava:*</include>
+                                    
<include>com.esri.geometry:esri-geometry-api</include>
+                                    <include>com.zaxxer:HikariCP</include>
+                                    <!--  Include fixed version 
30.1.1-jre-14.0 of flink shaded guava  -->
+                                    
<include>org.apache.flink:flink-shaded-guava</include>

Review Comment:
   Are these shades necessary?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to