forked from apache/seatunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][Transforms-V2] LLM transforms Support custom field name (ap…
- Loading branch information
Showing
6 changed files
with
124 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...-transforms-v2-e2e-part-1/src/test/resources/llm_openai_transform_custom_output_name.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# 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. | ||
# | ||
###### | ||
###### This config file is a demonstration of streaming processing in seatunnel config | ||
###### | ||
|
||
env { | ||
job.mode = "BATCH" | ||
} | ||
|
||
source { | ||
FakeSource { | ||
row.num = 5 | ||
schema = { | ||
fields { | ||
id = "int" | ||
name = "string" | ||
} | ||
} | ||
rows = [ | ||
{fields = [1, "Jia Fan"], kind = INSERT} | ||
{fields = [2, "Hailin Wang"], kind = INSERT} | ||
{fields = [3, "Tomas"], kind = INSERT} | ||
{fields = [4, "Eric"], kind = INSERT} | ||
{fields = [5, "Guangdong Liu"], kind = INSERT} | ||
] | ||
result_table_name = "fake" | ||
} | ||
} | ||
|
||
transform { | ||
LLM { | ||
source_table_name = "fake" | ||
model_provider = OPENAI | ||
model = gpt-4o-mini | ||
api_key = sk-xxx | ||
output_column_name = "nationality" | ||
prompt = "Determine whether someone is Chinese or American by their name" | ||
openai.api_path = "http://mockserver:1080/v1/chat/completions" | ||
result_table_name = "llm_output" | ||
} | ||
} | ||
|
||
sink { | ||
Assert { | ||
source_table_name = "llm_output" | ||
rules = | ||
{ | ||
field_rules = [ | ||
{ | ||
field_name = "nationality" | ||
field_type = string | ||
field_value = [ | ||
{ | ||
rule_type = NOT_NULL | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters