Add Azure AI Search as Vector DB #106

Closed
opened 2026-02-16 10:18:05 -05:00 by yindo · 6 comments
Owner

Originally created by @AllenHu2024 on GitHub (Mar 21, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Azure AI Search is provided by Azure, and can be used as Vector DB & full text search index.
Most of our services are deployed in Azure Cloud, we need to use AI Search as vector DB.

2. Additional context or comments

https://learn.microsoft.com/zh-cn/azure/search/search-get-started-vector
And I am interested in this feature.

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @AllenHu2024 on GitHub (Mar 21, 2025). ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Azure AI Search is provided by Azure, and can be used as Vector DB & full text search index. Most of our services are deployed in Azure Cloud, we need to use AI Search as vector DB. ### 2. Additional context or comments https://learn.microsoft.com/zh-cn/azure/search/search-get-started-vector And I am interested in this feature. ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo closed this issue 2026-02-16 10:18:05 -05:00
Author
Owner

@Mizokuiam commented on GitHub (Mar 24, 2025):

Integrating Azure AI Search is definitely doable. You'll essentially be treating it like any other vector database backend. That means you'll need to handle things like:

  • Vector Embedding Generation: Ensure you're using a compatible embedding model (likely something from the sentence-transformers or OpenAI libraries, though Azure has its own offerings too). The key is consistency between indexing and querying.
  • Client Setup: The Azure Search SDK (for Python or whichever language dify uses) will be your primary tool for interacting with the service. You'll need to configure it with your service endpoint and API keys.
  • Indexing: This involves pushing your embeddings and associated metadata into an Azure Search index. You'll want to define an appropriate schema for your index, including fields for the vector embeddings themselves (likely a Collection(Edm.Single)), as well as any other relevant data.
  • Querying: Use the Azure Search SDK to perform similarity searches against your index. This will involve sending a query vector and retrieving the nearest neighbors based on a chosen similarity metric (cosine similarity being common). You'll likely need to handle pagination for larger datasets.

I've seen similar integrations before where folks abstract the vector DB interaction behind an interface. That allows you to easily swap between different vector DB backends (like FAISS, Pinecone, etc.) without changing core application logic. This could be a good approach for dify too, offering more flexibility down the line.

For a rough idea, a snippet might look like this (Python example, assuming you've already handled client setup and schema definition):

from azure.search.documents import SearchClient

# ... (client initialization, etc.) ...

def index_document(client: SearchClient, document_id: str, embedding: list, metadata: dict):
    document = {
        "id": document_id,
        "embedding": embedding,
        # ... other metadata fields ...
    }
    client.upload_documents([document])


def search_vectors(client: SearchClient, query_embedding: list, top_k: int):
    results = client.search(
        search_text="", # Empty search text as we are querying vectors
        vector=query_embedding,
        top=top_k,
        select="id, embedding, ...", # Fields to retrieve
        semantic_configuration_name="default", # or your custom config name
        vector_search_mode="similarity" # or "hybrid" if combining with text search
    )
    return results

Obviously, you'll need to adapt this to dify's architecture, but it illustrates the general idea.

Hit me up if you run into any snags or want to discuss the implementation in more detail. Happy to help!

@Mizokuiam commented on GitHub (Mar 24, 2025): Integrating Azure AI Search is definitely doable. You'll essentially be treating it like any other vector database backend. That means you'll need to handle things like: * **Vector Embedding Generation:** Ensure you're using a compatible embedding model (likely something from the `sentence-transformers` or `OpenAI` libraries, though Azure has its own offerings too). The key is consistency between indexing and querying. * **Client Setup:** The Azure Search SDK (for Python or whichever language `dify` uses) will be your primary tool for interacting with the service. You'll need to configure it with your service endpoint and API keys. * **Indexing:** This involves pushing your embeddings and associated metadata into an Azure Search index. You'll want to define an appropriate schema for your index, including fields for the vector embeddings themselves (likely a `Collection(Edm.Single)`), as well as any other relevant data. * **Querying:** Use the Azure Search SDK to perform similarity searches against your index. This will involve sending a query vector and retrieving the nearest neighbors based on a chosen similarity metric (cosine similarity being common). You'll likely need to handle pagination for larger datasets. I've seen similar integrations before where folks abstract the vector DB interaction behind an interface. That allows you to easily swap between different vector DB backends (like FAISS, Pinecone, etc.) without changing core application logic. This could be a good approach for `dify` too, offering more flexibility down the line. For a rough idea, a snippet might look like this (Python example, assuming you've already handled client setup and schema definition): ```python from azure.search.documents import SearchClient # ... (client initialization, etc.) ... def index_document(client: SearchClient, document_id: str, embedding: list, metadata: dict): document = { "id": document_id, "embedding": embedding, # ... other metadata fields ... } client.upload_documents([document]) def search_vectors(client: SearchClient, query_embedding: list, top_k: int): results = client.search( search_text="", # Empty search text as we are querying vectors vector=query_embedding, top=top_k, select="id, embedding, ...", # Fields to retrieve semantic_configuration_name="default", # or your custom config name vector_search_mode="similarity" # or "hybrid" if combining with text search ) return results ``` Obviously, you'll need to adapt this to `dify`'s architecture, but it illustrates the general idea. Hit me up if you run into any snags or want to discuss the implementation in more detail. Happy to help!
Author
Owner

@dosubot[bot] commented on GitHub (Apr 25, 2025):

Hi, @AllenHu2024. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You requested the integration of Azure AI Search as a Vector Database due to your services being primarily on Azure Cloud.
  • Mizokuiam responded with a feasible plan for integration, including a detailed guide on vector embedding generation, client setup, indexing, and querying using Azure Search SDK.
  • Mizokuiam suggested abstracting vector database interaction for backend flexibility and offered further assistance with implementation.

Next Steps:

  • Please let us know if this issue is still relevant to the latest version of the Dify repository by commenting here to keep the discussion open.
  • If no further activity occurs, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Apr 25, 2025): Hi, @AllenHu2024. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You requested the integration of Azure AI Search as a Vector Database due to your services being primarily on Azure Cloud. - Mizokuiam responded with a feasible plan for integration, including a detailed guide on vector embedding generation, client setup, indexing, and querying using Azure Search SDK. - Mizokuiam suggested abstracting vector database interaction for backend flexibility and offered further assistance with implementation. **Next Steps:** - Please let us know if this issue is still relevant to the latest version of the Dify repository by commenting here to keep the discussion open. - If no further activity occurs, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@AllenHu2024 commented on GitHub (Apr 25, 2025):

@dosubot the feature does not exist in the latest version.

@AllenHu2024 commented on GitHub (Apr 25, 2025): @dosubot the feature does not exist in the latest version.
Author
Owner

@dosubot[bot] commented on GitHub (Apr 25, 2025):

@crazywoola, the user @AllenHu2024 has indicated that the integration of Azure AI Search as a Vector Database is still relevant and does not exist in the latest version. Could you please assist them with this issue?

@dosubot[bot] commented on GitHub (Apr 25, 2025): @crazywoola, the user @AllenHu2024 has indicated that the integration of Azure AI Search as a Vector Database is still relevant and does not exist in the latest version. Could you please assist them with this issue?
Author
Owner

@kejoe-zhang commented on GitHub (Apr 27, 2025):

@dosubot the feature does not exist in the latest version.@dosubot 最新版本中不存在该功能。

Hello, have you implemented this feature (dify support Azure AI Search?)

@kejoe-zhang commented on GitHub (Apr 27, 2025): > @dosubot the feature does not exist in the latest version.@dosubot 最新版本中不存在该功能。 Hello, have you implemented this feature (dify support Azure AI Search?)
Author
Owner

@dosubot[bot] commented on GitHub (Apr 27, 2025):

I found a similar unsolved discussion regarding Azure AI Search integration with Dify: Is supported Saas KnowledgeBase like Azure AI Search [1]. Additionally, there was a closed issue titled Hope to add Azure AI search function to Dify, but no solution was found in the comments [2].

To integrate Azure AI Search as a vector database backend in Dify, you would need to treat it like any other vector database backend. This involves:

  1. Vector Embedding Generation: Use a compatible embedding model, ensuring consistency between indexing and querying.
  2. Client Setup: Configure the Azure Search SDK with your service endpoint and API keys.
  3. Indexing: Push embeddings and metadata into an Azure Search index, defining an appropriate schema.
  4. Querying: Perform similarity searches using the Azure Search SDK, handling pagination for larger datasets.

You might consider abstracting the vector DB interaction behind an interface to allow easy swapping between different vector DB backends, offering more flexibility for Dify [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 27, 2025): <!-- Answer --> I found a similar unsolved discussion regarding Azure AI Search integration with Dify: [Is supported Saas KnowledgeBase like Azure AI Search](https://github.com/langgenius/dify/discussions/7731) <sup>[[1]](https://github.com/langgenius/dify/discussions/7731)</sup>. Additionally, there was a closed issue titled [Hope to add Azure AI search function to Dify](https://github.com/langgenius/dify/issues/1819), but no solution was found in the comments <sup>[[2]](https://github.com/langgenius/dify/issues/1819)</sup>. To integrate Azure AI Search as a vector database backend in Dify, you would need to treat it like any other vector database backend. This involves: 1. **Vector Embedding Generation**: Use a compatible embedding model, ensuring consistency between indexing and querying. 2. **Client Setup**: Configure the Azure Search SDK with your service endpoint and API keys. 3. **Indexing**: Push embeddings and metadata into an Azure Search index, defining an appropriate schema. 4. **Querying**: Perform similarity searches using the Azure Search SDK, handling pagination for larger datasets. You might consider abstracting the vector DB interaction behind an interface to allow easy swapping between different vector DB backends, offering more flexibility for Dify <sup>[[1]](https://github.com/langgenius/dify/discussions/7731)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8472498f-73ba-4b84-b06c-c6245d0351c3?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#106