Skip to content

AI Gateway

在 Flow 2 中,AI Gateway 为应用提供 AI 能力支撑,当前规划中的功能有以下。

列头识别

应用向接口推送一个包含列头的JSON,如下结构。

json
["id", "english", "chinese", "french", "german", "spanish", "role"]

AI Gateway 会返回一个包含列头推测识别结果的JSON,如下结构。

json
[
 {
    "column": "id",
    "inference": ["key"]
 },
 {
    "column": "english",
    "inference": ["source", "en-US"]
 },
 {
    "column": "chinese",
    "inference": ["target", "zh-CN"]
 },
 {
    "column": "french",
    "inference": ["target", "fr-FR"]
 },
 {
    "column": "role",
    "inference": ["reference"]
 }
]

inference 是AI推测的列头,使用一个数组返回代表多级结构,例如:

json
"inference": ["target", "fr-FR"]

表示是这列是一个目标语,并且是法语。

Tag Rules 自动探测生成

应用向接口推送一段文本,如下:

<html>
    <body>
        <h1>Hello, World!</h1>
        <p>This is a {{test}}.</p>
    </body>
</html>

AI Gateway 会推测那些部分可能是一类标签,并返回标签和对应的正则。

json
[
    {
        "recognized": "html tag",
        "regex": "<.*>"
    },
    {
        "recognized": "double curly braces",
        "regex": "{{.*}}"
    }
]