> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# ai_filter

> 根据自然语言条件判断文本是否符合要求。

根据自然语言条件判断文本是否符合要求。

## 语法

```sql theme={null}
ai_filter(input, condition[, provider[, model]])
```

## 参数

* `input`：VARCHAR 表达式，要判断的文本。
* `condition`：VARCHAR 表达式，用自然语言描述判断条件。

`provider`、`model` 的类型及默认行为见 [公共调用规则](/documents/cn/4.2/sql-reference/sql-functions/ai-functions/ai_functions.md#公共调用规则)。

## 返回值

返回可空的 BOOLEAN。模型响应须能归一化为 `true` 或 `false`，其他响应按行级错误处理。

## 示例

```sql theme={null}
SELECT ai_filter('The package arrived broken.', 'The customer reports damaged goods.');

SELECT ai_filter(
    input => 'The package arrived broken.',
    condition => 'The customer reports damaged goods.',
    provider => 'support_chat'
);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.