AIClassify、AIExtract、AIReply、AISentiment、AISummarize 和 AITranslate

适用于: 画布应用程序

描述

Dataverse 提供各种预配置的即用型人工智能功能,不需要任何数据收集、构建或培训。 您可以在应用程序和工作流中使用这些预构建的人工智能功能来改进功能和简化流程。 人工智能功能与画布应用程序、AI Builder 和低代码插件一起工作,因此可以轻松地将它们集成到您的解决方案中。

  • AIClassify 将文本分类到提供的类别之一。 例如,以下类别列表可用于对客户提交的问题进行分类:

    • 难题
    • 记帐
    • 操作方法
    • 许可
  • AIExtract 提取指定的实体,如注册号、电话号码或人名。

    备注

    AIExtract 功能仍在开发中,可能无法正常运行。 我们将在此笔记可以使用时将其移除。

  • AIReply 起草对您提供的消息的回复。 例如,该功能起草对客户产品评论的回复。

  • AISentiment 检测您提供的文本的情绪。 例如,此功能检测客户评论的情绪是积极、消极还是中立。

  • AISummarize 总结您提供的文本。 例如,此功能概括了电子邮件消息或文档中的文本。

  • VPNTransai 翻译其他语言的文本。 例如,此功能翻译客户电子邮件或产品评论。 不需要指定源语言,它会自动检测。

    有关源语言和目标语言支持的语言的更多信息,请参阅翻译器语言支持 - 翻译,并查看自动语言检测栏下的支持语言列表。

在下面的视频中了解有关如何使用人工智能功能的更多信息。

在画布应用程序中使用

您可以从画布应用程序调用这些函数。 但是,这比针对其他 Power Fx 主机描述的要复杂一些:

  1. 您需要添加环境数据源。
  2. AI 函数是环境命名空间中的函数。 其中本文档描述了调用 AISummarize( ... ),例如,您需要使用 Environment.AISummarize( ... )
  3. 函数的参数必须是记录中的命名列,作为唯一参数传递。 与参数名称匹配的列名称在语法部分中给出。
  4. 这些函数的返回值总是包含一列的记录。 该列的名称列在语法部分中。
  5. 这些函数是行为函数,不能在画布数据流中使用,例如作为文本控件的文本属性的输入。 使用集合函数将结果放入一个全局变量中,然后在应用程序的其他地方使用该值。

下面是一个示例:

  1. Power Apps Studio 中打开画布应用程序进行编辑。
  2. 从“数据”窗格中,选择添加数据,然后添加环境数据源。
  3. 从“插入”窗格中添加一个按钮控件。
  4. 在公式栏中,选择 OnSelect 属性并输入以下公式:
    Set( Summary, Environment.AISummarize( {Text: "2, 4, 6, 8, 10, 12, 14, 16"} ).SummarizedText )
    
  5. 从“插入”窗格中添加一个文本控件。
  6. 在公式栏中,选择文本属性并输入以下公式:
    Summary
    
  7. 文本框显示人工智能生成的摘要,类似于:
    The given text is a sequence of even numbers from 2 to 16, increasing by 2 each time.
    

备注

我们正在向画布添加其他 Power Fx 主机喜欢的相同函数签名。 新签名将增强而不是取代当前机制;使用当前机制的应用程序将继续工作,无需修改。

语法

AIClassify文本类别

  • Text - 必需。 文本句子。 要分类的文本。
  • 类别 - 必填。 文本类别表的单列。
  • 对于画布应用程序,返回值在分类列中。

AIExtract文本实体

  • Text - 必需。 文本句子。 从中提取数据的文本。
  • 实体 - 必填。 要提取的实体。 要提取的实体的名称。
  • 对于画布应用程序,返回值在 ExtractedData 列中,该表包含与所提供的实体匹配的零行或多行数据。

AIReply文本

  • Text - 必需。 文本句子。 要回复的文本。
  • 对于画布应用程序,返回值在 PreparedResponse 列中。

AISentiment文本

  • Text - 必需。 要分析情绪的文本。
  • 对于画布应用程序,返回值在 AnalyzedSentiment 列中,可以是“积极”、“中性”或“消极”。

AISummarize文本

  • Text - 必需。 要汇总的文本。
  • 对于画布应用程序,返回值在 SummarizedText 列中。

AITranslate文本目标语言

  • Text - 必需。 要翻译的文本。
  • TargetLanguage - 要翻译成的语言标记,例如法语的“fr”。 有关更多详细信息,请参阅语言功能
  • 对于画布应用程序,返回值在 TranslatedText 列中。

示例

要设置以下示例:

  1. 在树视图中,选择应用程序对象,并将以下内容添加到公式属性中:
    Subject = "Washington is a state that offers a variety of food experiences for locals and visitors alike. 
    Whether you are looking for fresh seafood, farm-to-table produce, ethnic specialties, or gourmet treats, 
    you will find something to satisfy your taste buds in Washington. Washington is famous for its seafood, 
    especially salmon, oysters, crab, and clams. The state has a long coastline and numerous rivers and lakes 
    that provide abundant and high-quality seafood.";
    
  2. 创建一个按钮控件。
  3. 创建一个文本控件并将其文本属性设置为:
    Result
    

AIClassify

  1. 在画布应用程序中,将按钮控件的 OnSelect 属性设置为:
    Set( Result, Environment.AIClassify( {Text:Subject, Categories: ["Housing", "Food"]} ).Classification )
    
    对于所有其他产品,请使用此公式:
    Set( Result, AIClassify( Subject, ["Housing", "Food"] ) )
    
  2. 按此按钮。 文本控件显示结果:
    Food
    

AIExtract

  1. 在画布应用程序中,将按钮控件的 OnSelect 属性设置为:
    Set( Result, Environment.AIExtract( {Text:Subject, Entity: "State"} ).ExtractedText )
    
    对于所有其他产品,请使用此公式:
    Set( Result, AIExtract( Subject, "State" ) )
    
  2. 按此按钮。 文本控件显示结果。

AIReply

  1. 在画布应用程序中,将按钮控件的 OnSelect 属性设置为:
    Set( Result, Environment.AIReply( {Text:Subject} ).PreparedResponse )
    
    对于所有其他产品,请使用此公式:
    Set( Result, AIReply( Subject ) )
    
  2. 按此按钮。 文本控件显示的结果类似于:
    Washington state is indeed a culinary delight, offering a diverse range of food experiences
    for both residents and tourists. From fresh seafood to farm-to-table produce, ethnic specialties
    to gourmet treats, there is something to please every palate in Washington. The state is
    particularly renowned for its seafood, with salmon, oysters, crab, and clams being local favorites.
    This is due to Washington's extensive coastline and numerous rivers and lakes, which provide an
    abundance of high-quality seafood. If you have any specific questions or need recommendations
    for dining in Washington, feel free to ask!
    

AISummarize

  1. 在画布应用程序中,将按钮控件的 OnSelect 属性设置为:
    Set( Result, Environment.AISummarize( {Text:Subject} ).SummarizedText )
    
    对于所有其他产品,请使用此公式:
    Set( Result, AISummarize( Subject ) )
    
  2. 按此按钮。 文本控件显示的结果类似于:
    Washington state is known for its diverse food experiences, catering to both locals and visitors.
    From fresh seafood to farm-to-table produce, ethnic specialties, and gourmet treats, there is
    something to please everyone's taste buds. Seafood, particularly salmon, oysters, crab, and clams,
    is a highlight in Washington. With its extensive coastline, rivers, and lakes, the state offers
    an abundance of high-quality seafood options.
    

AISentiment

  1. 在画布应用程序中,将按钮控件的 OnSelect 属性设置为:
    Set( Result, Environment.AISentiment( {Text:Subject} ).AnalyzedSentiment )
    
    对于所有其他产品,请使用此公式:
    Set( Result, AISentiment( Subject ) )
    
  2. 按此按钮。 文本控件显示结果:
    Positive
    

AITranslate

  1. 在画布应用程序中,将按钮控件的 OnSelect 属性设置为:
    Set( Result, Environment.AITranslate( {Text:Subject, Language: "fr"} ).TranslatedText )
    
    对于所有其他产品,请使用此公式:
    Set( Result, AITranslate( Subject, "fr" ) )
    
  2. 按此按钮。 文本控件显示的结果类似于:
    Washington est un État qui offre une variété d’expériences culinaires pour les habitants et les visiteurs. 
    Que vous soyez à la recherche de fruits de mer frais, de produits de la ferme à la table,
    de spécialités ethniques ou de friandises gastronomiques, vous trouverez de quoi satisfaire vos
    papilles à Washington. Washington est célèbre pour ses fruits de mer, en particulier le saumon, les huîtres,
    le crabe et les palourdes. L’État possède un long littoral et de nombreuses rivières et lacs 
    qui fournissent des fruits de mer abondants et de haute qualité.