How to

Dify work with Microsoft AI Search

Dify’s custom tool makes it easy to add Azure’s fast, AI-driven search via REST API.

Xinyu Wei

Senior Technical Specialist in Microsoft

Written on

Jan 22, 2025

Share

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

·

Jan 22, 2025

Dify work with Microsoft AI Search

Dify’s custom tool makes it easy to add Azure’s fast, AI-driven search via REST API.

Xinyu Wei

Senior Technical Specialist in Microsoft

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

Dify work with Microsoft AI Search

Dify’s custom tool makes it easy to add Azure’s fast, AI-driven search via REST API.

Xinyu Wei

Senior Technical Specialist in Microsoft

Written on

Jan 22, 2025

Share

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

·

Jan 22, 2025

Dify work with Microsoft AI Search

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

·

Jan 22, 2025

Dify work with Microsoft AI Search

Share to Twitter
Share to LinkedIn
Share to Hacker News

Dify is an open-source platform for developing large language model (LLM) applications. It combines the concepts of Backend as a Service (BaaS) and LLMOps, enabling developers to quickly build production-grade generative AI applications.

Dify offers various types of tools, including first-party and custom tools. These tools can extend the capabilities of LLMs, such as web search, scientific calculations, image generation, and more. On Dify, you can create more powerful AI applications, like intelligent assistant-type applications, which can complete complex tasks through task reasoning, step decomposition, and tool invocation.

Dify works with AI Search Demo

Till now, Dify could not integrate with Microsoft directly via default Dify web portal. Let me show how to achieve it.

Please log in to YouTube to watch the tutorial.

Dify works with AI Search Configuration steps

Configure on AI search:

Create index, make sure you could get the result from AI search index:

Run Dify on VM via docker:

root@a100vm:~# docker ps |grep -i dify
5d6c32a94313   langgenius/dify-api:0.8.3          "/bin/bash /entrypoi…"   3 months ago   Up 3 minutes             5001/tcp                                                                   docker-worker-1
264e477883ee   langgenius/dify-api:0.8.3          "/bin/bash /entrypoi…"   3 months ago   Up 3 minutes             5001/tcp                                                                   docker-api-1
2eb90cd5280a   langgenius/dify-sandbox:0.2.9      "/main"                  3 months ago   Up 3 minutes (healthy)                                                                              docker-sandbox-1
708937964fbb   langgenius/dify-web:0.8.3          "/bin/sh ./entrypoin…"   3 months ago   Up 3 minutes             3000/tcp                                                                   docker-web-1

Create customer tool in Dify portal,set schema:

Schema details:

{
  "openapi": "3.0.0",
  "info": {
    "title": "Azure Cognitive Search Integration",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://ai-search-eastus-xinyuwei.search.windows.net"
    }
  ],
  "paths": {
    "/indexes/wukong-doc1/docs": {
      "get": {
        "operationId": "getSearchResults",
        "parameters": [
          {
            "name": "api-version",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "2024-11-01-preview"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "@odata.context": { "type": "string" },
                    "value": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "@search.score": { "type": "number" },
                          "chunk_id": { "type": "string" },
                          "parent_id": { "type": "string" },
                          "title": { "type": "string" },
                          "chunk": { "type": "string" },
                          "text_vector": { "type": "SingleCollection" },
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Set AI Search AI key:

Do search test:

Input words:

Create a workflow on Dify:

 Check AI search stage:

Check LLM stage:

Run workflow:

Get workflow result:

On this page

    Related articles

    The Innovation Engine for Generative AI Applications

    The Innovation Engine for Generative AI Applications

    The Innovation Engine for Generative AI Applications