Bing search tool always add entities to responseFilter #4412

Closed
opened 2026-02-21 18:06:18 -05:00 by yindo · 4 comments
Owner

Originally created by @qkxie on GitHub (Jul 3, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Use Bing search tool

✔️ Expected Behavior

answer search result.

Actual Behavior

image
image

In Bing search tool, I only choose webpage to search, but the api request always add entities to responseFilter, this make my api call error. Because my Bing API subscribtion doesn't include entities search, so responseFilter should not include entities

Originally created by @qkxie on GitHub (Jul 3, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.11 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Use Bing search tool ### ✔️ Expected Behavior answer search result. ### ❌ Actual Behavior ![image](https://github.com/langgenius/dify/assets/134578340/4ccc0dc8-a338-4875-aca9-1587ab6e846f) ![image](https://github.com/langgenius/dify/assets/134578340/e5f5e239-1c1a-42bb-99ce-28a52840a2b4) In Bing search tool, I only choose webpage to search, but the api request always add entities to responseFilter, this make my api call error. Because my Bing API subscribtion doesn't include entities search, so responseFilter should not include entities
yindo added the 🐞 bug label 2026-02-21 18:06:18 -05:00
yindo closed this issue 2026-02-21 18:06:18 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 3, 2024):

@qkxie Hello there! I'm here to help you with bugs, questions, and becoming a contributor. Let me know how I can assist you.

To resolve the issue with the Bing search tool in Dify version 0.6.11, you need to ensure that the enable_entities parameter is set to false in the tool parameters. This will prevent the inclusion of "Entities" in the responseFilter parameter, avoiding the 403 error due to insufficient authorization for entity search.

Here is how you can configure the tool parameters:

tool_parameters:
  enable_entities: false
  enable_computation: true
  enable_news: true
  enable_related_search: true
  enable_webpages: true

In the bing_web_search.py file, the validate_credentials and _invoke methods check the enable_entities parameter and include "Entities" in the responseFilter only if it is set to true. By setting enable_entities to false, you ensure that "Entities" is not included in the responseFilter.

Here is the relevant section of the bing_web_search.py file:

def validate_credentials(self, credentials: dict[str, Any], tool_parameters: dict[str, Any]) -> None:
    # ... other code ...
    filter = []

    if tool_parameters.get('enable_computation', False):
        filter.append('Computation')
    if tool_parameters.get('enable_entities', False):
        filter.append('Entities')
    if tool_parameters.get('enable_news', False):
        filter.append('News')
    if tool_parameters.get('enable_related_search', False):
        filter.append('RelatedSearches')
    if tool_parameters.get('enable_webpages', False):
        filter.append('WebPages')

    if not filter:
        raise Exception('At least one filter is required')
    
    self._invoke_bing(
        user_id='test',
        server_url=server_url,
        subscription_key=key,
        query=query,
        limit=limit,
        result_type=result_type,
        market=market,
        lang=lang,
        filters=filter
    )

Make sure to update your tool parameters accordingly to disable entity search and avoid the 403 error [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 3, 2024): <!-- Greeting --> @qkxie Hello there! I'm here to help you with bugs, questions, and becoming a contributor. Let me know how I can assist you. <!-- Answer --> To resolve the issue with the Bing search tool in Dify version 0.6.11, you need to ensure that the `enable_entities` parameter is set to `false` in the tool parameters. This will prevent the inclusion of "Entities" in the `responseFilter` parameter, avoiding the 403 error due to insufficient authorization for entity search. Here is how you can configure the tool parameters: ```yaml tool_parameters: enable_entities: false enable_computation: true enable_news: true enable_related_search: true enable_webpages: true ``` In the `bing_web_search.py` file, the `validate_credentials` and `_invoke` methods check the `enable_entities` parameter and include "Entities" in the `responseFilter` only if it is set to `true`. By setting `enable_entities` to `false`, you ensure that "Entities" is not included in the `responseFilter`. Here is the relevant section of the `bing_web_search.py` file: ```python def validate_credentials(self, credentials: dict[str, Any], tool_parameters: dict[str, Any]) -> None: # ... other code ... filter = [] if tool_parameters.get('enable_computation', False): filter.append('Computation') if tool_parameters.get('enable_entities', False): filter.append('Entities') if tool_parameters.get('enable_news', False): filter.append('News') if tool_parameters.get('enable_related_search', False): filter.append('RelatedSearches') if tool_parameters.get('enable_webpages', False): filter.append('WebPages') if not filter: raise Exception('At least one filter is required') self._invoke_bing( user_id='test', server_url=server_url, subscription_key=key, query=query, limit=limit, result_type=result_type, market=market, lang=lang, filters=filter ) ``` Make sure to update your tool parameters accordingly to disable entity search and avoid the 403 error <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/bing/bing.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/bing/tools/bing_web_search.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@qkxie commented on GitHub (Jul 3, 2024):

I have already make sure that enable_entities ui false

image

@qkxie commented on GitHub (Jul 3, 2024): I have already make sure that enable_entities ui false ![image](https://github.com/langgenius/dify/assets/134578340/c2bd854d-b25b-4a17-9507-2d42aff4eec0)
Author
Owner

@qkxie commented on GitHub (Jul 3, 2024):

Now I have to fix the code of dify/api/core/tools/provider/builtin/bing/tools/tools/bing_web_search.py

@qkxie commented on GitHub (Jul 3, 2024): Now I have to fix the code of dify/api/core/tools/provider/builtin/bing/tools/tools/bing_web_search.py
Author
Owner

@keita69 commented on GitHub (Jul 6, 2024):

In 0.6.12-fix, it is expected to work properly only if the FEATURES of the Bing Search API v7 Pricing Details include "Bing Entity Search".

In other words, it is expected to work properly if the INSTANCE of the Bing Search API v7 Pricing Details is as follows:

  • Free
  • S1
  • S7
@keita69 commented on GitHub (Jul 6, 2024): In 0.6.12-fix, it is expected to work properly only if the FEATURES of the [Bing Search API v7 Pricing Details](https://www.microsoft.com/en-us/bing/apis/pricing) include "Bing Entity Search". In other words, it is expected to work properly if the INSTANCE of the Bing Search API v7 Pricing Details is as follows: - Free - S1 - S7
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4412