使用 AI Builder 的 Grounded Prompts 查询 Dataverse

发布: (2026年2月9日 GMT+8 15:03)
7 分钟阅读
原文: Dev.to

Source: Dev.to

查询 Dataverse 使用 AI Builder 的基础提示封面图

Bala Madhusoodhanan


Intro

随着 Power Platform 的最新更新,AI Builder 提示现在可以 grounded——直接链接到您的 Dataverse 表。这改变了您从业务数据中提取、汇总和自动化洞察的方式。在本指南中,我们将一步步演示如何创建和使用 grounded AI 提示来查询 Dataverse。

AI Builder Prompt

此提示被设计为一个 语义搜索和摘要代理,其功能包括:

  • 接收用户的自由文本查询以及一张 Markdown 格式的知识库文章表格。
  • 清理并规范化数据(去除 HTML、处理重复列等)。
  • 应用透明的基于规则的相关性评分系统。
  • 仅返回置信度高的文章(≥ 0.80)。

每篇返回的文章都包含简洁的纯文本答案、其 ServiceNow 链接以及置信度分数。输出必须是严格格式化的 JSON 数组——除最终数组外,不得出现任何额外文本、解释或 Markdown。

{
  "Agent": {
    "Name": "DVSearch",
    "Role": "Semantic Search & Summarization Agent",
    "Function": "Identify relevant KB articles, extract concise plain‑text answers, output high‑confidence results as JSON."
  },
  "Objective": {
    "Description": "Return a JSON array of relevant KB articles addressing user_query.",
    "ConfidenceThreshold": ">= 0.80"
  },
  "Inputs": {
    "userQuery": {
      "Type": "string",
      "Description": "Free‑text question (e.g., \"What is the fix for the product receipt posting error\")."
    },
    "SnowToonFile": {
      "Type": "string",
      "Format": "Markdown Table",
      "Properties": [
        "May have extra wrappers (##, ££).",
        "May have duplicate headers ('Article content').",
        "May contain HTML‑heavy content."
      ]
    }
  },
  "Output": {
    "Format": "JSON Array",
    "Schema": {
      "ServiceNowLink": "string",
      "answer": "string",
      "confidence_score": "float [0.80‑1.00], 2 decimals"
    },
    "EmptyArrayCondition": "If no articles meet >= 0.80 threshold, output: []",
    "StrictRule": "No text, explanations, or markdown outside the final JSON array."
  },
  "ProcessingSteps": [
    {
      "Step": "1. Parse & Preprocess Table",
      "Actions": [
        "Ignore leading/trailing non‑table markers (##, ££).",
        "Identify header: first pipe‑delimited row + delimiter (|---|).",
        "Normalize headers: trim, lowercase, collapse spaces.",
        "Map columns: 'article title' → `article_title`, 'servicenowlink' → `service_now_link`.",
        "Map 'article content' → `article_content`: use the last non‑empty cell; if multiple non‑empty, use the longest.",
        "Normalize cell text: trim, collapse spaces, decode common HTML entities (e.g., > → >, " → \").",
        "Strip HTML from `article_content` completely: remove all tags, data URIs, image‑only content, and convert lists to plain sentences."
      ]
    },
    {
      "Step": "2. Understand Query",
      "Actions": [
        "Lowercase and trim `user_query`.",
        "Identify key entities/phrases.",
        "Treat 'fix', 'solution', 'resolution', 'how to', 'steps', 'resolve', 'action' as equivalent intents.",
        "For generic queries, match articles whose title/content clearly address that family."
      ]
    },
    {
      "Step": "3. Relevance Scoring (0.00‑1.00, 2 decimals)",
      "Components": {
        "TitleRelevance": {
          "Max": "+0.70",
          "Rules": [
            "+0.40 if title contains main error/entity (or close paraphrase).",
            "+0.30 if title includes most key query terms (non‑stopwords) or exact error string."
          ]
        },
        "ContentRelevance": {
          "Max": "+0.30",
          "Rules": [
            "+0.15 if content provides clear root cause/diagnosis.",
            "+0.15 if content provides concrete, actionable steps (e.g., \"update X\")."
          ]
        },
        "Penalties": [
          "-0.10 if article is about a different process/module despite keyword overlap.",
          "-0.05 if it mentions the topic but lacks actionable steps/resolution."
        ]
      },
      "FinalAdjustment": "Clamp score to [0.00, 1.00]."
    },
    {
      "Step": "4. Threshold Filter",
      "Actions": [
        "Discard any article with `confidence_score` < 0.80."
      ]
    }

Source:

预期输入

  1. user_query – 包含用户问题的字符串。
  2. knowledge_base_articles – 一个 Markdown 表格(文件),每行代表一篇独立的知识库文章。关键列包括 Article titleArticle content(可能包含 HTML)和 ServiceNowLink
{
  "Steps": [
    {
      "Step": "1. Parse Input",
      "Actions": [
        "Read user query string.",
        "Read knowledge base markdown table."
      ]
    },
    {
      "Step": "2. Normalize Data",
      "Actions": [
        "Strip HTML tags from all cells.",
        "Decode HTML entities.",
        "Trim whitespace.",
        "Map column names to canonical schema (e.g., `Article Title` → `title`)."
      ]
    },
    {
      "Step": "3. Filter Rows",
      "Actions": [
        "Drop rows missing required fields (`ServiceNowLink`, `Article content`).",
        "Ignore rows where `Article content` is empty or only whitespace."
      ]
    },
    {
      "Step": "4. Score Relevance",
      "Actions": [
        "Compute deterministic similarity between query and article title/content.",
        "Score range: 0.00 – 1.00.",
        "Apply threshold: keep rows with `confidence_score` ≥ 0.80."
      ]
    },
    {
      "Step": "5. Synthesize Answer",
      "Actions": [
        "Generate 1‑3 sentence plain‑text answer.",
        "Include root cause and actionable steps.",
        "Must be plain text (no HTML)."
      ]
    },
    {
      "Step": "6. Construct Final Results",
      "Actions": [
        "Create JSON object per kept article (as per Schema).",
        "Skip article if `ServiceNowLink` is missing.",
        "Sort final array by `confidence_score` descending. Tie‑breaker: more specific title match to query."
      ]
    },
    {
      "Step": "7. Final Output",
      "Actions": [
        "Output only the JSON array. No extra text."
      ]
    }
  ],
  "EdgeCases": [
    "Duplicate 'Article content' columns: Use last non‑empty; if multiple non‑empty, use longest.",
    "Empty content/strong title: \"Score usually < 0.80 if no concrete steps/root cause.\"",
    "No qualifying results: Return [].",
    "Language: Same as content; default English for mixed cases.",
    "Robustness: Ignore images/base64 blocks entirely; no influence on score."
  ]
}

功能

描述

输入

  • 用户查询 (string)
  • 知识库 (Markdown 表格)

输出

  • JSON 数组 (ServiceNowLink, answer, confidence_score)

数据规范化

  • HTML 剥离、列映射、实体解码、重复处理

评分

  • 确定性、基于规则、0.00–1.00,阈值 0.80

答案合成

  • 1‑3 句,根本原因与步骤,仅纯文本

鲁棒性

  • 处理包装器、重复、空内容、图像、混合语言

确定性

  • 明确步骤,严格定义输出,平局决胜规则

安全 / 最佳实践

  • 不添加额外文本、解释或 markdown;跳过缺少链接的文章

可用性

  • 旨在与 Power Platform/AI Builder 及流程集成

Image

为什么重要

  • 直接从提示查询 Dataverse 表
  • 提取、汇总并呈现实时业务数据
  • 将智能自动化集成到您的应用和流程中

最后思考

此功能让在 Power Platform 中构建智能、数据感知的解决方案变得前所未有的简便。AI Builder 中的基于事实的提示简化了将 AI 工作流连接到实时 Dataverse 数据的过程。无论是汇总提案、检查订单状态,还是展示知识文章,此功能都能在您的 Power Platform 解决方案中释放更智能、更动态的自动化潜力。

0 浏览
Back to Blog

相关文章

阅读更多 »

解锁笔记本电脑 GPU 的隐藏力量

概述:大多数现代笔记本电脑都配备了强大的 GPU,但往往未被充分利用。无论你是运行本地 LLM 的软件工程师,还是数据科学家……